Sleeping Wombat GUI  0.100
swGUI
Properties.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include <vector>
7 #include <string>
8 
9 
11 {
12 private:
13 public:
14 
15  static std::vector< rttr::property > GetPropertyPath ( EngineObject* object, const std::string& propertyPath, char separator = '/' );
16  static std::vector< rttr::property > GetPropertyPath ( rttr::variant object, const std::string& propertyPath, Size offset = 0, char separator = '/' );
17 
18  static std::pair< rttr::variant, rttr::property > GetProperty ( EngineObject* object, const std::string& propertyPath, char separator = '/' );
19  static std::pair< rttr::variant, rttr::property > GetProperty ( rttr::variant object, const std::string& propertyPath, Size offset = 0, char separator = '/' );
20  static std::pair< rttr::variant, rttr::property > GetProperty ( EngineObject* object, const std::vector< rttr::property >& propertyPath );
21 
22  template< typename Type >
23  static Type GetValue ( EngineObject* object, const std::vector< rttr::property >& propertyPath );
24 
25  static rttr::property EmptyProperty ();
26  static TypeID GetRealType ( rttr::variant& object );
27  static TypeID GetRealType ( EngineObject* object );
28 };
29 
30 //====================================================================================//
31 // Implementation
32 //====================================================================================//
33 
34 
35 template< typename Type >
36 inline Type Properties::GetValue ( EngineObject* object, const std::vector< rttr::property >& propertyPath )
37 {
38  rttr::variant propertyVal = object;
39 
40  for( auto& property : propertyPath )
41  {
42  propertyVal = property.get_value( propertyVal );
43  }
44 
45  return propertyVal.get_value< Type >();
46 }
static std::pair< rttr::variant, rttr::property > GetProperty(EngineObject *object, const std::string &propertyPath, char separator= '/')
Definition: Properties.cpp:66
&RenderTargetObject::m_colorBuffer property("DepthBuffer",&RenderTargetObject::m_depthBuffer).property("StencilBuffer"
static Type GetValue(EngineObject *object, const std::vector< rttr::property > &propertyPath)
Definition: Properties.h:36
size_t Size
Definition: TypesDefinitions.h:35
Klasa bazowa dla obiektów, które mają być dostępne w edytorze poprzez rttr. Należy po niej odziedzicz...
Definition: EngineObject.h:22
rttr::type TypeID
Definition: RTTR.h:32
static std::vector< rttr::property > GetPropertyPath(EngineObject *object, const std::string &propertyPath, char separator= '/')
Definition: Properties.cpp:24
static TypeID GetRealType(rttr::variant &object)
Gets real type of object. If class inherited EngineObject, we can check it's real type...
Definition: Properties.cpp:124
Definition: Properties.h:10
static rttr::property EmptyProperty()
Definition: Properties.cpp:114