本文整理汇总了C++中OSOptionalQuantity::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ OSOptionalQuantity::empty方法的具体用法?C++ OSOptionalQuantity::empty怎么用?C++ OSOptionalQuantity::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSOptionalQuantity
的用法示例。
在下文中一共展示了OSOptionalQuantity::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: idfObject
TEST_F(UnitsFixture,IddUnits_DefaultValue) {
IdfObject idfObject(IddObjectType::OS_Building);
// IdfObject::getQuantity(unsigned index, bool returnDefault=false, bool returnIP=false) const;
// this field is empty but has a default value of 3 m
EXPECT_TRUE(idfObject.getQuantity(OS_BuildingFields::NominalFloortoFloorHeight, false).empty());
OSOptionalQuantity siQ = idfObject.getQuantity(OS_BuildingFields::NominalFloortoFloorHeight, true, false);
ASSERT_FALSE(siQ.empty());
OptionalUnit mUnit = createUnit("m");
ASSERT_TRUE(mUnit);
EXPECT_EQ(*mUnit, siQ.get().units());
EXPECT_EQ(3.0, siQ.get().value());
OSOptionalQuantity ipQ = idfObject.getQuantity(OS_BuildingFields::NominalFloortoFloorHeight, true, true);
ASSERT_FALSE(ipQ.empty());
OptionalUnit ftUnit = createUnit("ft");
ASSERT_TRUE(ftUnit);
EXPECT_EQ(*ftUnit, ipQ.get().units());
EXPECT_NE(3.0, ipQ.get().value());
OptionalQuantity q = QuantityConverter::instance().convert(ipQ.get(), *mUnit);
ASSERT_TRUE(q);
EXPECT_DOUBLE_EQ(3.0, q->value());
}