HaikuDepot: preliminary fix for crash in JSON listener
* Fix use-after-free in the auto-generated JSON listener code (was calling method of instance after 'delete this') Will also submit a patch for the code generation script in the haikudepotserver repo so it won't get lost -- this is just a temporary fix-up until then. * Fixes some random occasional crashes
This commit is contained in:
@@ -10,11 +10,11 @@
|
||||
|
||||
// #pragma mark - private interfaces for the stacked listeners
|
||||
|
||||
|
||||
|
||||
/*! This class is the top level of the stacked listeners. The stack structure
|
||||
is maintained in a linked list and sub-classes implement specific behaviors
|
||||
depending where in the parse tree the stacked listener is working at.
|
||||
*/
|
||||
*/
|
||||
class AbstractStackedDumpExportPkgJsonListener : public BJsonEventListener {
|
||||
public:
|
||||
AbstractStackedDumpExportPkgJsonListener(
|
||||
@@ -36,7 +36,7 @@ protected:
|
||||
|
||||
void Pop();
|
||||
void Push(AbstractStackedDumpExportPkgJsonListener* stackedListener);
|
||||
|
||||
|
||||
private:
|
||||
AbstractStackedDumpExportPkgJsonListener* fParent;
|
||||
};
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
AbstractMainDumpExportPkgJsonListener* mainListener,
|
||||
AbstractStackedDumpExportPkgJsonListener* parent);
|
||||
~GeneralArrayStackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
};
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
AbstractMainDumpExportPkgJsonListener* mainListener,
|
||||
AbstractStackedDumpExportPkgJsonListener* parent);
|
||||
~GeneralObjectStackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
};
|
||||
|
||||
@@ -67,11 +67,11 @@ public:
|
||||
AbstractMainDumpExportPkgJsonListener* mainListener,
|
||||
AbstractStackedDumpExportPkgJsonListener* parent);
|
||||
~DumpExportPkg_StackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
DumpExportPkg* Target();
|
||||
|
||||
|
||||
protected:
|
||||
DumpExportPkg* fTarget;
|
||||
BString fNextItemName;
|
||||
@@ -83,11 +83,11 @@ public:
|
||||
AbstractMainDumpExportPkgJsonListener* mainListener,
|
||||
AbstractStackedDumpExportPkgJsonListener* parent);
|
||||
~DumpExportPkg_List_StackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
List<DumpExportPkg*, true>* Target(); // list of %s pointers
|
||||
|
||||
|
||||
private:
|
||||
List<DumpExportPkg*, true>* fTarget;
|
||||
};
|
||||
@@ -98,11 +98,11 @@ public:
|
||||
AbstractMainDumpExportPkgJsonListener* mainListener,
|
||||
AbstractStackedDumpExportPkgJsonListener* parent);
|
||||
~DumpExportPkgVersion_StackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
DumpExportPkgVersion* Target();
|
||||
|
||||
|
||||
protected:
|
||||
DumpExportPkgVersion* fTarget;
|
||||
BString fNextItemName;
|
||||
@@ -114,11 +114,11 @@ public:
|
||||
AbstractMainDumpExportPkgJsonListener* mainListener,
|
||||
AbstractStackedDumpExportPkgJsonListener* parent);
|
||||
~DumpExportPkgVersion_List_StackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
List<DumpExportPkgVersion*, true>* Target(); // list of %s pointers
|
||||
|
||||
|
||||
private:
|
||||
List<DumpExportPkgVersion*, true>* fTarget;
|
||||
};
|
||||
@@ -129,11 +129,11 @@ public:
|
||||
AbstractMainDumpExportPkgJsonListener* mainListener,
|
||||
AbstractStackedDumpExportPkgJsonListener* parent);
|
||||
~DumpExportPkgScreenshot_StackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
DumpExportPkgScreenshot* Target();
|
||||
|
||||
|
||||
protected:
|
||||
DumpExportPkgScreenshot* fTarget;
|
||||
BString fNextItemName;
|
||||
@@ -145,11 +145,11 @@ public:
|
||||
AbstractMainDumpExportPkgJsonListener* mainListener,
|
||||
AbstractStackedDumpExportPkgJsonListener* parent);
|
||||
~DumpExportPkgScreenshot_List_StackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
List<DumpExportPkgScreenshot*, true>* Target(); // list of %s pointers
|
||||
|
||||
|
||||
private:
|
||||
List<DumpExportPkgScreenshot*, true>* fTarget;
|
||||
};
|
||||
@@ -160,11 +160,11 @@ public:
|
||||
AbstractMainDumpExportPkgJsonListener* mainListener,
|
||||
AbstractStackedDumpExportPkgJsonListener* parent);
|
||||
~DumpExportPkgCategory_StackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
DumpExportPkgCategory* Target();
|
||||
|
||||
|
||||
protected:
|
||||
DumpExportPkgCategory* fTarget;
|
||||
BString fNextItemName;
|
||||
@@ -176,11 +176,11 @@ public:
|
||||
AbstractMainDumpExportPkgJsonListener* mainListener,
|
||||
AbstractStackedDumpExportPkgJsonListener* parent);
|
||||
~DumpExportPkgCategory_List_StackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
List<DumpExportPkgCategory*, true>* Target(); // list of %s pointers
|
||||
|
||||
|
||||
private:
|
||||
List<DumpExportPkgCategory*, true>* fTarget;
|
||||
};
|
||||
@@ -192,9 +192,9 @@ public:
|
||||
AbstractStackedDumpExportPkgJsonListener* parent,
|
||||
DumpExportPkgListener* itemListener);
|
||||
~ItemEmittingStackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
void WillPop();
|
||||
|
||||
|
||||
private:
|
||||
DumpExportPkgListener* fItemListener;
|
||||
};
|
||||
@@ -207,9 +207,9 @@ public:
|
||||
AbstractStackedDumpExportPkgJsonListener* parent,
|
||||
DumpExportPkgListener* itemListener);
|
||||
~BulkContainerStackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
private:
|
||||
BString fNextItemName;
|
||||
DumpExportPkgListener* fItemListener;
|
||||
@@ -223,10 +223,10 @@ public:
|
||||
AbstractStackedDumpExportPkgJsonListener* parent,
|
||||
DumpExportPkgListener* itemListener);
|
||||
~BulkContainerItemsStackedDumpExportPkgJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
void WillPop();
|
||||
|
||||
|
||||
private:
|
||||
DumpExportPkgListener* fItemListener;
|
||||
};
|
||||
@@ -312,26 +312,29 @@ GeneralObjectStackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
case B_JSON_NULL:
|
||||
// ignore
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
Push(new GeneralObjectStackedDumpExportPkgJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_START:
|
||||
Push(new GeneralArrayStackedDumpExportPkgJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected end of array");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -360,26 +363,29 @@ GeneralArrayStackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
case B_JSON_NULL:
|
||||
// ignore
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
Push(new GeneralObjectStackedDumpExportPkgJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_START:
|
||||
Push(new GeneralArrayStackedDumpExportPkgJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected end of object");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -409,25 +415,28 @@ bool
|
||||
DumpExportPkg_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected start of array");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_NAME:
|
||||
fNextItemName = event.Content();
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_STRING:
|
||||
|
||||
if (fNextItemName == "pkgChangelogContent")
|
||||
fTarget->SetPkgChangelogContent(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "name")
|
||||
fTarget->SetName(new BString(event.Content()));
|
||||
fNextItemName.SetTo("");
|
||||
@@ -443,16 +452,16 @@ DumpExportPkg_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
|
||||
if (fNextItemName == "pkgChangelogContent")
|
||||
fTarget->SetPkgChangelogContentNull();
|
||||
|
||||
|
||||
if (fNextItemName == "name")
|
||||
fTarget->SetNameNull();
|
||||
|
||||
|
||||
if (fNextItemName == "derivedRating")
|
||||
fTarget->SetDerivedRatingNull();
|
||||
|
||||
|
||||
if (fNextItemName == "prominenceOrdering")
|
||||
fTarget->SetProminenceOrderingNull();
|
||||
|
||||
|
||||
if (fNextItemName == "modifyTimestamp")
|
||||
fTarget->SetModifyTimestampNull();
|
||||
fNextItemName.SetTo("");
|
||||
@@ -463,10 +472,10 @@ DumpExportPkg_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
|
||||
if (fNextItemName == "derivedRating")
|
||||
fTarget->SetDerivedRating(event.ContentDouble());
|
||||
|
||||
|
||||
if (fNextItemName == "prominenceOrdering")
|
||||
fTarget->SetProminenceOrdering(event.ContentInteger());
|
||||
|
||||
|
||||
if (fNextItemName == "modifyTimestamp")
|
||||
fTarget->SetModifyTimestamp(event.ContentInteger());
|
||||
fNextItemName.SetTo("");
|
||||
@@ -507,7 +516,7 @@ DumpExportPkg_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -537,12 +546,15 @@ bool
|
||||
DumpExportPkg_List_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
{
|
||||
DumpExportPkg_StackedDumpExportPkgJsonListener* nextListener =
|
||||
@@ -551,13 +563,13 @@ DumpExportPkg_List_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& ev
|
||||
Push(nextListener);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE,
|
||||
"illegal state - unexpected json event parsing an array of DumpExportPkg");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -587,43 +599,46 @@ bool
|
||||
DumpExportPkgVersion_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected start of array");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_NAME:
|
||||
fNextItemName = event.Content();
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_STRING:
|
||||
|
||||
if (fNextItemName == "major")
|
||||
fTarget->SetMajor(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "description")
|
||||
fTarget->SetDescription(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "title")
|
||||
fTarget->SetTitle(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "summary")
|
||||
fTarget->SetSummary(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "micro")
|
||||
fTarget->SetMicro(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "preRelease")
|
||||
fTarget->SetPreRelease(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "architectureCode")
|
||||
fTarget->SetArchitectureCode(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "minor")
|
||||
fTarget->SetMinor(new BString(event.Content()));
|
||||
fNextItemName.SetTo("");
|
||||
@@ -639,31 +654,31 @@ DumpExportPkgVersion_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent&
|
||||
|
||||
if (fNextItemName == "major")
|
||||
fTarget->SetMajorNull();
|
||||
|
||||
|
||||
if (fNextItemName == "payloadLength")
|
||||
fTarget->SetPayloadLengthNull();
|
||||
|
||||
|
||||
if (fNextItemName == "description")
|
||||
fTarget->SetDescriptionNull();
|
||||
|
||||
|
||||
if (fNextItemName == "title")
|
||||
fTarget->SetTitleNull();
|
||||
|
||||
|
||||
if (fNextItemName == "summary")
|
||||
fTarget->SetSummaryNull();
|
||||
|
||||
|
||||
if (fNextItemName == "micro")
|
||||
fTarget->SetMicroNull();
|
||||
|
||||
|
||||
if (fNextItemName == "preRelease")
|
||||
fTarget->SetPreReleaseNull();
|
||||
|
||||
|
||||
if (fNextItemName == "architectureCode")
|
||||
fTarget->SetArchitectureCodeNull();
|
||||
|
||||
|
||||
if (fNextItemName == "minor")
|
||||
fTarget->SetMinorNull();
|
||||
|
||||
|
||||
if (fNextItemName == "revision")
|
||||
fTarget->SetRevisionNull();
|
||||
fNextItemName.SetTo("");
|
||||
@@ -674,7 +689,7 @@ DumpExportPkgVersion_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent&
|
||||
|
||||
if (fNextItemName == "payloadLength")
|
||||
fTarget->SetPayloadLength(event.ContentInteger());
|
||||
|
||||
|
||||
if (fNextItemName == "revision")
|
||||
fTarget->SetRevision(event.ContentInteger());
|
||||
fNextItemName.SetTo("");
|
||||
@@ -700,7 +715,7 @@ DumpExportPkgVersion_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent&
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -730,12 +745,15 @@ bool
|
||||
DumpExportPkgVersion_List_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
{
|
||||
DumpExportPkgVersion_StackedDumpExportPkgJsonListener* nextListener =
|
||||
@@ -744,13 +762,13 @@ DumpExportPkgVersion_List_StackedDumpExportPkgJsonListener::Handle(const BJsonEv
|
||||
Push(nextListener);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE,
|
||||
"illegal state - unexpected json event parsing an array of DumpExportPkgVersion");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -780,19 +798,22 @@ bool
|
||||
DumpExportPkgScreenshot_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected start of array");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_NAME:
|
||||
fNextItemName = event.Content();
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_STRING:
|
||||
|
||||
@@ -811,16 +832,16 @@ DumpExportPkgScreenshot_StackedDumpExportPkgJsonListener::Handle(const BJsonEven
|
||||
|
||||
if (fNextItemName == "ordering")
|
||||
fTarget->SetOrderingNull();
|
||||
|
||||
|
||||
if (fNextItemName == "width")
|
||||
fTarget->SetWidthNull();
|
||||
|
||||
|
||||
if (fNextItemName == "length")
|
||||
fTarget->SetLengthNull();
|
||||
|
||||
|
||||
if (fNextItemName == "code")
|
||||
fTarget->SetCodeNull();
|
||||
|
||||
|
||||
if (fNextItemName == "height")
|
||||
fTarget->SetHeightNull();
|
||||
fNextItemName.SetTo("");
|
||||
@@ -831,13 +852,13 @@ DumpExportPkgScreenshot_StackedDumpExportPkgJsonListener::Handle(const BJsonEven
|
||||
|
||||
if (fNextItemName == "ordering")
|
||||
fTarget->SetOrdering(event.ContentInteger());
|
||||
|
||||
|
||||
if (fNextItemName == "width")
|
||||
fTarget->SetWidth(event.ContentInteger());
|
||||
|
||||
|
||||
if (fNextItemName == "length")
|
||||
fTarget->SetLength(event.ContentInteger());
|
||||
|
||||
|
||||
if (fNextItemName == "height")
|
||||
fTarget->SetHeight(event.ContentInteger());
|
||||
fNextItemName.SetTo("");
|
||||
@@ -863,7 +884,7 @@ DumpExportPkgScreenshot_StackedDumpExportPkgJsonListener::Handle(const BJsonEven
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -893,12 +914,15 @@ bool
|
||||
DumpExportPkgScreenshot_List_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
{
|
||||
DumpExportPkgScreenshot_StackedDumpExportPkgJsonListener* nextListener =
|
||||
@@ -907,13 +931,13 @@ DumpExportPkgScreenshot_List_StackedDumpExportPkgJsonListener::Handle(const BJso
|
||||
Push(nextListener);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE,
|
||||
"illegal state - unexpected json event parsing an array of DumpExportPkgScreenshot");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -943,19 +967,22 @@ bool
|
||||
DumpExportPkgCategory_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected start of array");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_NAME:
|
||||
fNextItemName = event.Content();
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_STRING:
|
||||
|
||||
@@ -1002,7 +1029,7 @@ DumpExportPkgCategory_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent&
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -1032,12 +1059,15 @@ bool
|
||||
DumpExportPkgCategory_List_StackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
{
|
||||
DumpExportPkgCategory_StackedDumpExportPkgJsonListener* nextListener =
|
||||
@@ -1046,13 +1076,13 @@ DumpExportPkgCategory_List_StackedDumpExportPkgJsonListener::Handle(const BJsonE
|
||||
Push(nextListener);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE,
|
||||
"illegal state - unexpected json event parsing an array of DumpExportPkgCategory");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -1098,36 +1128,39 @@ bool
|
||||
BulkContainerStackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected start of array");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_NAME:
|
||||
fNextItemName = event.Content();
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
Push(new GeneralObjectStackedDumpExportPkgJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_START:
|
||||
if (fNextItemName == "items")
|
||||
Push(new BulkContainerItemsStackedDumpExportPkgJsonListener(fMainListener, this, fItemListener));
|
||||
else
|
||||
Push(new GeneralArrayStackedDumpExportPkgJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
default:
|
||||
// ignore
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -1151,21 +1184,24 @@ bool
|
||||
BulkContainerItemsStackedDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
Push(new ItemEmittingStackedDumpExportPkgJsonListener(fMainListener, this, fItemListener));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected json event");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -1242,12 +1278,12 @@ SingleDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
if (fErrorStatus != B_OK)
|
||||
return false;
|
||||
|
||||
|
||||
if (fStackedListener != NULL)
|
||||
return fStackedListener->Handle(event);
|
||||
|
||||
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
{
|
||||
DumpExportPkg_StackedDumpExportPkgJsonListener* nextListener = new DumpExportPkg_StackedDumpExportPkgJsonListener(
|
||||
@@ -1256,13 +1292,13 @@ SingleDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
SetStackedListener(nextListener);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE,
|
||||
"illegal state - unexpected json event parsing top level for DumpExportPkg");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -1291,12 +1327,12 @@ BulkContainerDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
if (fErrorStatus != B_OK)
|
||||
return false;
|
||||
|
||||
|
||||
if (fStackedListener != NULL)
|
||||
return fStackedListener->Handle(event);
|
||||
|
||||
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
{
|
||||
BulkContainerStackedDumpExportPkgJsonListener* nextListener =
|
||||
@@ -1306,13 +1342,13 @@ BulkContainerDumpExportPkgJsonListener::Handle(const BJsonEvent& event)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE,
|
||||
"illegal state - unexpected json event parsing top level for BulkContainerDumpExportPkgJsonListener");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
|
||||
+111
-89
@@ -5,16 +5,15 @@
|
||||
*/
|
||||
#include "DumpExportRepositoryJsonListener.h"
|
||||
#include "List.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// #pragma mark - private interfaces for the stacked listeners
|
||||
|
||||
|
||||
|
||||
/*! This class is the top level of the stacked listeners. The stack structure
|
||||
is maintained in a linked list and sub-classes implement specific behaviors
|
||||
depending where in the parse tree the stacked listener is working at.
|
||||
*/
|
||||
*/
|
||||
class AbstractStackedDumpExportRepositoryJsonListener : public BJsonEventListener {
|
||||
public:
|
||||
AbstractStackedDumpExportRepositoryJsonListener(
|
||||
@@ -36,7 +35,7 @@ protected:
|
||||
|
||||
void Pop();
|
||||
void Push(AbstractStackedDumpExportRepositoryJsonListener* stackedListener);
|
||||
|
||||
|
||||
private:
|
||||
AbstractStackedDumpExportRepositoryJsonListener* fParent;
|
||||
};
|
||||
@@ -47,7 +46,7 @@ public:
|
||||
AbstractMainDumpExportRepositoryJsonListener* mainListener,
|
||||
AbstractStackedDumpExportRepositoryJsonListener* parent);
|
||||
~GeneralArrayStackedDumpExportRepositoryJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
};
|
||||
|
||||
@@ -57,7 +56,7 @@ public:
|
||||
AbstractMainDumpExportRepositoryJsonListener* mainListener,
|
||||
AbstractStackedDumpExportRepositoryJsonListener* parent);
|
||||
~GeneralObjectStackedDumpExportRepositoryJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
};
|
||||
|
||||
@@ -67,11 +66,11 @@ public:
|
||||
AbstractMainDumpExportRepositoryJsonListener* mainListener,
|
||||
AbstractStackedDumpExportRepositoryJsonListener* parent);
|
||||
~DumpExportRepository_StackedDumpExportRepositoryJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
DumpExportRepository* Target();
|
||||
|
||||
|
||||
protected:
|
||||
DumpExportRepository* fTarget;
|
||||
BString fNextItemName;
|
||||
@@ -83,11 +82,11 @@ public:
|
||||
AbstractMainDumpExportRepositoryJsonListener* mainListener,
|
||||
AbstractStackedDumpExportRepositoryJsonListener* parent);
|
||||
~DumpExportRepository_List_StackedDumpExportRepositoryJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
List<DumpExportRepository*, true>* Target(); // list of %s pointers
|
||||
|
||||
|
||||
private:
|
||||
List<DumpExportRepository*, true>* fTarget;
|
||||
};
|
||||
@@ -98,11 +97,11 @@ public:
|
||||
AbstractMainDumpExportRepositoryJsonListener* mainListener,
|
||||
AbstractStackedDumpExportRepositoryJsonListener* parent);
|
||||
~DumpExportRepositorySource_StackedDumpExportRepositoryJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
DumpExportRepositorySource* Target();
|
||||
|
||||
|
||||
protected:
|
||||
DumpExportRepositorySource* fTarget;
|
||||
BString fNextItemName;
|
||||
@@ -114,11 +113,11 @@ public:
|
||||
AbstractMainDumpExportRepositoryJsonListener* mainListener,
|
||||
AbstractStackedDumpExportRepositoryJsonListener* parent);
|
||||
~DumpExportRepositorySource_List_StackedDumpExportRepositoryJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
List<DumpExportRepositorySource*, true>* Target(); // list of %s pointers
|
||||
|
||||
|
||||
private:
|
||||
List<DumpExportRepositorySource*, true>* fTarget;
|
||||
};
|
||||
@@ -130,9 +129,9 @@ public:
|
||||
AbstractStackedDumpExportRepositoryJsonListener* parent,
|
||||
DumpExportRepositoryListener* itemListener);
|
||||
~ItemEmittingStackedDumpExportRepositoryJsonListener();
|
||||
|
||||
|
||||
void WillPop();
|
||||
|
||||
|
||||
private:
|
||||
DumpExportRepositoryListener* fItemListener;
|
||||
};
|
||||
@@ -145,9 +144,9 @@ public:
|
||||
AbstractStackedDumpExportRepositoryJsonListener* parent,
|
||||
DumpExportRepositoryListener* itemListener);
|
||||
~BulkContainerStackedDumpExportRepositoryJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
|
||||
|
||||
private:
|
||||
BString fNextItemName;
|
||||
DumpExportRepositoryListener* fItemListener;
|
||||
@@ -161,10 +160,10 @@ public:
|
||||
AbstractStackedDumpExportRepositoryJsonListener* parent,
|
||||
DumpExportRepositoryListener* itemListener);
|
||||
~BulkContainerItemsStackedDumpExportRepositoryJsonListener();
|
||||
|
||||
|
||||
bool Handle(const BJsonEvent& event);
|
||||
void WillPop();
|
||||
|
||||
|
||||
private:
|
||||
DumpExportRepositoryListener* fItemListener;
|
||||
};
|
||||
@@ -250,26 +249,28 @@ GeneralObjectStackedDumpExportRepositoryJsonListener::Handle(const BJsonEvent& e
|
||||
case B_JSON_NULL:
|
||||
// ignore
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
Push(new GeneralObjectStackedDumpExportRepositoryJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_START:
|
||||
Push(new GeneralArrayStackedDumpExportRepositoryJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected end of array");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -298,26 +299,28 @@ GeneralArrayStackedDumpExportRepositoryJsonListener::Handle(const BJsonEvent& ev
|
||||
case B_JSON_NULL:
|
||||
// ignore
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
Push(new GeneralObjectStackedDumpExportRepositoryJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_START:
|
||||
Push(new GeneralArrayStackedDumpExportRepositoryJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected end of object");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -347,31 +350,34 @@ bool
|
||||
DumpExportRepository_StackedDumpExportRepositoryJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected start of array");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_NAME:
|
||||
fNextItemName = event.Content();
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_STRING:
|
||||
|
||||
if (fNextItemName == "informationUrl")
|
||||
fTarget->SetInformationUrl(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "code")
|
||||
fTarget->SetCode(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "name")
|
||||
fTarget->SetName(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "description")
|
||||
fTarget->SetDescription(new BString(event.Content()));
|
||||
fNextItemName.SetTo("");
|
||||
@@ -387,13 +393,13 @@ DumpExportRepository_StackedDumpExportRepositoryJsonListener::Handle(const BJson
|
||||
|
||||
if (fNextItemName == "informationUrl")
|
||||
fTarget->SetInformationUrlNull();
|
||||
|
||||
|
||||
if (fNextItemName == "code")
|
||||
fTarget->SetCodeNull();
|
||||
|
||||
|
||||
if (fNextItemName == "name")
|
||||
fTarget->SetNameNull();
|
||||
|
||||
|
||||
if (fNextItemName == "description")
|
||||
fTarget->SetDescriptionNull();
|
||||
fNextItemName.SetTo("");
|
||||
@@ -429,7 +435,7 @@ DumpExportRepository_StackedDumpExportRepositoryJsonListener::Handle(const BJson
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -459,12 +465,15 @@ bool
|
||||
DumpExportRepository_List_StackedDumpExportRepositoryJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
{
|
||||
DumpExportRepository_StackedDumpExportRepositoryJsonListener* nextListener =
|
||||
@@ -473,13 +482,13 @@ DumpExportRepository_List_StackedDumpExportRepositoryJsonListener::Handle(const
|
||||
Push(nextListener);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE,
|
||||
"illegal state - unexpected json event parsing an array of DumpExportRepository");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -509,25 +518,28 @@ bool
|
||||
DumpExportRepositorySource_StackedDumpExportRepositoryJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected start of array");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_NAME:
|
||||
fNextItemName = event.Content();
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_STRING:
|
||||
|
||||
if (fNextItemName == "url")
|
||||
fTarget->SetUrl(new BString(event.Content()));
|
||||
|
||||
|
||||
if (fNextItemName == "code")
|
||||
fTarget->SetCode(new BString(event.Content()));
|
||||
fNextItemName.SetTo("");
|
||||
@@ -543,7 +555,7 @@ DumpExportRepositorySource_StackedDumpExportRepositoryJsonListener::Handle(const
|
||||
|
||||
if (fNextItemName == "url")
|
||||
fTarget->SetUrlNull();
|
||||
|
||||
|
||||
if (fNextItemName == "code")
|
||||
fTarget->SetCodeNull();
|
||||
fNextItemName.SetTo("");
|
||||
@@ -574,7 +586,7 @@ DumpExportRepositorySource_StackedDumpExportRepositoryJsonListener::Handle(const
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -604,12 +616,15 @@ bool
|
||||
DumpExportRepositorySource_List_StackedDumpExportRepositoryJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
{
|
||||
DumpExportRepositorySource_StackedDumpExportRepositoryJsonListener* nextListener =
|
||||
@@ -618,13 +633,13 @@ DumpExportRepositorySource_List_StackedDumpExportRepositoryJsonListener::Handle(
|
||||
Push(nextListener);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE,
|
||||
"illegal state - unexpected json event parsing an array of DumpExportRepositorySource");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -670,36 +685,39 @@ bool
|
||||
BulkContainerStackedDumpExportRepositoryJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected start of array");
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_NAME:
|
||||
fNextItemName = event.Content();
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
Push(new GeneralObjectStackedDumpExportRepositoryJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_START:
|
||||
if (fNextItemName == "items")
|
||||
Push(new BulkContainerItemsStackedDumpExportRepositoryJsonListener(fMainListener, this, fItemListener));
|
||||
else
|
||||
Push(new GeneralArrayStackedDumpExportRepositoryJsonListener(fMainListener, this));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_OBJECT_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
default:
|
||||
// ignore
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -723,21 +741,24 @@ bool
|
||||
BulkContainerItemsStackedDumpExportRepositoryJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
Push(new ItemEmittingStackedDumpExportRepositoryJsonListener(fMainListener, this, fItemListener));
|
||||
break;
|
||||
|
||||
|
||||
case B_JSON_ARRAY_END:
|
||||
{
|
||||
Pop();
|
||||
bool status = (ErrorStatus() == B_OK);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE, "illegal state - unexpected json event");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -814,12 +835,12 @@ SingleDumpExportRepositoryJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
if (fErrorStatus != B_OK)
|
||||
return false;
|
||||
|
||||
|
||||
if (fStackedListener != NULL)
|
||||
return fStackedListener->Handle(event);
|
||||
|
||||
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
{
|
||||
DumpExportRepository_StackedDumpExportRepositoryJsonListener* nextListener = new DumpExportRepository_StackedDumpExportRepositoryJsonListener(
|
||||
@@ -828,13 +849,13 @@ SingleDumpExportRepositoryJsonListener::Handle(const BJsonEvent& event)
|
||||
SetStackedListener(nextListener);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE,
|
||||
"illegal state - unexpected json event parsing top level for DumpExportRepository");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
@@ -863,28 +884,29 @@ BulkContainerDumpExportRepositoryJsonListener::Handle(const BJsonEvent& event)
|
||||
{
|
||||
if (fErrorStatus != B_OK)
|
||||
return false;
|
||||
|
||||
|
||||
if (fStackedListener != NULL)
|
||||
return fStackedListener->Handle(event);
|
||||
|
||||
|
||||
switch (event.EventType()) {
|
||||
|
||||
|
||||
case B_JSON_OBJECT_START:
|
||||
{
|
||||
BulkContainerStackedDumpExportRepositoryJsonListener* nextListener =
|
||||
new BulkContainerStackedDumpExportRepositoryJsonListener(
|
||||
this, NULL, fItemListener);
|
||||
|
||||
SetStackedListener(nextListener);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
HandleError(B_NOT_ALLOWED, JSON_EVENT_LISTENER_ANY_LINE,
|
||||
"illegal state - unexpected json event parsing top level for BulkContainerDumpExportRepositoryJsonListener");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return ErrorStatus() == B_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user