本文整理汇总了C++中Labels::exists方法的典型用法代码示例。如果您正苦于以下问题:C++ Labels::exists方法的具体用法?C++ Labels::exists怎么用?C++ Labels::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Labels
的用法示例。
在下文中一共展示了Labels::exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solveMatch
void Operands::solveMatch(struct s_match m, struct s_operand *op, Labels labels, struct s_status *status)
{
op->name = m.element;
op->operation = m.operation;
op->aritOperand = m.operand;
op->aritOperandType = TYPE_NONE;
op->type = TYPE_LABEL;
// if the operand is a label
if((m.subtype[TYPE_ADDRESS] || m.subtype[TYPE_LABEL]) && labels.exists(op->name))
op->value = Number::toBin(labels.value(op->name));
// if not, it might be a number
else if (Number::exists(op->name))
op->value == Number::toBin(op->name);
else
throw(eUndefinedLabel);
// checks if there is an operation
if(op->operation.compare("") != 0)
Operands::solveOperation(op, labels, status);
}
示例2: solveOperation
/**
* resolve a operacao aritmetica presente no operando, escrevendo o valor em o->value
*/
void Operands::solveOperation(t_operand *op,Labels labels,t_status *status)
{
if(op->operation.compare("") == 0)
return;
bool opPotentialLabel = false;
Number *operand = NULL;
if(status != NULL)
status->label = (char *)op->aritOperand.c_str();
if(labels.exists(op->aritOperand))
{
operand = new Number(Number::toBin(labels.value(op->aritOperand)));
}
else
{
try
{
operand = new Number(op->aritOperand);
}
catch(e_exception e)
{
opPotentialLabel = true;
}
}
if(!opPotentialLabel)
{
Number result(op->value);
result.operate(op->operation[0],*operand);
op->value = result.toBin();
delete operand;
}
else
{
op->aritOperandType = TYPE_LABEL;
throw(eUndefinedLabel);
}
}