[SF 2520679] JSON strings enclosed in single quotes

[SF 2520849] Dynamic/Pair support
This commit is contained in:
Aleksandar Fabijanic
2009-01-19 20:08:04 +00:00
parent 363711ed39
commit c92d329399
11 changed files with 523 additions and 34 deletions

View File

@@ -52,17 +52,24 @@ VarHolder::~VarHolder()
}
bool isJSONString(const Var& any)
{
return any.type() == typeid(std::string) ||
any.type() == typeid(char) ||
any.type() == typeid(Poco::DateTime) ||
any.type() == typeid(Poco::LocalDateTime);
}
void appendJSONString(std::string& val, const Var& any)
{
bool isJsonString = (any.type() == typeid(std::string) || any.type() == typeid(char) || any.type() == typeid(Poco::DateTime) || any.type() == typeid(Poco::LocalDateTime));
if (isJsonString)
if (any.isEmpty()) val.append("null");
else
{
val.append(1, '\'');
}
val.append(any.convert<std::string>());
if (isJsonString)
{
val.append(1, '\'');
bool isStr = isJSONString(any);
if (isStr) val.append(1, '"');
val.append(any.convert<std::string>());
if (isStr) val.append(1, '"');
}
}