Пример #1
0
void DirectHandler::handleData(const JSONEntity& val)
{
	if (isArray())
	{
		switch(val.type())
		{
		case JSONEntity::JSON_T_STRING:
			_data.push_back(val.toString());
			break;
		case JSONEntity::JSON_T_INTEGER:
			_data.push_back(val.toInteger());
			break;
		case JSONEntity::JSON_T_FLOAT:
			_data.push_back(val.toFloat());
			break;
		case JSONEntity::JSON_T_TRUE:
			_data.push_back(true);
			break;
		case JSONEntity::JSON_T_FALSE:
			_data.push_back(false);
			break;
		case JSONEntity::JSON_T_NULL:
			_data.push_back(Var());
			break;
		default:
			throw Poco::InvalidArgumentException("Unknown type.");
		}
	}
}
Пример #2
0
void DirectHandler::handleValue(const JSONEntity& val)
{
	if (0 == icompare(_key, "action"))
	{
		handleAction(val.toString());
	}
	else if (0 == icompare(_key, "method"))
	{
		handleMethod(val.toString());
	}
	else if (0 == icompare(_key, "data"))
	{
		handleData(val);
	}
	else if (0 == icompare(_key, "type"))
	{
		handleType(val.toString());
	}
	else if (0 == icompare(_key, "tid"))
	{
		handleTID(val.toInteger());
	}
}
Пример #3
0
 void handleInteger(const JSONEntity& val)
 {
     if (_key.toString() == "postalCode")
         stream() << ' '  << val.toInteger() << '.' << std::endl;
 }