API Documentation
Node.h
1 // Node.h
3 //
5 
6 namespace nkExport
7 {
11  enum class NODE_VALUE_TYPE
12  {
14  BOOL_TYPE,
15  STRING_TYPE,
16  INT_TYPE,
17  UINT_TYPE,
18  LONG_TYPE,
19  ULONG_TYPE,
20  FLOAT_TYPE,
22  } ;
23 
27  enum class NODE_NATURE
28  {
29  EMPTY_NATURE = 0,
30  VALUE_NATURE,
33  } ;
34 }
35 
36 namespace nkExport
37 {
41  class Node final
42  {
43  public :
44 
48  Node () noexcept ;
54  Node (const Node& other) noexcept ;
60  Node (Node&& other) noexcept ;
61 
62  // Getters
63  // Globals
72  // Utils
76  bool isValueTypeNumber () const ;
82  bool hasChild (nkMemory::StringView key, NODE_VALUE_TYPE valueType) ;
88  bool hasChild (nkMemory::StringView key, NODE_NATURE nature) ;
89  // Value
95  nkMemory::StringView getValueAsString () const ;
101  int getValueAsInt () const ;
107  unsigned int getValueAsUint () const ;
113  long long getValueAsLong () const ;
119  unsigned long long getValueAsUlong () const ;
125  float getValueAsFloat () const ;
131  double getValueAsDouble () const ;
137  bool getValueAsBool () const ;
138  // Object
142  unsigned int getMemberCount () const ;
150  nkMemory::StringView getMemberKey (unsigned int index) const ;
157  Node* getMemberValue (unsigned int index) const ;
168  Node* getMemberValue (nkMemory::StringView key) const ;
180  Node* getMemberValue (nkMemory::StringView key, NODE_VALUE_TYPE valueType) const ;
192  Node* getMemberValue (nkMemory::StringView key, NODE_NATURE nodeNature) const ;
196  unsigned int getArraySize () const ;
201  Node* getArrayElement (unsigned int index) const ;
207  Node* getArrayElement (unsigned int index, NODE_VALUE_TYPE valueType) const ;
213  Node* getArrayElement (unsigned int index, NODE_NATURE nodeNature) const ;
217  void* getUserData () const ;
218 
219  // Setters
225  void setAsString (nkMemory::StringView value) ;
231  void setAsInt (int value) ;
237  void setAsUint (unsigned int value) ;
243  void setAsLong (long long value) ;
249  void setAsUlong (unsigned long long value) ;
255  void setAsFloat (float value) ;
261  void setAsDouble (double value) ;
267  void setAsBool (bool value) ;
276  Node* addMember (nkMemory::StringView key) ;
284  void deleteMember (nkMemory::StringView key) ;
299  void setUserData (void* value) ;
300 
301  // Operators
308  Node& operator= (const Node& other) ;
315  Node& operator= (Node&& other) ;
316  } ;
317 }
nkExport::NODE_VALUE_TYPE::NOT_VALUE_TYPE
@ NOT_VALUE_TYPE
A node which is an object or an array will have no value attached. In such case, this value is return...
nkExport::NODE_VALUE_TYPE::FLOAT_TYPE
@ FLOAT_TYPE
A node holding a float.
nkExport::Node::getValueAsUint
unsigned int getValueAsUint() const
nkExport::Node::getArrayElement
Node * getArrayElement(unsigned int index) const
nkExport::Node::getMemberValue
Node * getMemberValue(unsigned int index) const
nkExport::Node::setAsFloat
void setAsFloat(float value)
nkExport::NODE_VALUE_TYPE::DOUBLE_TYPE
@ DOUBLE_TYPE
A node holding a double.
nkExport::Node::setAsBool
void setAsBool(bool value)
nkExport::NODE_VALUE_TYPE::ULONG_TYPE
@ ULONG_TYPE
A node holding an unsigned long (8 bytes).
nkExport::Node::getValueAsFloat
float getValueAsFloat() const
nkExport::NODE_NATURE::OBJECT_NATURE
@ OBJECT_NATURE
Represents a node holding references to other nodes, via the named member accessors.
nkExport::Node::setAsUint
void setAsUint(unsigned int value)
nkExport
Encompasses all API of component NilkinsExport.
Definition: Base64Encoder.h:7
nkExport::Node::addElement
Node * addElement()
nkExport::NODE_NATURE::EMPTY_NATURE
@ EMPTY_NATURE
Represents an empty node.
nkExport::Node::isValueTypeNumber
bool isValueTypeNumber() const
nkExport::Node::getMemberCount
unsigned int getMemberCount() const
nkExport::Node::getValueAsBool
bool getValueAsBool() const
nkExport::Node::getValueAsDouble
double getValueAsDouble() const
nkExport::Node::getUserData
void * getUserData() const
nkExport::NODE_VALUE_TYPE::UINT_TYPE
@ UINT_TYPE
A node holding an unsigned integer.
nkExport::Node::setAsLong
void setAsLong(long long value)
nkExport::Node::setAsString
void setAsString(nkMemory::StringView value)
nkExport::Node::getMemberKey
nkMemory::StringView getMemberKey(unsigned int index) const
nkExport::NODE_VALUE_TYPE
NODE_VALUE_TYPE
Describes the kind of value a node holds.
Definition: Node.h:12
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkExport::Node::getValueAsLong
long long getValueAsLong() const
nkExport::Node::getNodeNature
NODE_NATURE getNodeNature() const
nkExport::NODE_NATURE::ARRAY_NATURE
@ ARRAY_NATURE
Represents a node holding references to other nodes, via the indexed array accessors.
nkExport::Node::hasChild
bool hasChild(nkMemory::StringView key, NODE_VALUE_TYPE valueType)
nkExport::Node::getValueAsString
nkMemory::StringView getValueAsString() const
nkExport::Node::Node
Node() noexcept
nkExport::Node::getValueAsUlong
unsigned long long getValueAsUlong() const
nkExport::Node::setAsDouble
void setAsDouble(double value)
nkExport::NODE_VALUE_TYPE::INT_TYPE
@ INT_TYPE
A node holding an integer.
nkExport::NODE_NATURE
NODE_NATURE
Describes the nature of a node.
Definition: Node.h:28
nkExport::Node::setAsInt
void setAsInt(int value)
nkExport::Node::getNodeValueType
NODE_VALUE_TYPE getNodeValueType() const
nkExport::Node::addMember
Node * addMember(nkMemory::StringView key)
nkExport::NODE_VALUE_TYPE::LONG_TYPE
@ LONG_TYPE
A node holding a long (8 bytes).
nkExport::Node::deleteMember
void deleteMember(nkMemory::StringView key)
nkExport::NODE_NATURE::VALUE_NATURE
@ VALUE_NATURE
Represents a leaf node, holding a final value being either a bool, string, int, uint,...
nkExport::Node::getValueAsInt
int getValueAsInt() const
nkExport::NODE_VALUE_TYPE::STRING_TYPE
@ STRING_TYPE
A node holding a string.
nkExport::Node::setAsUlong
void setAsUlong(unsigned long long value)
nkExport::Node::setUserData
void setUserData(void *value)
nkExport::Node::getArraySize
unsigned int getArraySize() const
nkExport::NODE_VALUE_TYPE::BOOL_TYPE
@ BOOL_TYPE
A node holding a boolean.
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7