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


C++ VariableDeclaration::setName方法代码示例

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


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

示例1: addDivBySix

Method* addDivBySix(Model::Model* model, Class* parent)
{
	Method* divbysix = nullptr;

	if (!parent) divbysix = dynamic_cast<Method*> (model->createRoot("Method"));
	model->beginModification(parent? static_cast<Model::Node*> (parent) : divbysix, "Adding a divBySix method.");
	if (!divbysix)
	{
		divbysix = new Method();
		parent->methods()->append(divbysix);
	}

	divbysix->setName("findDivBySix");
	FormalResult* divbysixResult = new FormalResult();
	divbysixResult->setType(new PrimitiveType(PrimitiveType::INT));
	divbysix->results()->append(divbysixResult);
	FormalArgument* arg = new FormalArgument();
	divbysix->arguments()->append(arg);
	arg->setName("numbers");
	ArrayType* argType = new ArrayType();
	argType->setType(new PrimitiveType(PrimitiveType::INT));
	arg->setType(argType);

	ExpressionStatement* es = new ExpressionStatement();
	es->setExpression( new EmptyExpression());
	divbysix->items()->append(es);

	VariableDeclaration* exprtest = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest));
	exprtest->setName("exprtest");
	exprtest->setType(new PrimitiveType(PrimitiveType::INT));
	exprtest->setInitialValue( OOExpressionBuilder::getOOExpression("+aa++&b,*e/d-#") );

	VariableDeclaration* exprtest2 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest2));
	exprtest2->setName("exprtest2");
	exprtest2->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest2->setInitialValue( OOExpressionBuilder::getOOExpression("a*b+c/e-d++%--e*-f==g") );

	VariableDeclaration* exprtest3 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest3));
	exprtest3->setName("exprtest3");
	exprtest3->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest3->setInitialValue( OOExpressionBuilder::getOOExpression("a<b||c>d&&e<=f|g&h^~i") );

	VariableDeclaration* exprtest4 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest4));
	exprtest4->setName("exprtest4");
	exprtest4->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest4->setInitialValue( OOExpressionBuilder::getOOExpression("new value[5]") );

	VariableDeclaration* exprtest5 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest5));
	exprtest5->setName("exprtest5");
	exprtest5->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest5->setInitialValue( OOExpressionBuilder::getOOExpression("(castto)object") );

	VariableDeclaration* exprtest6 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest6));
	exprtest6->setName("exprtest6");
	exprtest6->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest6->setInitialValue( OOExpressionBuilder::getOOExpression("{a,bb,ccc}") );

	VariableDeclaration* exprtest7 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest7));
	exprtest7->setName("exprtest7");
	exprtest7->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest7->setInitialValue( OOExpressionBuilder::getOOExpression("{{123,hello},{2,b}}") );

	VariableDeclaration* exprtest8 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest8));
	exprtest8->setName("exprtest8");
	exprtest8->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest8->setInitialValue( OOExpressionBuilder::getOOExpression("a.b+c.d[i].f") );

	VariableDeclaration* exprtest9 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest9));
	exprtest9->setName("exprtest9");
	exprtest9->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest9->setInitialValue( OOExpressionBuilder::getOOExpression("a()+a.b()+a.b[i].f().g()") );

	VariableDeclaration* exprtest10 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest10));
	exprtest10->setName("exprtest10");
	exprtest10->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest10->setInitialValue( OOExpressionBuilder::getOOExpression("this.b(a,b,c,123,false)") );

	VariableDeclaration* exprtest11 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest11));
	exprtest11->setName("exprtest11");
	exprtest11->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest11->setInitialValue( OOExpressionBuilder::getOOExpression("a+\"hello world\"") );

	VariableDeclaration* exprtest12 = new VariableDeclaration();
	divbysix->items()->append(new ExpressionStatement(exprtest12));
	exprtest12->setName("exprtest12");
	exprtest12->setType(new PrimitiveType(PrimitiveType::VOID));
	exprtest12->setInitialValue( OOExpressionBuilder::getOOExpression("int[]") );

	auto exprtest13 = dynamic_cast<AssignmentExpression*>( OOExpressionBuilder::getOOExpression("a=b%=c>>>=d+C"));
//.........这里部分代码省略.........
开发者ID:Andresbu,项目名称:Envision,代码行数:101,代码来源:SimpleTest.cpp


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