コード例 #1
0
void AbstractInstructionWithParams::finalize() {
	if (params.size() == 2) {
		std::list<std::string>::iterator iter = params.begin();
		OperandFactory * factory = AbstractVM::getInstance()->getOperandFactory();
		std::string type = *iter;
		iter++;
		std::string value = *iter;
		operand = factory->createOperand(factory->retrieveFromString(type), value);
		return;
	}
	throw BadParamException();
}
コード例 #2
0
ファイル: Instruction.cpp プロジェクト: T4lus/AVM
void Instruction::AInstructionParams::end()
{
  std::list<std::string>::iterator  it;
  OperandFactory                    *factory;
  eOperandType                      type;
  std::string                       str_type;
  std::string                       str_value;

  if (this->params.size() == 2)
  {
    it = this->params.begin();
    factory = AbstractVM::getVM()->getOperandFactory();
    str_type = *it;
    it++;
    str_value = *it;
    type = factory->getTypeFromString(str_type);
    this->op = factory->createOperand(type, str_value);
    return ;
  }
  throw WrongParameterException("wrong parameters");
}