QJsonObject* SWGApplicant::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("id", QJsonValue(id)); toJsonValue(QString("dob"), dob, obj, QString("QDate")); toJsonValue(QString("member_id"), member_id, obj, QString("QString")); toJsonValue(QString("name"), name, obj, QString("QString")); toJsonValue(QString("relationship"), relationship, obj, QString("QString")); obj->insert("smoker", QJsonValue(smoker)); toJsonValue(QString("ssn"), ssn, obj, QString("QString")); return obj; }
QJsonObject* SWGCloudQueryCount::asJsonObject() { QJsonObject* obj = new QJsonObject(); toJsonValue(QString("key"), key, obj, QString("QString")); obj->insert("skip", QJsonValue(skip)); obj->insert("limit", QJsonValue(limit)); toJsonValue(QString("query"), query, obj, QString("SWGQuery")); toJsonValue(QString("sort"), sort, obj, QString("QString")); toJsonValue(QString("select"), select, obj, QString("QString")); return obj; }
QJsonObject HeadData::toJson() const { QJsonObject headJson; const auto& blendshapeLookupMap = getBlendshapesLookupMap(); QJsonObject blendshapesJson; for (auto name : blendshapeLookupMap.keys()) { auto index = blendshapeLookupMap[name]; if (index >= _blendshapeCoefficients.size()) { continue; } auto value = _blendshapeCoefficients[index]; if (value == 0.0f) { continue; } blendshapesJson[name] = value; } if (!blendshapesJson.isEmpty()) { headJson[JSON_AVATAR_HEAD_BLENDSHAPE_COEFFICIENTS] = blendshapesJson; } if (getRawOrientation() != quat()) { headJson[JSON_AVATAR_HEAD_ROTATION] = toJsonValue(getRawOrientation()); } if (getLeanForward() != 0.0f) { headJson[JSON_AVATAR_HEAD_LEAN_FORWARD] = getLeanForward(); } if (getLeanSideways() != 0.0f) { headJson[JSON_AVATAR_HEAD_LEAN_SIDEWAYS] = getLeanSideways(); } auto lookat = getLookAtPosition(); if (lookat != vec3()) { vec3 relativeLookAt = glm::inverse(_owningAvatar->getOrientation()) * (getLookAtPosition() - _owningAvatar->getPosition()); headJson[JSON_AVATAR_HEAD_LOOKAT] = toJsonValue(relativeLookAt); } return headJson; }
QJsonObject HeadData::toJson() const { QJsonObject headJson; const auto& blendshapeLookupMap = getBlendshapesLookupMap(); QJsonObject blendshapesJson; for (auto name : blendshapeLookupMap.keys()) { auto index = blendshapeLookupMap[name]; float value = 0.0f; if (index < _blendshapeCoefficients.size()) { value += _blendshapeCoefficients[index]; } if (index < _transientBlendshapeCoefficients.size()) { value += _transientBlendshapeCoefficients[index]; } if (value != 0.0f) { blendshapesJson[name] = value; } } if (!blendshapesJson.isEmpty()) { headJson[JSON_AVATAR_HEAD_BLENDSHAPE_COEFFICIENTS] = blendshapesJson; } if (getRawOrientation() != quat()) { headJson[JSON_AVATAR_HEAD_ROTATION] = toJsonValue(getRawOrientation()); } auto lookat = getLookAtPosition(); if (lookat != vec3()) { vec3 relativeLookAt = glm::inverse(_owningAvatar->getOrientation()) * (getLookAtPosition() - _owningAvatar->getPosition()); headJson[JSON_AVATAR_HEAD_LOOKAT] = toJsonValue(relativeLookAt); } return headJson; }
QJsonObject Transform::toJson(const Transform& transform) { if (transform.isIdentity()) { return QJsonObject(); } QJsonObject result; if (transform.getTranslation() != vec3()) { auto json = toJsonValue(transform.getTranslation()); if (!json.isNull()) { result[JSON_TRANSLATION] = json; } } if (transform.getRotation() != quat()) { auto json = toJsonValue(transform.getRotation()); if (!json.isNull()) { result[JSON_ROTATION] = json; } } if (transform.getScale() != vec3(1.0f)) { auto json = toJsonValue(transform.getScale()); if (!json.isNull()) { result[JSON_SCALE] = json; } } return result; }
QJsonObject* SWGCountyBulk::asJsonObject() { QJsonObject* obj = new QJsonObject(); toJsonValue(QString("id"), id, obj, QString("QString")); toJsonValue(QString("name"), name, obj, QString("QString")); toJsonValue(QString("state_id"), state_id, obj, QString("QString")); toJsonValue(QString("rating_area_count"), rating_area_count, obj, QString("QString")); toJsonValue(QString("service_area_count"), service_area_count, obj, QString("QString")); return obj; }
QJsonObject* SWGNetkiNameAddress::asJsonObject() { QJsonObject* obj = new QJsonObject(); toJsonValue(QString("netki_name"), netki_name, obj, QString("QString")); toJsonValue(QString("address"), address, obj, QString("QString")); return obj; }
QJsonObject* SWGSoapySDRGainSetting::asJsonObject() { QJsonObject* obj = new QJsonObject(); if(name != nullptr && *name != QString("")){ toJsonValue(QString("name"), name, obj, QString("QString")); } if((range != nullptr) && (range->isSet())){ toJsonValue(QString("range"), range, obj, QString("SWGRangeFloat")); } return obj; }
QJsonObject* ApiResponse::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("code", QJsonValue(code)); toJsonValue(QString("type"), type, obj, QString("QString")); toJsonValue(QString("message"), message, obj, QString("QString")); return obj; }
QJsonObject* SWGPresetExport::asJsonObject() { QJsonObject* obj = new QJsonObject(); if(file_path != nullptr && *file_path != QString("")){ toJsonValue(QString("filePath"), file_path, obj, QString("QString")); } if((preset != nullptr) && (preset->isSet())){ toJsonValue(QString("preset"), preset, obj, QString("SWGPresetIdentifier")); } return obj; }
void Visitor<Reader<JSONObject>>::readFrom(const ScenarioModel& scenario) { m_obj["PluginsMetadata"] = toJsonValue(*scenario.pluginModelList); m_obj["StartTimeNodeId"] = toJsonValue(scenario.m_startTimeNodeId); m_obj["EndTimeNodeId"] = toJsonValue(scenario.m_endTimeNodeId); m_obj["StartEventId"] = toJsonValue(scenario.m_startEventId); m_obj["EndEventId"] = toJsonValue(scenario.m_endEventId); m_obj["TimeNodes"] = toJsonArray(scenario.timeNodes()); m_obj["Events"] = toJsonArray(scenario.events()); m_obj["States"] = toJsonArray(scenario.states()); m_obj["Constraints"] = toJsonArray(scenario.constraints()); }
QJsonObject* SWGSuccessVerifySignupResponse::asJsonObject() { QJsonObject* obj = new QJsonObject(); toJsonValue(QString("message"), message, obj, QString("QString")); obj->insert("valid_till", QJsonValue(valid_till)); toJsonValue(QString("login_message"), login_message, obj, QString("QString")); toJsonValue(QString("login_token"), login_token, obj, QString("QString")); return obj; }
QJsonObject* SWGNewFiatBankDeposit::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("amount", QJsonValue(amount)); toJsonValue(QString("message"), message, obj, QString("QString")); toJsonValue(QString("bank"), bank, obj, QString("QString")); toJsonValue(QString("dep_type"), dep_type, obj, QString("QString")); return obj; }
QJsonObject* SWGPresetImport::asJsonObject() { QJsonObject* obj = new QJsonObject(); if(group_name != nullptr && *group_name != QString("")){ toJsonValue(QString("groupName"), group_name, obj, QString("QString")); } if(description != nullptr && *description != QString("")){ toJsonValue(QString("description"), description, obj, QString("QString")); } if(file_path != nullptr && *file_path != QString("")){ toJsonValue(QString("filePath"), file_path, obj, QString("QString")); } return obj; }
QJsonObject OAIApiResponse::asJsonObject() { QJsonObject obj; if(m_code_isSet){ obj.insert("code", QJsonValue(code)); } if(type != nullptr && *type != QString("")){ toJsonValue(QString("type"), type, obj, QString("QString")); } if(message != nullptr && *message != QString("")){ toJsonValue(QString("message"), message, obj, QString("QString")); } return obj; }
QJsonObject* SWGConfirmDataResponse::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("success", QJsonValue(success)); toJsonValue(QString("message"), message, obj, QString("SWGConfirmData")); toJsonValue(QString("method"), method, obj, QString("QString")); toJsonValue(QString("title"), title, obj, QString("QString")); toJsonValue(QString("time"), time, obj, QString("QDateTime")); return obj; }
template<> void Visitor<Reader<JSONObject>>::readFrom(const Scenario::BaseScenario& base_scenario) { readFrom(static_cast<const IdentifiedObject<Scenario::BaseScenario>&>(base_scenario)); readFrom(static_cast<const Scenario::BaseScenarioContainer&>(base_scenario)); m_obj["PluginsMetadata"] = toJsonValue(base_scenario.pluginModelList); }
QJsonArray QV8JsonWrapper::toJsonArray(v8::Handle<v8::Value> value, V8ObjectSet &visitedObjects) { QJsonArray result; if (!value->IsArray()) return result; v8::Handle<v8::Array> v8array(value.As<v8::Array>()); if (visitedObjects.contains(v8array)) { // Avoid recursion. // For compatibility with QVariant{List,Map} conversion, we return an // empty array (and no error is thrown). return result; } visitedObjects.insert(v8array); uint32_t length = v8array->Length(); for (uint32_t i = 0; i < length; ++i) { v8::Local<v8::Value> element = v8array->Get(i); if (!element->IsFunction()) result.append(toJsonValue(element, visitedObjects)); } visitedObjects.remove(v8array); return result; }
QJsonObject QV8JsonWrapper::toJsonObject(v8::Handle<v8::Value> value, V8ObjectSet &visitedObjects) { QJsonObject result; if (!value->IsObject() || value->IsArray() || value->IsFunction()) return result; v8::Handle<v8::Object> v8object(value.As<v8::Object>()); if (visitedObjects.contains(v8object)) { // Avoid recursion. // For compatibility with QVariant{List,Map} conversion, we return an // empty object (and no error is thrown). return result; } visitedObjects.insert(v8object); v8::Local<v8::Array> propertyNames = m_engine->getOwnPropertyNames(v8object); uint32_t length = propertyNames->Length(); for (uint32_t i = 0; i < length; ++i) { v8::Local<v8::Value> name = propertyNames->Get(i); v8::Local<v8::Value> propertyValue = v8object->Get(name); if (!propertyValue->IsFunction()) result.insert(QJSConverter::toString(name->ToString()), toJsonValue(propertyValue, visitedObjects)); } visitedObjects.remove(v8object); return result; }
QJsonObject* SWGStandardVerifySignupResultData::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("success", QJsonValue(success)); toJsonValue(QString("message"), message, obj, QString("SWGSuccessVerifySignupResponse")); toJsonValue(QString("method"), method, obj, QString("QString")); toJsonValue(QString("title"), title, obj, QString("QString")); toJsonValue(QString("time"), time, obj, QString("QDateTime")); return obj; }
rapidjson::Value toJsonValue(const Mat4f &value, rapidjson::Document::AllocatorType &allocator) { Vec3f rot = prettifyVector(value.extractRotationVec()); Vec3f scale = prettifyVector(value.extractScaleVec()); Vec3f pos = prettifyVector(value.extractTranslationVec()); rapidjson::Value a(rapidjson::kObjectType); if (pos != 0.0f) a.AddMember("position", toJsonValue(pos, allocator), allocator); if (scale != 1.0f) a.AddMember("scale", toJsonValue(scale, allocator), allocator); if (rot != 0.0f) a.AddMember("rotation", toJsonValue(rot, allocator), allocator); return std::move(a); }
ISCORE_PLUGIN_SCENARIO_EXPORT void Visitor<Reader<JSONObject>>::readFrom(const Scenario::StateModel& s) { readFrom(static_cast<const IdentifiedObject<Scenario::StateModel>&>(s)); // Common metadata m_obj["Metadata"] = toJsonObject(s.metadata); m_obj["Event"] = toJsonValue(s.m_eventId); m_obj["PreviousConstraint"] = toJsonValue(s.m_previousConstraint); m_obj["NextConstraint"] = toJsonValue(s.m_nextConstraint); m_obj["HeightPercentage"] = s.m_heightPercentage; // Message tree m_obj["Messages"] = toJsonObject(s.m_messageItemModel->rootNode()); // Processes plugins m_obj["StateProcesses"] = toJsonArray(s.stateProcesses); }
static void readFrom( JSONObject::Serializer& s, const T& obj) { s.m_obj["uuid"] = toJsonValue(obj.concreteFactoryKey().impl()); s.readFrom_impl(obj); obj.serialize_impl(s.toVariant()); }
QJsonObject* SWGDSDDemodReport::asJsonObject() { QJsonObject* obj = new QJsonObject(); if(m_channel_power_db_isSet){ obj->insert("channelPowerDB", QJsonValue(channel_power_db)); } if(m_audio_sample_rate_isSet){ obj->insert("audioSampleRate", QJsonValue(audio_sample_rate)); } if(m_channel_sample_rate_isSet){ obj->insert("channelSampleRate", QJsonValue(channel_sample_rate)); } if(m_squelch_isSet){ obj->insert("squelch", QJsonValue(squelch)); } if(m_pll_locked_isSet){ obj->insert("pllLocked", QJsonValue(pll_locked)); } if(m_slot1_on_isSet){ obj->insert("slot1On", QJsonValue(slot1_on)); } if(m_slot2_on_isSet){ obj->insert("slot2On", QJsonValue(slot2_on)); } if(sync_type != nullptr && *sync_type != QString("")){ toJsonValue(QString("syncType"), sync_type, obj, QString("QString")); } if(m_in_level_isSet){ obj->insert("inLevel", QJsonValue(in_level)); } if(m_carier_position_isSet){ obj->insert("carierPosition", QJsonValue(carier_position)); } if(m_zero_crossing_position_isSet){ obj->insert("zeroCrossingPosition", QJsonValue(zero_crossing_position)); } if(m_sync_rate_isSet){ obj->insert("syncRate", QJsonValue(sync_rate)); } if(status_text != nullptr && *status_text != QString("")){ toJsonValue(QString("statusText"), status_text, obj, QString("QString")); } return obj; }
QJsonObject* SWGOrder::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("id", QJsonValue(id)); obj->insert("pet_id", QJsonValue(pet_id)); obj->insert("quantity", QJsonValue(quantity)); toJsonValue(QString("ship_date"), ship_date, obj, QString("QDateTime")); toJsonValue(QString("status"), status, obj, QString("QString")); obj->insert("complete", QJsonValue(complete)); return obj; }
void Visitor<Reader<JSONObject>>::readFrom(const AutomationModel& autom) { m_obj["PluginsMetadata"] = toJsonValue(*autom.pluginModelList); m_obj["Curve"] = toJsonObject(autom.curve()); m_obj["Address"] = toJsonObject(autom.address()); m_obj["Min"] = autom.min(); m_obj["Max"] = autom.max(); }
QJsonObject* SWGModifiedQueueBody::asJsonObject() { QJsonObject* obj = new QJsonObject(); toJsonValue(QString("document"), document, obj, QString("SWGModifiedQueue")); toJsonValue(QString("key"), key, obj, QString("QString")); return obj; }
QJsonObject* SWGTag::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("id", QJsonValue(id)); toJsonValue(QString("name"), name, obj, QString("QString")); return obj; }
QJsonObject* SWGRoleBody::asJsonObject() { QJsonObject* obj = new QJsonObject(); toJsonValue(QString("key"), key, obj, QString("QString")); toJsonValue(QString("document"), document, obj, QString("SWGCloudRole")); return obj; }
QJsonObject* SWGColumn::asJsonObject() { QJsonObject* obj = new QJsonObject(); toJsonValue(QString("name"), name, obj, QString("QString")); toJsonValue(QString("dataType"), dataType, obj, QString("QString")); toJsonValue(QString("_type"), _type, obj, QString("QString")); obj->insert("required", QJsonValue(required)); obj->insert("unique", QJsonValue(unique)); toJsonValue(QString("relatedTo"), relatedTo, obj, QString("QString")); toJsonValue(QString("relationType"), relationType, obj, QString("QString")); obj->insert("isDeletable", QJsonValue(isDeletable)); obj->insert("isEditable", QJsonValue(isEditable)); obj->insert("isRenamable", QJsonValue(isRenamable)); return obj; }