コード例 #1
0
ファイル: Variant.cpp プロジェクト: lailongwei/llbc
LLBC_Variant &LLBC_Variant::BecomeUInt64()
{
    if (!IsUInt64())
    {
        *this = AsUInt64();
    }

    return *this;
}
コード例 #2
0
ファイル: value.cpp プロジェクト: 400dama/USD
uint64_t
JsValue::GetUInt64() const
{
    std::string whyNot;
    if (not _CheckType(_holder->type, IntType, &whyNot)) {
        TF_CODING_ERROR(whyNot);
        return 0;
    }

    if (not IsUInt64())
        return static_cast<uint64_t>(GetInt64());

    return boost::get<uint64_t>(_holder->value);
}
コード例 #3
0
ファイル: value.cpp プロジェクト: 400dama/USD
double
JsValue::GetReal() const
{
    if (_holder->type == IntType) {
        return IsUInt64() ?
            static_cast<double>(GetUInt64()) :
            static_cast<double>(GetInt64());
    }

    std::string whyNot;
    if (not _CheckType(_holder->type, RealType, &whyNot)) {
        TF_CODING_ERROR(whyNot);
        return 0;
    }

    return boost::get<double>(_holder->value);
}