inline void Squirrel::serialize(rapidjson::Writer<rapidjson::StringBuffer>& writer) const { writer.StartObject(); writer.Key("key"); writer.Uint(key); writer.Key("name"); writer.String(name_); writer.Key("age"); writer.Uint(age_); writer.Key("occupation"); writer.String(occupation_); writer.Key("created_at"); long hest = created_at_; struct tm* tt = gmtime (&hest); char datebuf[32]; strftime(datebuf, sizeof datebuf, "%FT%TZ", tt); writer.String(datebuf); writer.EndObject(); }
void Trajectory::json(rapidjson::Writer<rapidjson::StringBuffer>& w) const { EpiState x(initialState); size_t ntrans = transitionCount(); double time = 0.0; w.StartArray(); w.StartObject(); { w.String("time"); w.Double(time); w.String("state"); w.StartArray(); { for (size_t j = 0; j < x.numStates(); ++j) w.Int(x[j]); } w.EndArray(); }w.EndObject(); for (size_t i = 0; i < ntrans; ++i) { x += transitions[i].getTrans(); time += transitions[i].atTime(); w.StartObject(); { w.String("time"); w.Double(time); w.String("state"); w.StartArray(); { for (size_t j = 0; j < x.numStates(); ++j) w.Int(x[j]); } w.EndArray(); } w.EndObject(); } w.EndArray(); }
inline void marshall_json(rapidjson::Writer<rapidjson::StringBuffer>& writer, const cluster_info& info) { writer.StartObject(); writer.String("name"); marshall_json(writer, info.name); writer.String("type"); marshall_json(writer, info.type); writer.EndObject(); };
void RequestActionReturnableLongPolling_GetZoneMediaList::addMediaListToJson(const std::string &_zoneUDN, std::vector<std::shared_ptr<Raumkernel::Media::Item::MediaItem>> &_mediaList, rapidjson::Writer<rapidjson::StringBuffer> &_jsonWriter) { _jsonWriter.StartObject(); _jsonWriter.Key("udn"); _jsonWriter.String(_zoneUDN.c_str()); _jsonWriter.Key("items"); _jsonWriter.StartArray(); for (auto mediaItem : _mediaList) { _jsonWriter.StartObject(); MediaItemJsonCreator::addJson(mediaItem, _jsonWriter); _jsonWriter.EndObject(); } _jsonWriter.EndArray(); _jsonWriter.EndObject(); }
void Branch::exportToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer) const { writer.StartObject(); writer.Key("type"); writer.String("branch"); writer.Key("sub-nodes"); writer.StartArray(); for (Node* p : this->sub_nodes) { p->exportToJson(writer); } writer.EndArray(); writer.EndObject(); }
inline void marshall_json(rapidjson::Writer<rapidjson::StringBuffer>& writer, const deploy_info& info) { writer.StartObject(); writer.String("cluster"); marshall_json(writer, info.cluster); writer.String("error"); marshall_json(writer, info.error); writer.String("name"); marshall_json(writer, info.name); writer.String("package_id"); marshall_json(writer, info.package_id); writer.String("service_url"); marshall_json(writer, info.service_url); writer.String("status"); marshall_json(writer, info.status); writer.EndObject(); };
void Copy::serialize(rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer) const #else void Copy::serialize(rapidjson::Writer<rapidjson::StringBuffer>& writer) const #endif { writer.StartObject(); // Result writer.String("type"); writer.String("copy"); // Output URL writer.String("output_url"); writer.String("file://" + mOutputFile); if (mStatus == CopyStatusSuccess) { // Result writer.String("result"); writer.Bool(true); } else { // Result writer.String("result"); writer.Bool(false); // Error message if ((mStatus == CopyStatusError) && !mErrorMessage.empty()) { writer.String("error_message"); writer.String(mErrorMessage); } } writer.EndObject(); }
inline void marshall_json(rapidjson::Writer<rapidjson::StringBuffer>& writer, const std::string& str) { writer.String(str.c_str()); };
inline void marshall_json(rapidjson::Writer<rapidjson::StringBuffer>& writer, const cluster_type& type) { writer.String(rm_type_prefix(enum_to_string(type))); };