6 #ifndef TB_NODE_REF_TREE_H
7 #define TB_NODE_REF_TREE_H
9 #include "tb_linklist.h"
10 #include "tb_node_tree.h"
16 class TBNodeRefTreeListener;
29 const TBStr & GetName()
const {
return m_name; }
30 const TBID &GetNameID()
const {
return m_name_id; }
34 void ReadData(
const char *data) { m_node.
ReadData(data); }
67 void InvokeChangeListenersInternal(
const char *request);
88 #endif // TB_NODE_REF_TREE_H
TBLinkListOf is a double linked linklist.
Definition: tb_linklist.h:122
bool ReadFile(const TBStr &filename, TB_NODE_READ_FLAGS flags=TB_NODE_READ_FLAGS_NONE)
Read a tree of nodes from file into this node.
Definition: tb_node_tree.cpp:290
virtual void OnDataChanged(TBNodeRefTree *rt, const char *request)=0
Called when the value is changed for the given node in the given ref tree.
TBNodeRefTreeListener receive OnDataChanged when the value of a node in a TBNodeRefTree is changed...
Definition: tb_node_ref_tree.h:78
void ReadData(const char *data, TB_NODE_READ_FLAGS flags=TB_NODE_READ_FLAGS_NONE)
Read a tree of nodes from a null terminated string buffer.
Definition: tb_node_tree.cpp:304
void RemoveListener(TBNodeRefTreeListener *listener)
Remove a change listener from this tree.
Definition: tb_node_ref_tree.h:40
Definition: tb_node_tree.cpp:183
virtual TBValue & GetValue(const char *request)
Get the value of the given request.
Definition: tb_node_ref_tree.cpp:27
bool ReadFile(const char *filename)
Read the data file.
Definition: tb_node_ref_tree.h:33
TBID is a wrapper for a uint32_t to be used as ID.
Definition: tb_id.h:18
static TBValue & GetValueFromTree(const char *request)
Get the value of the given tree name and request (>noderequest).
Definition: tb_node_ref_tree.cpp:37
virtual void SetValue(const char *request, const TBValue &value)
Set the value for the given request and invoke the change listener.
Definition: tb_node_ref_tree.cpp:49
static void ResolveConditions(TBNode *parent_node)
Go through the tree of nodes recursively and include or remove branches depending on any conditions...
Definition: tb_node_ref_tree.cpp:144
TBNodeRefTree is a named TBNode.
Definition: tb_node_ref_tree.h:23
TBStr is a simple string class.
Definition: tb_str.h:62
TBNode is a tree node with a string name and a value (TBValue).
Definition: tb_node_tree.h:30
TBValue holds value of a specific type.
Definition: tb_value.h:59
Definition: tb_linklist.h:83
void AddListener(TBNodeRefTreeListener *listener)
Add a listener that is invoked on changes in this tree.
Definition: tb_node_ref_tree.h:37
static TBNodeRefTree * GetRefTree(const char *name, int name_len)
Return the tree with the given name, or nullptr if no matching tree exists.
Definition: tb_node_ref_tree.cpp:67