siplasplas
sourceinfo.hpp
1 #ifndef SIPLASPLAS_REFLECTION_DYNAMIC_SOURCEINFO_HPP
2 #define SIPLASPLAS_REFLECTION_DYNAMIC_SOURCEINFO_HPP
3 
4 #include "scope.hpp"
5 #include <siplasplas/reflection/static/sourceinfo.hpp>
6 #include <string>
7 
8 namespace cpp
9 {
10 
11 namespace dynamic_reflection
12 {
13 
14 using Kind = static_reflection::Kind;
15 
16 class SIPLASPLAS_REFLECTION_DYNAMIC_EXPORT SourceInfo
17 {
18 public:
20 
21  SourceInfo(const std::string& fullName,
22  const Kind& kind,
23  const std::string& spelling,
24  const std::string& displayName,
25  const std::string& file,
26  std::size_t line);
27 
28  SourceInfo(const std::string& fullName, const Kind& kind);
29 
30  template<typename Entity>
31  static SourceInfo fromStaticSourceInfo()
32  {
33  return {
34  Entity::SourceInfo::SourceInfo::fullName().str(),
35  Entity::SourceInfo::kind(),
36  Entity::SourceInfo::spelling().str(),
37  Entity::SourceInfo::displayName(),
38  Entity::SourceInfo::file(),
39  Entity::SourceInfo::line()
40  };
41  }
42 
43  const std::string& spelling() const;
44  const std::string& displayName() const;
45  const std::string& file() const;
46  std::size_t line() const;
47 
48  const std::string& name() const;
49  const std::string& fullName() const;
50 
51  const Scope& scope() const;
52  const Kind& kind() const;
53 
54 private:
55  Scope _scope;
56  Kind _kind;
57  std::string _spelling;
58  std::string _displayName;
59  std::string _file;
60  std::size_t _line;
61 };
62 
63 }
64 
65 }
66 
67 #endif // SIPLASPLAS_REFLECTION_DYNAMIC_SOURCEINFO_HPP
Definition: messaging.hpp:8
Kind
Represents the different types of entities (namespaces, classes, functions, etc) the library can coll...
Definition: sourceinfo.hpp:24
Definition: scope.hpp:17
Definition: sourceinfo.hpp:16