Sleeping Wombat GUI  0.100
swGUI
DirectPropertyh.h
Go to the documentation of this file.
1 #pragma once
2 
10 
13 
14 
16 template< typename KeyType >
18 {
19 private:
21  rttr::variant m_object;
22 
23 protected:
24 public:
26  explicit DirectProperty ();
27  explicit DirectProperty ( EngineObject* object, const std::string& propertyPath );
28  ~DirectProperty () = default;
29 
30 
31  KeyType GetValue ( EngineObject* object );
32  void SetValue ( EngineObject* object, KeyType& value );
33 };
34 
35 //====================================================================================//
36 // Implementation
37 //====================================================================================//
38 
39 // ================================ //
40 //
41 template< typename KeyType >
43  : m_property( Properties::EmptyProperty() )
44  , m_object( rttr::variant() )
45 {}
46 
47 
48 // ================================ //
49 //
50 template< typename KeyType >
51 inline DirectProperty< KeyType >::DirectProperty ( EngineObject* object, const std::string& propertyPath )
52  : m_property( Properties::EmptyProperty() )
53  , m_object( nullptr )
54 {
55  auto accessor = Properties::GetProperty( object, propertyPath );
56  m_property = accessor.second;
57  m_object = accessor.first;
58 }
59 
60 // ================================ //
61 //
62 template< typename KeyType >
64 {
65  return Serialization::GetPropertyValue< KeyType >( m_property, m_object );
66 }
67 
68 // ================================ //
69 //
70 template< typename KeyType >
72 {
73  Serialization::SetPropertyValue( m_property, m_object, value );
74 }
75 
Definition: ResourcePtr.h:116
rttr::property m_property
Definition: DirectPropertyh.h:20
~DirectProperty()=default
KeyType
Definition: all_0.js:13
void SetValue(EngineObject *object, KeyType &value)
Definition: DirectPropertyh.h:71
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"
rttr::variant m_object
Definition: DirectPropertyh.h:21
Definition: DirectPropertyh.h:17
KeyType GetValue(EngineObject *object)
Definition: DirectPropertyh.h:63
Klasa bazowa dla obiektów, które mają być dostępne w edytorze poprzez rttr. Należy po niej odziedzicz...
Definition: EngineObject.h:22
static void SetPropertyValue(rttr::property prop, const rttr::instance &object, PropertyType value)
Ustawia wartość podanej właściwości.
Definition: Serialization.inl:50
Definition: Properties.h:10
DirectProperty()
Constructor for serialization.
Definition: DirectPropertyh.h:42