integer CmdLineIterator::getNextNumber(natural base) { ConstStrW text = getNextText(); integer out; if (!parseSignedNumber(text.getFwIter(),out,base)) { throw InvalidNumberFormatException(THISLOCATION,text); } return out; }
void GenericTuxedoClient::populateInputFieldBuffer(void) throw(BufferNotFieldedException,BufferHandlingException,InvalidNumberFormatException) { if (! Fielded_1632(iFieldBuffer)) { throw BufferNotFieldedException("Buffer FML nao inicializado"); } clearFieldBuffer(PARM_IN); for (FieldRepMap::iterator it1 = inFieldsMap.begin(); it1 != inFieldsMap.end(); it1++) { // Popula o buffer com as ocorrências do campo atual for (FieldAttrVector::iterator it2 = it1->second.begin(); it2 != it1->second.end(); it2++) { int result; istringstream fmt; fmt.str(it2->getValue()); switch(Fldtype_1632(it1->first)) { case FLD_SHORT: { short value; try { fmt >> value; } catch(...) { throw InvalidNumberFormatException("Valor invalido para o tipo short: " + fmt.str()); } result = Fappend_1632(iFieldBuffer, it1->first, reinterpret_cast<char *>(&value), (FLDLEN_1632) 0); break; } case FLD_LONG: { long value; try { fmt >> value; } catch(...) { throw InvalidNumberFormatException("Valor invalido para o tipo long: " + fmt.str()); } result = Fappend_1632(iFieldBuffer, it1->first, reinterpret_cast<char *>(&value), (FLDLEN_1632) 0); break; } case FLD_CHAR: { char value; try { fmt >> value; } catch(...) { throw InvalidNumberFormatException("Valor invalido para o tipo char: " + fmt.str()); } result = Fappend_1632(iFieldBuffer, it1->first, reinterpret_cast<char *>(&value), (FLDLEN_1632) 0); break; } case FLD_FLOAT: { float value; try { fmt >> value; } catch(...) { throw InvalidNumberFormatException("Valor invalido para o tipo float: " + fmt.str()); } result = Fappend_1632(iFieldBuffer, it1->first, reinterpret_cast<char *>(&value), (FLDLEN_1632) 0); break; } case FLD_DOUBLE: { double value; try { fmt >> value; } catch(...) { throw InvalidNumberFormatException("Valor invalido para o tipo double: " + fmt.str()); } result = Fappend_1632(iFieldBuffer, it1->first, reinterpret_cast<char *>(&value), (FLDLEN_1632) 0); break; } case FLD_STRING: result = Fappend_1632(iFieldBuffer, it1->first, const_cast<char *>(it2->getValue().c_str()), (FLDLEN_1632) 0); break; case FLD_CARRAY: result = Fappend_1632(iFieldBuffer, it1->first, const_cast<char *>(it2->getValue().c_str()), (FLDLEN_1632) it2->getValue().size()); break; } if (result < 0) throw BufferHandlingException(tpstrerror(tperrno)); } Findex_1632(iFieldBuffer, 0); } }