void CGovernanceObject::LoadData() { if (vchData.empty()) { return; } try { // ATTEMPT TO LOAD JSON STRING FROM VCHDATA UniValue objResult(UniValue::VOBJ); GetData(objResult); LogPrint("gobject", "CGovernanceObject::LoadData -- GetDataAsPlainString = %s\n", GetDataAsPlainString()); UniValue obj = GetJSONObject(); nObjectType = obj["type"].get_int(); } catch (std::exception& e) { fUnparsable = true; std::ostringstream ostr; ostr << "CGovernanceObject::LoadData Error parsing JSON" << ", e.what() = " << e.what(); LogPrintf("%s\n", ostr.str()); return; } catch (...) { fUnparsable = true; std::ostringstream ostr; ostr << "CGovernanceObject::LoadData Unknown Error parsing JSON"; LogPrintf("%s\n", ostr.str()); return; } }
//--------------------------------------------------------------------------- void __fastcall TNotesClientModule::AddNote(const TNote * ANote, String &AID) { TBackendEndpoint * lEndpoint = BackendEndpointAddNote; std::auto_ptr<TJSONObject> ljsonObj(TNoteJSON::NoteToJSON(ANote)); lEndpoint->ClearBody(); lEndpoint->AddBody(ljsonObj.get()); lEndpoint->Execute(); AID = GetJSONObject(lEndpoint->Response)->Get("id")->JsonValue->Value(); }
//--------------------------------------------------------------------------- bool __fastcall TNotesClientModule::GetNote(const String &AID, TNote *ANote) { bool _return = false; TBackendEndpoint *lEndpoint = BackendEndpointGetNote; lEndpoint->Params->Items[0]->Value = AID; lEndpoint->AllowHTTPErrors = TBackendEndpoint::TAllowHTTPErrors::ClientErrorNotFound_404; lEndpoint->Execute(); _return = lEndpoint->Response->Status.Success(); if(_return) { ANote = TNoteJSON::JSONToNote(GetJSONObject(lEndpoint->Response)); } return _return; }