siplasplas
scope.hpp
1 #ifndef SIPLASPLAS_REFLECTION_DYNAMIC_SCOPE_HPP
2 #define SIPLASPLAS_REFLECTION_DYNAMIC_SCOPE_HPP
3 
4 #include <siplasplas/utility/string.hpp>
5 #include <siplasplas/reflection/dynamic/export.hpp>
6 
7 #include <string>
8 #include <vector>
9 
10 
11 namespace cpp
12 {
13 
14 namespace dynamic_reflection
15 {
16 
17 class SIPLASPLAS_REFLECTION_DYNAMIC_EXPORT Scope
18 {
19 public:
20  static const Scope& globalScope();
21  static Scope fromFullName(const std::string& fullName);
22  static Scope fromParentScope(const Scope& parentScope, const std::string& name);
23 
24  std::size_t depth() const;
25  std::string name() const;
26  const std::string& fullName() const;
27 
28  friend bool operator==(const Scope& lhs, const Scope& rhs);
29  friend bool operator!=(const Scope& lhs, const Scope& rhs);
30 
31  Scope parent() const;
32  bool isGlobalScope() const;
33 
34 private:
35  std::string _fullName;
36  std::vector<std::size_t> _separators;
37 
38  Scope(const std::string& fullName);
39  Scope(std::string&& fullName, std::vector<std::size_t>&& separators);
40 };
41 
42 }
43 
44 }
45 
46 #endif // SIPLASPLAS_REFLECTION_DYNAMIC_SCOPE_HPP
Definition: messaging.hpp:8
Definition: scope.hpp:17