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


C++ Composite::isNewPersistenceUnit方法代码示例

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


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

示例1:

TEST(FilePersistence, LoadDataMultipleUnits)
{
	QString testDir = ":/FilePersistence/test/persisted";
	FileStore store;
	store.setBaseFolder(testDir);

	typedef PersistedValue< QString >* String;
	typedef PersistedValue< QList<PersistedNode*> >* Composite;

	// Root Node
	Composite root = dynamic_cast<Composite> (store.loadCompleteNodeSubtree("units", nullptr));
	CHECK_CONDITION(root);
	CHECK_STR_EQUAL("BinaryNode", root->type() );
	CHECK_STR_EQUAL("units", root->name());
	CHECK_INT_EQUAL(0, root->id());
	CHECK_CONDITION(!root->partialHint());
	CHECK_CONDITION(!root->isNewPersistenceUnit());
	CHECK_INT_EQUAL(3, root->value().size());

	// Root Node children
	String rootName = dynamic_cast<String> (root->value().at(0));
	CHECK_CONDITION(rootName);
	CHECK_STR_EQUAL("Text", rootName->type() );
	CHECK_STR_EQUAL("name", rootName->name());
	CHECK_INT_EQUAL(1, rootName->id());
	CHECK_CONDITION(!rootName->partialHint());
	CHECK_CONDITION(!rootName->isNewPersistenceUnit());
	CHECK_STR_EQUAL("Root", rootName->value());

	Composite left = dynamic_cast<Composite> (root->value().at(1));
	CHECK_CONDITION(left);
	CHECK_STR_EQUAL("BinaryNodePersistenceUnit", left->type() );
	CHECK_STR_EQUAL("left", left->name());
	CHECK_INT_EQUAL(2, left->id());
	CHECK_CONDITION(!left->partialHint());
	CHECK_CONDITION(left->isNewPersistenceUnit());
	CHECK_INT_EQUAL(2, left->value().size());

	Composite right = dynamic_cast<Composite> (root->value().at(2));
	CHECK_CONDITION(right);
	CHECK_STR_EQUAL("BinaryNode", right->type() );
	CHECK_STR_EQUAL("right", right->name());
	CHECK_INT_EQUAL(6, right->id());
	CHECK_CONDITION(!right->partialHint());
	CHECK_CONDITION(!right->isNewPersistenceUnit());
	CHECK_INT_EQUAL(1, right->value().size());

	// Left Node children
	String leftName = dynamic_cast<String> (left->value().at(0));
	CHECK_CONDITION(leftName);
	CHECK_STR_EQUAL("Text", leftName->type() );
	CHECK_STR_EQUAL("name", leftName->name());
	CHECK_INT_EQUAL(3, leftName->id());
	CHECK_CONDITION(!leftName->partialHint());
	CHECK_CONDITION(!leftName->isNewPersistenceUnit());
	CHECK_STR_EQUAL("Left child", leftName->value());

	Composite leftleft = dynamic_cast<Composite> (left->value().at(1));
	CHECK_CONDITION(leftleft);
	CHECK_STR_EQUAL("BinaryNode", leftleft->type() );
	CHECK_STR_EQUAL("left", leftleft->name());
	CHECK_INT_EQUAL(4, leftleft->id());
	CHECK_CONDITION(!leftleft->partialHint());
	CHECK_CONDITION(!leftleft->isNewPersistenceUnit());
	CHECK_INT_EQUAL(1, leftleft->value().size());

	String leftleftName = dynamic_cast<String> (leftleft->value().at(0));
	CHECK_CONDITION(leftleftName);
	CHECK_STR_EQUAL("Text", leftleftName->type() );
	CHECK_STR_EQUAL("name", leftleftName->name());
	CHECK_INT_EQUAL(5, leftleftName->id());
	CHECK_CONDITION(!leftleftName->partialHint());
	CHECK_CONDITION(!leftleftName->isNewPersistenceUnit());
	CHECK_STR_EQUAL("in a new unit", leftleftName->value());

	// Right Node children
	String rightName = dynamic_cast<String> (right->value().at(0));
	CHECK_CONDITION(rightName);
	CHECK_STR_EQUAL("Text", rightName->type() );
	CHECK_STR_EQUAL("name", rightName->name());
	CHECK_INT_EQUAL(7, rightName->id());
	CHECK_CONDITION(!rightName->partialHint());
	CHECK_CONDITION(!rightName->isNewPersistenceUnit());
	CHECK_STR_EQUAL("Right child", rightName->value());
}
开发者ID:JurajKubelka,项目名称:Envision,代码行数:85,代码来源:LoadNodeDataTests.cpp


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