本文整理汇总了C++中Var::isArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Var::isArray方法的具体用法?C++ Var::isArray怎么用?C++ Var::isArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Var
的用法示例。
在下文中一共展示了Var::isArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testEmpty
void VarTest::testEmpty()
{
Var da;
assert (da.isEmpty());
assert (da.type() == typeid(void));
assert (!da.isArray());
assert (!da.isInteger());
assert (!da.isNumeric());
assert (!da.isSigned());
assert (!da.isString());
assert (!(da == da));
assert (!(da != da));
da = "123";
int i = da.convert<int>();
assert (123 == i);
std::string s = da.extract<std::string>();
assert ("123" == s);
assert (!da.isEmpty());
da.empty();
assert (da.isEmpty());
assert (da.type() == typeid(void));
assert (!da.isArray());
assert (!da.isInteger());
assert (!da.isNumeric());
assert (!da.isSigned());
assert (!da.isString());
assert (!(da == da));
assert (!(da != da));
assert (da != "");
assert ("" != da);
assert (!(da == ""));
assert (!("" == da));
testEmptyComparisons<unsigned char>();
testEmptyComparisons<char>();
testEmptyComparisons<Poco::UInt8>();
testEmptyComparisons<Poco::Int8>();
testEmptyComparisons<Poco::UInt16>();
testEmptyComparisons<Poco::Int16>();
testEmptyComparisons<Poco::UInt32>();
testEmptyComparisons<Poco::Int32>();
testEmptyComparisons<Poco::UInt64>();
testEmptyComparisons<Poco::Int64>();
#ifdef POCO_LONG_IS_64_BIT
testEmptyComparisons<unsigned long>();
testEmptyComparisons<long>();
#endif
testEmptyComparisons<float>();
testEmptyComparisons<double>();
try
{
int i = da;
fail ("must fail");
} catch (InvalidAccessException&) { }
try
{
int i = da.extract<int>();
fail ("must fail");
} catch (InvalidAccessException&) { }
}
示例2: 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());
}