Ejemplo n.º 1
0
// convertToInteger()
/// Convert the input string to an integer.
int convertToInteger(std::string const &s) {
  std::istringstream iss(s);
  long int i;
  iss >> i;
  if (iss.fail())
    throw BadConversion("convertToInteger(\"" + s + "\")");
  return (int)i;
}
Ejemplo n.º 2
0
// convertToDouble()
/// Convert the input string to a double.
double convertToDouble(std::string const &s) {
  std::istringstream iss(s);
  double d;
  iss >> d;
  if (iss.fail())
    throw BadConversion("convertToDouble(\"" + s + "\")");
  return d;
}
/*
 * toString
 * 
 * return - std::string
 */
std::string ComparableBrick::toString(void) {
	std::ostringstream o;
	if (!(o << which << " : " << value))
		throw BadConversion("ComparableBrick::toString()");
	return o.str();
} // end toString()