Пример #1
0
void CMetadata::toJsonstring(rapidjson::Value& json, std::string& str)
{
	rapidjson::StringBuffer buffer;
    rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
    json.Accept(writer);
	str.assign(buffer.GetString(), buffer.Size());
}
Пример #2
0
 std::shared_ptr<std::string> JIMDBClient::toString(rapidjson::Value& data)
 {
     // Convert JSON document to string
     rapidjson::StringBuffer strbuf;
     rapidjson::Writer<rapidjson::StringBuffer> writer(strbuf);
     data.Accept(writer);
     return std::make_shared<std::string>(strbuf.GetString());
 }
Пример #3
0
void PrintJsonValue(const rapidjson::Value& value,
                    JsonOption              opt,
                    std::ostream&           out)
{
  rapidjson::StringBuffer buffer;
  if( (opt & JsonOption::PrettyPrint) == JsonOption::PrettyPrint )
  {
    rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(buffer);
    value.Accept(writer);
  }
  else
  {
    rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
    value.Accept(writer);
  }

  out << buffer.GetString();
}
Пример #4
0
int Dynamo::Json2str(const rapidjson::Value &json, std::string& str) {
	StringBuffer buffer;
    Writer<StringBuffer> writer(buffer);

    if (false == json.Accept(writer)) {
    	snprintf(lastErr, sizeof(lastErr), "Value::Accept failed");
    	return -1;
    }
    str.append(buffer.GetString(), buffer.GetSize());

    return 0;
}
Пример #5
0
	void CustomGUIReader::setCustomProps(const std::string &classType, cocos2d::Ref *widget, const rapidjson::Value &customOptions)
	{
        if (_setPropsFunc != 0)
        {
            rapidjson::StringBuffer buffer;
            rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
            customOptions.Accept(writer);

            auto stack = LuaEngine::getInstance()->getLuaStack();
            stack->pushString(classType.c_str(), classType.size());
            stack->pushObject(widget, "cc.Ref");
            stack->pushString(buffer.GetString(), buffer.Size());
            stack->executeFunctionByHandler(_setPropsFunc, 3);
        }
	}
Пример #6
0
Field SchemaHelper::parseField(const rapidjson::Value &data, int index)
{
    Field field = std::make_shared<SchemaField>();
    field->index = index;
    field->name = getJSONString(data, "name");
    field->type = getJSONString(data, "type");
    field->geometry_type = getJSONString(data, "geometry_type");
    field->nullable = getJSONBool(data, "nullable");
    field->related_to = getJSONLong(data, "related_to", -1);
    field->max_length = getJSONInt(data, "max_length", -1);
    field->default_value = getJSONString(data, "default");

    StringBuffer buffer;
    PrettyWriter<StringBuffer> writer(buffer);
    data.Accept(writer);
    field->json = buffer.GetString();

    if(field->name == "amigo_id")
    {
        field->unique = true;
    }
    return field;
}
Пример #7
0
cocos2d::Value JsonUtils::json2Value(rapidjson::Value &json) {
    JsonValueConverter converter;
    json.Accept(converter);
    return converter.getValue();
}
Пример #8
0
 inline void push(lua_State* L, const rapidjson::Value& v)
 {
     ToLuaHandler handler(L);
     v.Accept(handler);
 }
Пример #9
-1
QString Util::RapidjsonSerialize(const rapidjson::Value &val) {
    rapidjson::StringBuffer buffer;
    rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
    val.Accept(writer);
    return buffer.GetString();
}