Ejemplo n.º 1
0
int64_t UniValue::get_int64() const
{
    if (typ != VNUM)
        throw std::runtime_error("JSON value is not an integer as expected");
    int64_t retval;
    if (!ParseInt64(getValStr(), &retval))
        throw std::runtime_error("JSON integer out of range");
    return retval;
}
Ejemplo n.º 2
0
double UniValue::get_real() const
{
    if (typ != VNUM)
        throw std::runtime_error("JSON value is not a number as expected");
    double retval;
    if (!ParseDouble(getValStr(), &retval))
        throw std::runtime_error("JSON double out of range");
    return retval;
}
Ejemplo n.º 3
0
Variant SSATmp::getValVariant() const {
  switch (m_inst->typeParam().toDataType()) {
  case KindOfUninit:
    return uninit_null();
  case KindOfNull:
    return init_null();
  case KindOfBoolean:
    return getValBool();
  case KindOfInt64:
    return getValInt();
  case KindOfDouble:
    return getValDbl();
  case KindOfString:
  case KindOfStaticString:
    return Variant(getValStr());
  case KindOfArray:
    return const_cast<ArrayData*>(getValArr());
  default:
    always_assert(false);
  }
}
Ejemplo n.º 4
0
const std::string& UniValue::get_str() const
{
    if (typ != VSTR)
        throw std::runtime_error("JSON value is not a string as expected");
    return getValStr();
}
Ejemplo n.º 5
0
const std::string DataRef::getSerStr() {
	changed = false;
	std::string retval(ser_code);
	return retval + getValStr() + '\n';
}