Exemplo n.º 1
0
bool JSONNumber::serialize(JSONWriter &writer){
	if (_ivalue){
		std::string v;
		string_AppendFormat(v, "%d", _ivalue);
		writer.writeValue(v);
		return true;
	}
	else if (_fvalue){
		std::string v;
		string_AppendFormat(v, "%f", _fvalue);
		writer.writeValue(v);
		return true;
	}
	return false;
}
Exemplo n.º 2
0
bool JSONBool::serialize(JSONWriter &writer){
	if (_value){
		writer.writeValue(_value ? "true" : "false");
		return true;
	}
	return false;
}
Exemplo n.º 3
0
bool JSONString::serialize(JSONWriter &writer){
	if (_value.length() > 0){
		std::string v;
		string_AppendFormat(v, "\"%s\"", Json_Escape(_value).c_str());
		writer.writeValue(v);
		return true;
	}
	return false;
}