diff options
Diffstat (limited to 'storage/connect/json.h')
-rw-r--r-- | storage/connect/json.h | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/storage/connect/json.h b/storage/connect/json.h index 49675ce8559..daed055435b 100644 --- a/storage/connect/json.h +++ b/storage/connect/json.h @@ -1,7 +1,7 @@ /**************** json H Declares Source Code File (.H) ****************/ /* Name: json.h Version 1.2 */ /* */ -/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */ +/* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */ /* */ /* This file contains the JSON classes declares. */ /***********************************************************************/ @@ -13,11 +13,13 @@ #define X #endif -enum JTYP {TYPE_STRG = 1, - TYPE_DBL = 2, - TYPE_BOOL = 4, - TYPE_BINT = 5, - TYPE_INTG = 7, +enum JTYP {TYPE_NULL = TYPE_VOID, + TYPE_STRG = TYPE_STRING, + TYPE_DBL = TYPE_DOUBLE, + TYPE_BOOL = TYPE_TINY, + TYPE_BINT = TYPE_BIGINT, + TYPE_DTM = TYPE_DATE, + TYPE_INTG = TYPE_INT, TYPE_JSON = 12, TYPE_JAR, TYPE_JOB, @@ -145,6 +147,7 @@ class JSON : public BLOCK { JSON(void) {Size = 0;} int size(void) {return Size;} + virtual int GetSize(bool b) {return Size;} virtual void Clear(void) {Size = 0;} virtual JTYP GetType(void) {return TYPE_JSON;} virtual JTYP GetValType(void) {X return TYPE_JSON;} @@ -192,10 +195,11 @@ class JOBJECT : public JSON { using JSON::GetValue; using JSON::SetValue; - virtual void Clear(void) {First = Last = NULL; Size = 0;} + virtual void Clear(void) {First = Last = NULL; Size = 0;} virtual JTYP GetType(void) {return TYPE_JOB;} virtual PJPR GetFirst(void) {return First;} - virtual PJPR AddPair(PGLOBAL g, PCSZ key); + virtual int GetSize(bool b); + virtual PJPR AddPair(PGLOBAL g, PCSZ key); virtual PJOB GetObject(void) {return this;} virtual PJVAL GetValue(const char* key); virtual PJAR GetKeyList(PGLOBAL g); @@ -221,11 +225,13 @@ class JARRAY : public JSON { using JSON::GetValue; using JSON::SetValue; virtual void Clear(void) {First = Last = NULL; Size = 0;} - virtual JTYP GetType(void) {return TYPE_JAR;} + virtual JTYP GetType(void) {return TYPE_JAR;} virtual PJAR GetArray(void) {return this;} - PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL); + virtual int GetSize(bool b); + PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL); virtual void InitArray(PGLOBAL g); virtual PJVAL GetValue(int i); + virtual PSZ GetText(PGLOBAL g, PSZ text); virtual bool Merge(PGLOBAL g, PJSON jsp); virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i); virtual bool DeleteValue(int n); @@ -245,20 +251,20 @@ class JARRAY : public JSON { class JVALUE : public JSON { friend class JARRAY; friend class JSNX; + friend class JSONCOL; friend PJVAL ParseValue(PGLOBAL, int&, STRG&, bool*); friend bool SerializeValue(JOUT *, PJVAL); public: - JVALUE(void) : JSON() - {Jsp = NULL; Value = NULL; Next = NULL; Del = false;} + JVALUE(void) : JSON() {Clear();} JVALUE(PJSON jsp) : JSON() - {Jsp = jsp; Value = NULL; Next = NULL; Del = false;} - JVALUE(PGLOBAL g, PVAL valp); + {Jsp = jsp; Value = NULL; Next = NULL; Del = false; Size = 1;} + JVALUE(PGLOBAL g, PVAL valp); JVALUE(PGLOBAL g, PCSZ strp); using JSON::GetValue; using JSON::SetValue; virtual void Clear(void) - {Jsp = NULL; Value = NULL; Next = NULL; Del = false; Size = 0;} + {Jsp = NULL; Value = NULL; Next = NULL; Del = false; Size = 1;} virtual JTYP GetType(void) {return TYPE_JVAL;} virtual JTYP GetValType(void); virtual PJOB GetObject(void); |