本文整理汇总了C++中Var::isStruct方法的典型用法代码示例。如果您正苦于以下问题:C++ Var::isStruct方法的具体用法?C++ Var::isStruct怎么用?C++ Var::isStruct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Var
的用法示例。
在下文中一共展示了Var::isStruct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testJSONDeserializeComplex
void VarTest::testJSONDeserializeComplex()
{
Poco::Int8 i8(-12);
Poco::UInt16 u16(2345);
Poco::Int32 i32(-24343);
Poco::UInt64 u64(1234567890);
u64 *= u64;
bool b = false;
float f = 3.1415f;
double d = 3.1415;
std::string s("test string");
char c('x');
DynamicStruct aStr;
aStr["i8"] = i8;
aStr["u16"] = u16;
aStr["i32"] = i32;
aStr["u64"] = u64;
aStr["b"] = b;
aStr["f"] = f;
aStr["d"] = d;
aStr["s"] = s;
aStr["c"] = c;
std::vector<Var> aVec;
aVec.push_back(i8);
aVec.push_back(u16);
aVec.push_back(i32);
aVec.push_back(u64);
aVec.push_back(b);
aVec.push_back(f);
aVec.push_back(d);
aVec.push_back(s);
aVec.push_back(c);
aVec.push_back(aStr);
aStr["vec"] = aVec;
std::string sStr = Var::toString(aStr);
Var a = Var::parse(sStr);
assert (a.isStruct());
assert (aStr["i8"] == i8);
assert (aStr["u16"] == u16);
assert (aStr["i32"] == i32);
assert (aStr["u64"] == u64);
assert (aStr["b"] == b);
assert (aStr["f"] == f);
assert (aStr["d"] == d);
assert (aStr["s"] == s);
assert (aStr["c"] == c);
Var vecRet = a["vec"];
assert (vecRet.isArray());
assert (vecRet[0] == i8);
assert (vecRet[1] == u16);
assert (vecRet[2] == i32);
assert (vecRet[3] == u64);
assert (vecRet[4] == b);
assert (vecRet[5] == f);
assert (vecRet[6] == d);
assert (vecRet[7] == s);
assert (vecRet[8] == c);
Var strRet = vecRet[9];
assert (strRet.isStruct());
}