当前位置: 首页>>代码示例>>C++>>正文


C++ Any::empty方法代码示例

本文整理汇总了C++中Any::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Any::empty方法的具体用法?C++ Any::empty怎么用?C++ Any::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Any的用法示例。


在下文中一共展示了Any::empty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: applyPropertiesDict

		void MenuBar::applyPropertiesDict(Color*color, const Dictionary&properties)
		{
			if(color == nullptr)
			{
				return;
			}
			Any r = properties.get("r");
			Any g = properties.get("g");
			Any b = properties.get("b");
			Any a = properties.get("a");
			if(!r.empty() && r.is<Number>())
			{
				color->r = r.as<Number>(false).asUnsignedChar();
			}
			if(!g.empty() && g.is<Number>())
			{
				color->g = g.as<Number>(false).asUnsignedChar();
			}
			if(!b.empty() && b.is<Number>())
			{
				color->b = b.as<Number>(false).asUnsignedChar();
			}
			if(!a.empty() && a.is<Number>())
			{
				color->a = a.as<Number>(false).asUnsignedChar();
			}
		}
开发者ID:naha09,项目名称:MobileBrawler,代码行数:27,代码来源:MenuBar.cpp

示例2:

bool Any::operator == ( const Any& rhs ) const
{
    if( (this == &rhs) || (empty() && rhs.empty( )))
        return true;

    if( empty() != rhs.empty() || type() != rhs.type( ))
        return false;

    return *content == *rhs.content;
}
开发者ID:VMML,项目名称:Lunchbox,代码行数:10,代码来源:any.cpp

示例3: testEmptyCopy

void AnyTest::testEmptyCopy()
{
	const Any null;
	Any copied = null, assigned;
	assigned = null;
	
	assert (null.empty());
	assert (copied.empty());
	assert (assigned.empty());
}
开发者ID:1514louluo,项目名称:poco,代码行数:10,代码来源:AnyTest.cpp

示例4: testDefaultCtor

void AnyTest::testDefaultCtor()
{
	const Any value;
	
	assert (value.empty());
	assert (0 == AnyCast<int>(&value));
	assert (value.type() == typeid(void));
}
开发者ID:1514louluo,项目名称:poco,代码行数:8,代码来源:AnyTest.cpp

示例5: testConvertingCtor

void AnyTest::testConvertingCtor()
{
	std::string text = "test message";
	Any value = text;
	
	assert (!value.empty());
	assert (value.type() == typeid(std::string));
	assert (0 == AnyCast<int>(&value));
	assert (0 != AnyCast<std::string>(&value));
	assert (AnyCast<std::string>(value) == text);
	assert (AnyCast<std::string>(&value) != &text);
}
开发者ID:1514louluo,项目名称:poco,代码行数:12,代码来源:AnyTest.cpp

示例6: testConvertingAssign

void AnyTest::testConvertingAssign()
{
	std::string text = "test message";
	Any value;
	Any* assignResult = &(value = text);
	
	assert (!value.empty());
	assert (value.type() == typeid(std::string));
	assert (0 == AnyCast<int>(&value));
	assert (0 != AnyCast<std::string>(&value));
	assert (AnyCast<std::string>(value) == text);
	assert (AnyCast<std::string>(&value) != &text);
	assert (assignResult == &value);
}
开发者ID:1514louluo,项目名称:poco,代码行数:14,代码来源:AnyTest.cpp

示例7: testSwap

void AnyTest::testSwap()
{
	std::string text = "test message";
	Any original = text, swapped;
	std::string* originalPtr = AnyCast<std::string>(&original);
	Any* swapResult = &original.swap(swapped);
	
	assert (original.empty());
	assert (!swapped.empty());
	assert (swapped.type() == typeid(std::string));
	assert (text == AnyCast<std::string>(swapped));
	assert (0 != originalPtr);
#ifdef POCO_NO_SOO // pointers only match when heap-allocated
	assert (originalPtr == AnyCast<std::string>(&swapped));
#endif
	assert (swapResult == &original);
}
开发者ID:1514louluo,项目名称:poco,代码行数:17,代码来源:AnyTest.cpp

示例8: testInt

void AnyTest::testInt()
{
	Any e;
	assert (e.empty());

	Any a = 13;
	assert (a.type() == typeid(int));
	int* i = AnyCast<int>(&a);
	assert (*i == 13);
	Any b = a;
	assert (b.type() == typeid(int));
	int *cpyI = AnyCast<int>(&b);
	assert (*cpyI == *i);
	*cpyI = 20;
	assert (*cpyI != *i);
	std::string* s = AnyCast<std::string>(&a);
	assert (s == NULL);

	int tmp = AnyCast<int>(a);
	const Any c = a;
	tmp = AnyCast<int>(a);
}
开发者ID:1514louluo,项目名称:poco,代码行数:22,代码来源:AnyTest.cpp

示例9: is_empty

bool is_empty(Any const& operand)
{
    return operand.empty();
}
开发者ID:RuiVarela,项目名称:rengine,代码行数:4,代码来源:Any.cpp


注:本文中的Any::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。