Commit fb86a496 authored by Olivier Bertrand's avatar Olivier Bertrand

Re-fix compile error (overloaded-virtual)

parent e4294729
......@@ -531,7 +531,7 @@ PJAR JDOC::ParseArray(PGLOBAL g, int& i)
sprintf(g->Message, "Unexpected value near %.*s", ARGS);
throw 1;
} else
jarp->AddValue(g, ParseValue(g, i));
jarp->AddArrayValue(g, ParseValue(g, i));
level = (b) ? 1 : 2;
break;
......@@ -886,7 +886,7 @@ bool JDOC::SerializeArray(PJAR jarp, bool b)
} // endif b
if (SerializeValue(jarp->GetValue(i)))
if (SerializeValue(jarp->GetArrayValue(i)))
return true;
} // endfor i
......@@ -1010,7 +1010,7 @@ PJAR JOBJECT::GetKeyList(PGLOBAL g)
PJAR jarp = new(g) JARRAY();
for (PJPR jpp = First; jpp; jpp = jpp->Next)
jarp->AddValue(g, new(g) JVALUE(g, jpp->Key));
jarp->AddArrayValue(g, new(g) JVALUE(g, jpp->Key));
jarp->InitArray(g);
return jarp;
......@@ -1024,7 +1024,7 @@ PJAR JOBJECT::GetValList(PGLOBAL g)
PJAR jarp = new(g) JARRAY();
for (PJPR jpp = First; jpp; jpp = jpp->Next)
jarp->AddValue(g, jpp->Val);
jarp->AddArrayValue(g, jpp->Val);
jarp->InitArray(g);
return jarp;
......@@ -1033,7 +1033,7 @@ PJAR JOBJECT::GetValList(PGLOBAL g)
/***********************************************************************/
/* Get the value corresponding to the given key. */
/***********************************************************************/
PJVAL JOBJECT::GetValue(const char* key)
PJVAL JOBJECT::GetKeyValue(const char* key)
{
for (PJPR jp = First; jp; jp = jp->Next)
if (!strcmp(jp->Key, key))
......@@ -1111,7 +1111,7 @@ bool JOBJECT::Merge(PGLOBAL g, PJSON jsp)
PJOB jobp = (PJOB)jsp;
for (PJPR jpp = jobp->First; jpp; jpp = jpp->Next)
SetValue(g, jpp->Val, jpp->Key);
SetKeyValue(g, jpp->Val, jpp->Key);
return false;
} // end of Marge;
......@@ -1119,7 +1119,7 @@ bool JOBJECT::Merge(PGLOBAL g, PJSON jsp)
/***********************************************************************/
/* Set or add a value corresponding to the given key. */
/***********************************************************************/
void JOBJECT::SetValue(PGLOBAL g, PJVAL jvp, PCSZ key)
void JOBJECT::SetKeyValue(PGLOBAL g, PJVAL jvp, PCSZ key)
{
PJPR jp;
......@@ -1166,6 +1166,18 @@ bool JOBJECT::IsNull(void)
/* -------------------------- Class JARRAY --------------------------- */
/***********************************************************************/
/* JARRAY constructor. */
/***********************************************************************/
JARRAY::JARRAY(void) : JSON()
{
Type = TYPE_JAR;
Size = 0;
Alloc = 0;
First = Last = NULL;
Mvals = NULL;
} // end of JARRAY constructor
/***********************************************************************/
/* Return the number of values in this object. */
/***********************************************************************/
......@@ -1216,7 +1228,7 @@ void JARRAY::InitArray(PGLOBAL g)
/***********************************************************************/
/* Get the Nth value of an Array. */
/***********************************************************************/
PJVAL JARRAY::GetValue(int i)
PJVAL JARRAY::GetArrayValue(int i)
{
if (Mvals && i >= 0 && i < Size)
return Mvals[i];
......@@ -1227,7 +1239,7 @@ PJVAL JARRAY::GetValue(int i)
/***********************************************************************/
/* Add a Value to the Array Value list. */
/***********************************************************************/
PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp, int *x)
PJVAL JARRAY::AddArrayValue(PGLOBAL g, PJVAL jvp, int *x)
{
if (!jvp)
jvp = new(g) JVALUE;
......@@ -1271,7 +1283,7 @@ bool JARRAY::Merge(PGLOBAL g, PJSON jsp)
PJAR arp = (PJAR)jsp;
for (int i = 0; i < arp->size(); i++)
AddValue(g, arp->GetValue(i));
AddArrayValue(g, arp->GetArrayValue(i));
InitArray(g);
return false;
......@@ -1280,7 +1292,7 @@ bool JARRAY::Merge(PGLOBAL g, PJSON jsp)
/***********************************************************************/
/* Set the nth Value of the Array Value list. */
/***********************************************************************/
bool JARRAY::SetValue(PGLOBAL g, PJVAL jvp, int n)
bool JARRAY::SetArrayValue(PGLOBAL g, PJVAL jvp, int n)
{
int i = 0;
PJVAL jp, *jpp = &First;
......@@ -1340,7 +1352,7 @@ PSZ JARRAY::GetText(PGLOBAL g, PSTRG text)
/***********************************************************************/
bool JARRAY::DeleteValue(int n)
{
PJVAL jvp = GetValue(n);
PJVAL jvp = GetArrayValue(n);
if (jvp) {
jvp->Del = true;
......@@ -1365,7 +1377,7 @@ bool JARRAY::IsNull(void)
/* -------------------------- Class JVALUE- -------------------------- */
/***********************************************************************/
/* Constructor for a JSON. */
/* Constructor for a JVALUE. */
/***********************************************************************/
JVALUE::JVALUE(PJSON jsp) : JSON()
{
......@@ -1383,7 +1395,7 @@ JVALUE::JVALUE(PJSON jsp) : JSON()
} // end of JVALUE constructor
/***********************************************************************/
/* Constructor for a Val with a given string or numeric value. */
/* Constructor for a JVALUE with a given string or numeric value. */
/***********************************************************************/
JVALUE::JVALUE(PGLOBAL g, PVL vlp) : JSON()
{
......@@ -1395,7 +1407,7 @@ JVALUE::JVALUE(PGLOBAL g, PVL vlp) : JSON()
} // end of JVALUE constructor
/***********************************************************************/
/* Constructor for a Value with a given string or numeric value. */
/* Constructor for a JVALUE with a given string or numeric value. */
/***********************************************************************/
JVALUE::JVALUE(PGLOBAL g, PVAL valp) : JSON() {
Jsp = NULL;
......
......@@ -140,36 +140,16 @@ class JSON : public BLOCK {
// Methods
virtual int size(void) { return 1; }
// virtual JTYP GetValType(void) { X return TYPE_JSON; }
// virtual void InitArray(PGLOBAL g) { X }
//virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL) {X return NULL;}
// virtual PJPR AddPair(PGLOBAL g, PCSZ key) { X return NULL; }
virtual void Clear(void) { X }
// virtual PJAR GetKeyList(PGLOBAL g) { X return NULL; }
// virtual PJAR GetValList(PGLOBAL g) { X return NULL; }
// virtual PJVAL GetValue(const char* key) { X return NULL; }
virtual PJOB GetObject(void) { return NULL; }
virtual PJAR GetArray(void) { return NULL; }
virtual PJVAL GetValue(int i) { X return NULL; }
virtual PJVAL GetArrayValue(int i) { X return NULL; }
virtual int GetSize(bool b) { X return 0; }
//virtual PVL GetVal(void) { X return NULL; }
virtual PJSON GetJsp(void) { X return NULL; }
// virtual PJSON GetJson(void) { X return NULL; }
virtual PJPR GetFirst(void) { X return NULL; }
// virtual int GetInteger(void) { X return 0; }
// virtual double GetFloat() { X return 0.0; }
// virtual PSZ GetString(PGLOBAL g, char *buff = NULL) { X return NULL; }
virtual PSZ GetText(PGLOBAL g, PSTRG text) { X return NULL; }
virtual bool Merge(PGLOBAL g, PJSON jsp) { X return true; }
// virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i) { X return true; }
// virtual void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key) { X }
// virtual void SetVal(PVL vlp) { X }
// virtual void SetValue(PGLOBAL g, PVAL valp) { X }
virtual void SetValue(PJSON jsp) { X }
// virtual void SetString(PGLOBAL g, PSZ s, short c) { X }
// virtual void SetInteger(PGLOBAL g, int n) { X }
// virtual void SetFloat(PGLOBAL g, double f) { X }
// virtual void DeleteKey(PCSZ k) { X }
virtual bool DeleteValue(int i) { X return true; }
virtual bool IsNull(void) { X return true; }
......@@ -188,9 +168,6 @@ class JOBJECT : public JSON {
JOBJECT(void) : JSON() { Type = TYPE_JOB; First = Last = NULL; }
JOBJECT(int i) : JSON(i) {}
//using JSON::GetVal;
//using JSON::SetVal;
// Methods
virtual void Clear(void) {First = Last = NULL;}
//virtual JTYP GetValType(void) {return TYPE_JOB;}
......@@ -203,10 +180,10 @@ class JOBJECT : public JSON {
// Specific
PJPR AddPair(PGLOBAL g, PCSZ key);
PJVAL GetValue(const char* key);
PJVAL GetKeyValue(const char* key);
PJAR GetKeyList(PGLOBAL g);
PJAR GetValList(PGLOBAL g);
void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key);
void SetKeyValue(PGLOBAL g, PJVAL jvp, PCSZ key);
void DeleteKey(PCSZ k);
protected:
......@@ -220,28 +197,23 @@ class JOBJECT : public JSON {
class JARRAY : public JSON {
friend class SWAP;
public:
JARRAY(void) : JSON()
{ Type = TYPE_JAR; Alloc = 0; First = Last = NULL; Mvals = NULL; }
JARRAY(void);
JARRAY(int i) : JSON(i) {}
//using JSON::GetVal;
//using JSON::SetVal;
// Methods
virtual void Clear(void) {First = Last = NULL; Size = 0;}
virtual int size(void) { return Size; }
//virtual JTYP GetType(void) {return TYPE_JAR;}
virtual PJAR GetArray(void) {return this;}
virtual int GetSize(bool b);
virtual PJVAL GetValue(int i);
virtual PJVAL GetArrayValue(int i);
virtual PSZ GetText(PGLOBAL g, PSTRG text);
virtual bool Merge(PGLOBAL g, PJSON jsp);
virtual bool DeleteValue(int n);
virtual bool IsNull(void);
// Specific
PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int* x = NULL);
bool SetValue(PGLOBAL g, PJVAL jvp, int i);
PJVAL AddArrayValue(PGLOBAL g, PJVAL jvp = NULL, int* x = NULL);
bool SetArrayValue(PGLOBAL g, PJVAL jvp, int i);
void InitArray(PGLOBAL g);
protected:
......
This diff is collapsed.
......@@ -240,7 +240,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
if (tjsp->MakeDocument(g))
return 0;
jsp = (tjsp->GetDoc()) ? tjsp->GetDoc()->GetValue(0) : NULL;
jsp = (tjsp->GetDoc()) ? tjsp->GetDoc()->GetArrayValue(0) : NULL;
} else {
if (!((tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0)))) {
if (!mgo) {
......@@ -365,7 +365,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
} // endswitch ReadDB
} else
jsp = tjsp->GetDoc()->GetValue(i);
jsp = tjsp->GetDoc()->GetArrayValue(i);
if (!(row = (jsp) ? jsp->GetObject() : NULL))
break;
......@@ -483,7 +483,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j)
strncat(fmt, (tdp->Uri ? sep : "[*]"), n);
}
if (Find(g, jar->GetValue(k), "", j))
if (Find(g, jar->GetArrayValue(k), "", j))
return true;
*p = *pc = 0;
......@@ -922,7 +922,7 @@ PJSON TDBJSN::FindRow(PGLOBAL g)
if (*objpath != '[' && !IsNum(objpath)) { // objpass is a key
val = (jsp->GetType() == TYPE_JOB) ?
jsp->GetObject()->GetValue(objpath) : NULL;
jsp->GetObject()->GetKeyValue(objpath) : NULL;
} else {
if (*objpath == '[') {
if (objpath[strlen(objpath) - 1] == ']')
......@@ -932,7 +932,7 @@ PJSON TDBJSN::FindRow(PGLOBAL g)
} // endif [
val = (jsp->GetType() == TYPE_JAR) ?
jsp->GetArray()->GetValue(atoi(objpath) - B) : NULL;
jsp->GetArray()->GetArrayValue(atoi(objpath) - B) : NULL;
} // endif objpath
jsp = (val) ? val->GetJson() : NULL;
......@@ -1128,7 +1128,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
val->SetValue(objp);
val = new(g) JVALUE;
objp->SetValue(g, val, objpath);
objp->SetKeyValue(g, val, objpath);
} else {
if (*objpath == '[') {
// Old style
......@@ -1150,7 +1150,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
val = new(g) JVALUE;
i = atoi(objpath) - B;
arp->SetValue(g, val, i);
arp->SetArrayValue(g, val, i);
arp->InitArray(g);
} // endif objpath
......@@ -1703,7 +1703,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
val = new(G) JVALUE(row);
} else
val = ((PJOB)row)->GetValue(Nodes[i].Key);
val = ((PJOB)row)->GetKeyValue(Nodes[i].Key);
break;
case TYPE_JAR:
......@@ -1711,7 +1711,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
if (!Nodes[i].Key) {
if (Nodes[i].Op == OP_EQ)
val = arp->GetValue(Nodes[i].Rank);
val = arp->GetArrayValue(Nodes[i].Rank);
else if (Nodes[i].Op == OP_EXP)
return ExpandArray(g, arp, i);
else
......@@ -1719,7 +1719,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
} else {
// Unexpected array, unwrap it as [0]
val = arp->GetValue(0);
val = arp->GetArrayValue(0);
i--;
} // endif's
......@@ -1757,7 +1757,7 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n)
return Value;
} // endif ars
if (!(jvp = arp->GetValue((Nodes[n].Rx = Nodes[n].Nx)))) {
if (!(jvp = arp->GetArrayValue((Nodes[n].Rx = Nodes[n].Nx)))) {
strcpy(g->Message, "Logical error expanding array");
throw 666;
} // endif jvp
......@@ -1801,7 +1801,7 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
ars, op, nextsame);
for (i = 0; i < ars; i++) {
jvrp = arp->GetValue(i);
jvrp = arp->GetArrayValue(i);
if (trace(1))
htrc("i=%d nv=%d\n", i, nv);
......@@ -1901,20 +1901,20 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
// Expected Array was not there, wrap the value
continue;
val = ((PJOB)row)->GetValue(Nodes[i].Key);
val = ((PJOB)row)->GetKeyValue(Nodes[i].Key);
break;
case TYPE_JAR:
arp = (PJAR)row;
if (!Nodes[i].Key) {
if (Nodes[i].Op == OP_EQ)
val = arp->GetValue(Nodes[i].Rank);
val = arp->GetArrayValue(Nodes[i].Rank);
else
val = arp->GetValue(Nodes[i].Rx);
val = arp->GetArrayValue(Nodes[i].Rx);
} else {
// Unexpected array, unwrap it as [0]
val = arp->GetValue(0);
val = arp->GetArrayValue(0);
i--;
} // endif Nodes
......@@ -1941,9 +1941,9 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
nwr = new(G) JOBJECT;
if (row->GetType() == TYPE_JOB) {
((PJOB)row)->SetValue(G, new(G) JVALUE(nwr), Nodes[i-1].Key);
((PJOB)row)->SetKeyValue(G, new(G) JVALUE(nwr), Nodes[i-1].Key);
} else if (row->GetType() == TYPE_JAR) {
((PJAR)row)->AddValue(G, new(G) JVALUE(nwr));
((PJAR)row)->AddArrayValue(G, new(G) JVALUE(nwr));
((PJAR)row)->InitArray(G);
} else {
strcpy(g->Message, "Wrong type when writing new row");
......@@ -2008,14 +2008,14 @@ void JSONCOL::WriteColumn(PGLOBAL g)
if (arp) {
if (Nod > 1 && Nodes[Nod-2].Op == OP_EQ)
arp->SetValue(G, new(G) JVALUE(jsp), Nodes[Nod-2].Rank);
arp->SetArrayValue(G, new(G) JVALUE(jsp), Nodes[Nod-2].Rank);
else
arp->AddValue(G, new(G) JVALUE(jsp));
arp->AddArrayValue(G, new(G) JVALUE(jsp));
arp->InitArray(G);
} else if (objp) {
if (Nod > 1 && Nodes[Nod-2].Key)
objp->SetValue(G, new(G) JVALUE(jsp), Nodes[Nod-2].Key);
objp->SetKeyValue(G, new(G) JVALUE(jsp), Nodes[Nod-2].Key);
} else if (jvp)
jvp->SetValue(jsp);
......@@ -2032,14 +2032,14 @@ void JSONCOL::WriteColumn(PGLOBAL g)
case TYPE_DOUBLE:
if (arp) {
if (Nodes[Nod-1].Op == OP_EQ)
arp->SetValue(G, new(G) JVALUE(G, Value), Nodes[Nod-1].Rank);
arp->SetArrayValue(G, new(G) JVALUE(G, Value), Nodes[Nod-1].Rank);
else
arp->AddValue(G, new(G) JVALUE(G, Value));
arp->AddArrayValue(G, new(G) JVALUE(G, Value));
arp->InitArray(G);
} else if (objp) {
if (Nodes[Nod-1].Key)
objp->SetValue(G, new(G) JVALUE(G, Value), Nodes[Nod-1].Key);
objp->SetKeyValue(G, new(G) JVALUE(G, Value), Nodes[Nod-1].Key);
} else if (jvp)
jvp->SetValue(g, Value);
......@@ -2189,7 +2189,7 @@ int TDBJSON::MakeDocument(PGLOBAL g)
key = p;
objp = jsp->GetObject();
arp = NULL;
val = objp->GetValue(key);
val = objp->GetKeyValue(key);
if (!val || !(jsp = val->GetJson())) {
sprintf(g->Message, "Cannot find object key %s", key);
......@@ -2215,7 +2215,7 @@ int TDBJSON::MakeDocument(PGLOBAL g)
arp = jsp->GetArray();
objp = NULL;
i = atoi(p) - B;
val = arp->GetValue(i);
val = arp->GetArrayValue(i);
if (!val) {
sprintf(g->Message, "Cannot find array value %d", i);
......@@ -2236,17 +2236,17 @@ int TDBJSON::MakeDocument(PGLOBAL g)
Doc = new(g) JARRAY;
if (val) {
Doc->AddValue(g, val);
Doc->AddArrayValue(g, val);
Doc->InitArray(g);
} else if (jsp) {
Doc->AddValue(g, new(g) JVALUE(jsp));
Doc->AddArrayValue(g, new(g) JVALUE(jsp));
Doc->InitArray(g);
} // endif val
if (objp)
objp->SetValue(g, new(g) JVALUE(Doc), key);
objp->SetKeyValue(g, new(g) JVALUE(Doc), key);
else if (arp)
arp->SetValue(g, new(g) JVALUE(Doc), i);
arp->SetArrayValue(g, new(g) JVALUE(Doc), i);
else
Top = Doc;
......@@ -2409,7 +2409,7 @@ int TDBJSON::ReadDB(PGLOBAL)
M++;
rc = RC_OK;
} else if (++Fpos < (signed)Doc->size()) {
Row = Doc->GetValue(Fpos);
Row = Doc->GetArrayValue(Fpos);
if (Row->GetType() == TYPE_JVAL)
Row = ((PJVAL)Row)->GetJson();
......@@ -2432,25 +2432,25 @@ int TDBJSON::WriteDB(PGLOBAL g)
PJVAL vp = new(g) JVALUE(Row);
if (Mode == MODE_INSERT) {
Doc->AddValue(g, vp);
Doc->AddArrayValue(g, vp);
Row = new(g) JOBJECT;
} else if (Doc->SetValue(g, vp, Fpos))
} else if (Doc->SetArrayValue(g, vp, Fpos))
return RC_FX;
} else if (Jmode == MODE_ARRAY) {
PJVAL vp = new(g) JVALUE(Row);
if (Mode == MODE_INSERT) {
Doc->AddValue(g, vp);
Doc->AddArrayValue(g, vp);
Row = new(g) JARRAY;
} else if (Doc->SetValue(g, vp, Fpos))
} else if (Doc->SetArrayValue(g, vp, Fpos))
return RC_FX;
} else { // if (Jmode == MODE_VALUE)
if (Mode == MODE_INSERT) {
Doc->AddValue(g, (PJVAL)Row);
Doc->AddArrayValue(g, (PJVAL)Row);
Row = new(g) JVALUE;
} else if (Doc->SetValue(g, (PJVAL)Row, Fpos))
} else if (Doc->SetArrayValue(g, (PJVAL)Row, Fpos))
return RC_FX;
} // endif Jmode
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment