JSONNode.h | JSONNode.h | |||
---|---|---|---|---|
skipping to change at line 15 | skipping to change at line 15 | |||
#include <vector> | #include <vector> | |||
#include "JSON_Strings.h" | #include "JSON_Strings.h" | |||
#define foreach(iterator, container)\ | #define foreach(iterator, container)\ | |||
for (typeof(container.begin()) iterator = container.begin(), iterator## _end = container.end();\ | for (typeof(container.begin()) iterator = container.begin(), iterator## _end = container.end();\ | |||
iterator != iterator##_end;\ | iterator != iterator##_end;\ | |||
++iterator) | ++iterator) | |||
using namespace std; | using namespace std; | |||
union value_union_t { | ||||
bool _bool; | ||||
double _number; | ||||
}; | ||||
class JSONNode { | class JSONNode { | |||
public: | public: | |||
JSONNode(const json_string & name_t, const json_string & value_t) ; | JSONNode(const json_string & name_t, const json_string & value_t) ; | |||
JSONNode(void){}; //Used ONLY for duplicating | JSONNode(void){}; //Used ONLY for duplicating | |||
JSONNode(JSONNode * parent); | JSONNode(JSONNode * parent); | |||
~JSONNode(void); | ~JSONNode(void); | |||
void SetMyValue(const json_string & value_t); | void SetMyValue(const json_string & value_t); | |||
void PurgeChildren(void); | void PurgeChildren(void); | |||
void Fetch(void); | void Fetch(void); | |||
void CloneTo(JSONNode * node); | void CloneTo(JSONNode * node); | |||
skipping to change at line 78 | skipping to change at line 83 | |||
json_string MemDump(unsigned int indent = 0); | json_string MemDump(unsigned int indent = 0); | |||
#endif | #endif | |||
//This is the name of the node, the encoded flag tells the writer wh ether or not to re-escape it when it gets written | //This is the name of the node, the encoded flag tells the writer wh ether or not to re-escape it when it gets written | |||
json_string _name; bool name_encoded; | json_string _name; bool name_encoded; | |||
//This is the json_string that is the value of the node, this mig ht be a json_string, a number, or even a set of nodes or array that hasn't been parsed yet | //This is the json_string that is the value of the node, this mig ht be a json_string, a number, or even a set of nodes or array that hasn't been parsed yet | |||
json_string _string; bool string_encoded; | json_string _string; bool string_encoded; | |||
//boolean and floating point values of the value, only applicable if the node is of that type | //boolean and floating point values of the value, only applicable if the node is of that type | |||
bool _bool; | value_union_t _value; | |||
double _number; | ||||
vector<JSONNode *> Children; | vector<JSONNode *> Children; | |||
size_t lastreal; //This is used to determine the last real entry in the Children, because it's possible to have comments at the end, we don 't want commas before them | size_t lastreal; //This is used to determine the last real entry in the Children, because it's possible to have comments at the end, we don 't want commas before them | |||
private: | private: | |||
json_string WriteChildren(unsigned int indent); | json_string WriteChildren(unsigned int indent); | |||
json_string WriteName(bool formatted) const; | json_string WriteName(bool formatted) const; | |||
json_string WriteComment(unsigned int indent) const; | json_string WriteComment(unsigned int indent) const; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 6 lines changed or added | |||