Sleeping Wombat GUI  0.100
swGUI
StringPropertyPath.h
Go to the documentation of this file.
1 #pragma once
2 
9 
10 
12 template< typename KeyType >
14 {
15 private:
16  std::string m_path;
17 
18 protected:
19 public:
20  explicit StringPropertyPath ();
21  explicit StringPropertyPath ( EngineObject* object, const std::string& propertyPath );
22  ~StringPropertyPath () = default;
23 
24 
25  KeyType GetValue ( EngineObject* object );
26  void SetValue ( EngineObject* object, KeyType& value );
27 };
28 
29 
30 //====================================================================================//
31 // Implementation
32 //====================================================================================//
33 
34 
35 // ================================ //
36 //
37 template< typename KeyType >
39  : m_path( "" )
40 {}
41 
42 // ================================ //
43 //
44 template< typename KeyType >
45 inline StringPropertyPath< KeyType >::StringPropertyPath( EngineObject* object, const std::string& propertyPath )
46  : m_path( propertyPath )
47 {}
48 
49 // ================================ //
50 //
51 template< typename KeyType >
53 {
54  auto finalPair = Properties::GetProperty( object, m_path );
55  auto& owner = finalPair.first;
56  auto& prop = finalPair.second;
57 
58  return Serialization::GetPropertyValue< KeyType >( prop, owner );
59 }
60 
61 template< typename KeyType >
63 {
64  auto finalPair = Properties::GetProperty( object, m_path );
65  auto& owner = finalPair.first;
66  auto& prop = finalPair.second;
67 
68  Serialization::SetPropertyValue( prop, owner, value );
69 }
StringPropertyPath()
Definition: StringPropertyPath.h:38
KeyType
Definition: all_0.js:13
static std::pair< rttr::variant, rttr::property > GetProperty(EngineObject *object, const std::string &propertyPath, char separator= '/')
Definition: Properties.cpp:66
KeyType GetValue(EngineObject *object)
Definition: StringPropertyPath.h:52
void SetValue(EngineObject *object, KeyType &value)
Definition: StringPropertyPath.h:62
~StringPropertyPath()=default
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: StringPropertyPath.h:13
std::string m_path
Definition: StringPropertyPath.h:16