QStringList AssignmentStringComponents::components()
{
	QStringList result;
	if (!exp_) return result;

	// First comes the prefix. Currently there is no assignment operator that has a prefix.
	result << QString() << stringForNode(exp_->left());

	switch(exp_->op())
	{
		case OOModel::AssignmentExpression::ASSIGN: result << "="; break;
		case OOModel::AssignmentExpression::PLUS_ASSIGN: result << "+="; break;
		case OOModel::AssignmentExpression::MINUS_ASSIGN: result << "-="; break;
		case OOModel::AssignmentExpression::TIMES_ASSIGN: result << "*="; break;
		case OOModel::AssignmentExpression::DIVIDE_ASSIGN: result << "/="; break;
		case OOModel::AssignmentExpression::BIT_AND_ASSIGN: result << "&="; break;
		case OOModel::AssignmentExpression::BIT_OR_ASSIGN: result << "|="; break;
		case OOModel::AssignmentExpression::BIT_XOR_ASSIGN: result << "^="; break;
		case OOModel::AssignmentExpression::REMAINDER_ASSIGN: result << "%="; break;
		case OOModel::AssignmentExpression::LEFT_SHIFT_ASSIGN: result << "<<="; break;
		case OOModel::AssignmentExpression::RIGHT_SHIFT_SIGNED_ASSIGN: result << ">>="; break;
		case OOModel::AssignmentExpression::RIGHT_SHIFT_UNSIGNED_ASSIGN: result << ">>>="; break;
		default: result.append( QString() ); break;
	}

	result << stringForNode(exp_->right()) << QString(); // Postfix

	return result;
}
QStringList CastExpressionStringComponents::components()
{
	QStringList result;
	if (!exp_) return result;

	result << "(" << stringForNode(exp_->type()) << ")" << stringForNode(exp_->expr());

	return result;
}
QStringList VariableDeclarationStringComponents::components()
{
	QStringList result;
	if (!exp_) return result;

	result << stringForNode(exp_->varType()) << " " << exp_->name();
	if (exp_->initialValue()) result << "=" << stringForNode(exp_->initialValue());

	return result;
}
QStringList UnaryOperatorStringComponents::components()
{
	QStringList result;
	if (!exp_) return result;

	QString pre;
	QString post;

	switch(exp_->op())
	{
		case OOModel::UnaryOperation::PREINCREMENT: pre = "++"; break;
		case OOModel::UnaryOperation::PREDECREMENT: pre = "--"; break;
		case OOModel::UnaryOperation::POSTINCREMENT: post = "++"; break;
		case OOModel::UnaryOperation::POSTDECREMENT: post = "--"; break;
		case OOModel::UnaryOperation::PLUS: pre = "+"; break;
		case OOModel::UnaryOperation::MINUS: pre = "-"; break;
		case OOModel::UnaryOperation::NOT: pre = "!"; break;
		case OOModel::UnaryOperation::COMPLEMENT: pre = "~"; break;
		case OOModel::UnaryOperation::PARENTHESIS: {pre = "("; post = ")";} break;
		default: break;
	}

	result << pre << stringForNode(exp_->operand()) << post;

	return result;
}
예제 #5
0
QStringList CallStringComponents::components()
{
	QStringList result;
	if (!exp_) return result;

	result << stringForNode(exp_->ref());

	QString list = "(";
	for (int i=0; i< exp_->arguments()->size(); ++i)
	{
		if (i>0) list.append(",");
		list.append( stringForNode(exp_->arguments()->at(i)) );
	}
	list.append(")");

	result << list;
	return result;
}
예제 #6
0
QStringList ListStringComponents::components()
{
	QStringList result;
	if (!list_) return result;

	for (int i=0; i< list_->size(); ++i)
		result << stringForNode(list_->at<Model::Node>(i));

	return result;
}
QStringList ErrorExpressionStringComponents::components()
{
	QStringList result;
	if (!exp_) return result;

	if (!exp_->prefix().isEmpty()) result << exp_->prefix() ;
	result << stringForNode(exp_->arg());
	if (!exp_->postfix().isEmpty())  result << exp_->postfix() ;

	return result;
}
예제 #8
0
파일: codemarker.cpp 프로젝트: Fale/qtmoko
QString CodeMarker::linkTag(const Node *node, const QString& body)
{
    return QLatin1String("<@link node=\"") + stringForNode(node)
        + QLatin1String("\">") + body + QLatin1String("</@link>");
}