本文整理汇总了C++中dynamic::getInt方法的典型用法代码示例。如果您正苦于以下问题:C++ dynamic::getInt方法的具体用法?C++ dynamic::getInt怎么用?C++ dynamic::getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dynamic
的用法示例。
在下文中一共展示了dynamic::getInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bserEncode
static void bserEncode(dynamic const& dyn,
QueueAppender& appender,
const serialization_opts& opts) {
switch (dyn.type()) {
case dynamic::Type::NULLT:
appender.write((int8_t)BserType::Null);
return;
case dynamic::Type::BOOL:
appender.write(
(int8_t)(dyn.getBool() ? BserType::True : BserType::False));
return;
case dynamic::Type::DOUBLE: {
double dval = dyn.getDouble();
appender.write((int8_t)BserType::Real);
appender.write(dval);
return;
}
case dynamic::Type::INT64:
bserEncodeInt(dyn.getInt(), appender);
return;
case dynamic::Type::OBJECT:
bserEncodeObject(dyn, appender, opts);
return;
case dynamic::Type::ARRAY:
bserEncodeArray(dyn, appender, opts);
return;
case dynamic::Type::STRING:
bserEncodeString(dyn.getString(), appender);
return;
}
}
示例2: cint
TEST(Dynamic, GetSmallThings) {
const dynamic cint(5);
const dynamic cdouble(5.0);
const dynamic cbool(true);
dynamic dint(5);
dynamic ddouble(5.0);
dynamic dbool(true);
dynamic mint(5);
dynamic mdouble(5.0);
dynamic mbool(true);
EXPECT_EQ(5, cint.getInt());
dint.getInt() = 6;
EXPECT_EQ(6, dint.getInt());
EXPECT_EQ(5, std::move(mint).getInt());
EXPECT_EQ(5.0, cdouble.getDouble());
ddouble.getDouble() = 6.0;
EXPECT_EQ(6.0, ddouble.getDouble());
EXPECT_EQ(5.0, std::move(mdouble).getDouble());
EXPECT_EQ(true, cbool.getBool());
dbool.getBool() = false;
EXPECT_FALSE(dbool.getBool());
EXPECT_EQ(true, std::move(mbool).getBool());
}
示例3: SizeValidator
explicit SizeValidator(const dynamic& schema, dynamic::Type type)
: length_(-1), type_(type) {
if (schema.isInt()) {
length_ = schema.getInt();
}
}