Small footprint UI library for hardware accelerated games & applications
リビジョン | 86794f28fc80ed11818576451b10901e3bc43703 (tree) |
---|---|
日時 | 2016-12-22 05:02:37 |
作者 | Emil Segerås <emilsegers@gmai...> |
コミッター | Emil Segerås |
Added follow_ref to CloneChildren.
@@ -92,7 +92,7 @@ TBNode *TBNode::GetNodeInternal(const char *name, int name_len) const | ||
92 | 92 | return nullptr; |
93 | 93 | } |
94 | 94 | |
95 | -bool TBNode::CloneChildren(TBNode *source) | |
95 | +bool TBNode::CloneChildren(TBNode *source, bool follow_refs) | |
96 | 96 | { |
97 | 97 | TBNode *item = source->GetFirstChild(); |
98 | 98 | while (item) |
@@ -101,10 +101,10 @@ bool TBNode::CloneChildren(TBNode *source) | ||
101 | 101 | if (!new_child) |
102 | 102 | return false; |
103 | 103 | |
104 | - new_child->m_value.Copy(item->m_value); | |
104 | + new_child->m_value.Copy(follow_refs ? item->GetValueFollowRef() : item->m_value); | |
105 | 105 | Add(new_child); |
106 | 106 | |
107 | - if (!new_child->CloneChildren(item)) | |
107 | + if (!new_child->CloneChildren(item, follow_refs)) | |
108 | 108 | return false; |
109 | 109 | item = item->GetNext(); |
110 | 110 | } |
@@ -67,9 +67,11 @@ public: | ||
67 | 67 | void Delete(TBNode *n) { m_children.Delete(n); } |
68 | 68 | |
69 | 69 | /** Create duplicates of all items in source and add them to this node. |
70 | + If follow_refs is true, any references will be followed and the final target | |
71 | + will be cloned instead of the ref node. | |
70 | 72 | Note: Nodes does not replace existing nodes with the same name. Cloned nodes |
71 | 73 | are added after any existing nodes. */ |
72 | - bool CloneChildren(TBNode *source); | |
74 | + bool CloneChildren(TBNode *source, bool follow_refs = false); | |
73 | 75 | |
74 | 76 | enum GET_MISS_POLICY { |
75 | 77 | /** GetNode will return nullptr if the node doesn't exist. */ |