mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Replace boost::lexical_cast with beast::lexicalCast
This commit is contained in:
@@ -43,7 +43,7 @@ SField::SField (SerializedTypeID tid, int fv) : fieldCode (FIELD_CODE (tid, fv))
|
||||
fieldMeta (sMD_Default), fieldNum (++num), signingField (true)
|
||||
{
|
||||
// call with the map mutex
|
||||
fieldName = lexical_cast_i (tid) + "/" + lexical_cast_i (fv);
|
||||
fieldName = lexicalCast <std::string> (tid) + "/" + lexicalCast <std::string> (fv);
|
||||
codeToField[fieldCode] = this;
|
||||
assert ((fv != 1) || ((tid != STI_ARRAY) && (tid != STI_OBJECT)));
|
||||
}
|
||||
@@ -108,8 +108,8 @@ std::string SField::getName () const
|
||||
if (fieldValue == 0)
|
||||
return "";
|
||||
|
||||
return boost::lexical_cast<std::string> (static_cast<int> (fieldType)) + "/" +
|
||||
boost::lexical_cast<std::string> (fieldValue);
|
||||
return lexicalCastThrow <std::string> (static_cast<int> (fieldType)) + "/" +
|
||||
lexicalCastThrow <std::string> (fieldValue);
|
||||
}
|
||||
|
||||
SField::ref SField::getField (const std::string& fieldName)
|
||||
|
||||
@@ -181,7 +181,7 @@ STAmount::STAmount (SField::ref n, const Json::Value& v)
|
||||
{
|
||||
if (mIsNative)
|
||||
{
|
||||
int64 val = lexical_cast_st<int64> (value.asString ());
|
||||
int64 val = lexicalCastThrow <int64> (value.asString ());
|
||||
|
||||
if (val >= 0)
|
||||
mValue = val;
|
||||
@@ -276,13 +276,13 @@ bool STAmount::setValue (const std::string& sAmount)
|
||||
|
||||
if (!smMatch[4].matched) // integer only
|
||||
{
|
||||
mValue = lexical_cast_s<uint64> (smMatch[2]);
|
||||
mValue = lexicalCast <uint64> (std::string (smMatch[2]));
|
||||
mOffset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// integer and fraction
|
||||
mValue = lexical_cast_s<uint64> (smMatch[2] + smMatch[4]);
|
||||
mValue = lexicalCast <uint64> (smMatch[2] + smMatch[4]);
|
||||
mOffset = - (smMatch[4].length ());
|
||||
}
|
||||
|
||||
@@ -290,9 +290,9 @@ bool STAmount::setValue (const std::string& sAmount)
|
||||
{
|
||||
// we have an exponent
|
||||
if (smMatch[6].matched && (smMatch[6] == "-"))
|
||||
mOffset -= lexical_cast_s<int> (smMatch[7]);
|
||||
mOffset -= lexicalCast <int> (std::string (smMatch[7]));
|
||||
else
|
||||
mOffset += lexical_cast_s<int> (smMatch[7]);
|
||||
mOffset += lexicalCast <int> (std::string (smMatch[7]));
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
@@ -593,15 +593,15 @@ std::string STAmount::getRaw () const
|
||||
|
||||
if (mIsNative)
|
||||
{
|
||||
if (mIsNegative) return std::string ("-") + lexical_cast_i (mValue);
|
||||
else return lexical_cast_i (mValue);
|
||||
if (mIsNegative) return std::string ("-") + lexicalCast <std::string> (mValue);
|
||||
else return lexicalCast <std::string> (mValue);
|
||||
}
|
||||
|
||||
if (mIsNegative)
|
||||
return mCurrency.GetHex () + ": -" +
|
||||
lexical_cast_i (mValue) + "e" + lexical_cast_i (mOffset);
|
||||
lexicalCast <std::string> (mValue) + "e" + lexicalCast <std::string> (mOffset);
|
||||
else return mCurrency.GetHex () + ": " +
|
||||
lexical_cast_i (mValue) + "e" + lexical_cast_i (mOffset);
|
||||
lexicalCast <std::string> (mValue) + "e" + lexicalCast <std::string> (mOffset);
|
||||
}
|
||||
|
||||
std::string STAmount::getText () const
|
||||
@@ -612,21 +612,21 @@ std::string STAmount::getText () const
|
||||
if (mIsNative)
|
||||
{
|
||||
if (mIsNegative)
|
||||
return std::string ("-") + lexical_cast_i (mValue);
|
||||
else return lexical_cast_i (mValue);
|
||||
return std::string ("-") + lexicalCast <std::string> (mValue);
|
||||
else return lexicalCast <std::string> (mValue);
|
||||
}
|
||||
|
||||
if ((mOffset != 0) && ((mOffset < -25) || (mOffset > -5)))
|
||||
{
|
||||
if (mIsNegative)
|
||||
return std::string ("-") + lexical_cast_i (mValue) +
|
||||
"e" + lexical_cast_i (mOffset);
|
||||
return std::string ("-") + lexicalCast <std::string> (mValue) +
|
||||
"e" + lexicalCast <std::string> (mOffset);
|
||||
else
|
||||
return lexical_cast_i (mValue) + "e" + lexical_cast_i (mOffset);
|
||||
return lexicalCast <std::string> (mValue) + "e" + lexicalCast <std::string> (mOffset);
|
||||
}
|
||||
|
||||
std::string val = "000000000000000000000000000";
|
||||
val += lexical_cast_i (mValue);
|
||||
val += lexicalCast <std::string> (mValue);
|
||||
val += "00000000000000000000000";
|
||||
|
||||
std::string pre = val.substr (0, mOffset + 43);
|
||||
|
||||
@@ -58,7 +58,7 @@ UPTR_T<SerializedType> STObject::makeDefaultObject (SerializedTypeID id, SField:
|
||||
return UPTR_T<SerializedType> (new STArray (name));
|
||||
|
||||
default:
|
||||
WriteLog (lsFATAL, STObject) << "Object type: " << lexical_cast_i (id);
|
||||
WriteLog (lsFATAL, STObject) << "Object type: " << lexicalCast <std::string> (id);
|
||||
assert (false);
|
||||
throw std::runtime_error ("Unknown object type");
|
||||
}
|
||||
@@ -1044,7 +1044,7 @@ Json::Value STObject::getJson (int options) const
|
||||
if (it.getSType () != STI_NOTPRESENT)
|
||||
{
|
||||
if (!it.getFName ().hasName ())
|
||||
ret[lexical_cast_i (index)] = it.getJson (options);
|
||||
ret[lexicalCast <std::string> (index)] = it.getJson (options);
|
||||
else
|
||||
ret[it.getName ()] = it.getJson (options);
|
||||
}
|
||||
@@ -1153,7 +1153,7 @@ Json::Value STArray::getJson (int p) const
|
||||
Json::Value inner = Json::objectValue;
|
||||
|
||||
if (!object.getFName ().hasName ())
|
||||
inner[lexical_cast_i (index)] = object.getJson (p);
|
||||
inner[lexicalCast <std::string> (index)] = object.getJson (p);
|
||||
else
|
||||
inner[object.getName ()] = object.getJson (p);
|
||||
|
||||
@@ -1253,10 +1253,10 @@ UPTR_T<STObject> STObject::parseJson (const Json::Value& object, SField::ref inN
|
||||
if (FUNCTION_THAT_DOESNT_EXIST (value.asString (), terCode))
|
||||
value = static_cast<int> (terCode);
|
||||
else
|
||||
data.push_back (new STUInt8 (field, lexical_cast_st<unsigned char> (value.asString ())));
|
||||
data.push_back (new STUInt8 (field, lexicalCastThrow <unsigned char> (value.asString ())));
|
||||
}
|
||||
|
||||
data.push_back (new STUInt8 (field, lexical_cast_st<unsigned char> (value.asString ())));
|
||||
data.push_back (new STUInt8 (field, lexicalCastThrow <unsigned char> (value.asString ())));
|
||||
#endif
|
||||
}
|
||||
else if (value.isInt ())
|
||||
@@ -1308,7 +1308,7 @@ UPTR_T<STObject> STObject::parseJson (const Json::Value& object, SField::ref inN
|
||||
throw std::runtime_error ("Invalid field data");
|
||||
}
|
||||
else
|
||||
data.push_back (new STUInt16 (field, lexical_cast_st<uint16> (strValue)));
|
||||
data.push_back (new STUInt16 (field, lexicalCastThrow <uint16> (strValue)));
|
||||
}
|
||||
else if (value.isInt ())
|
||||
data.push_back (new STUInt16 (field, range_check_cast<uint16> (value.asInt (), 0, 65535)));
|
||||
@@ -1322,7 +1322,7 @@ UPTR_T<STObject> STObject::parseJson (const Json::Value& object, SField::ref inN
|
||||
case STI_UINT32:
|
||||
if (value.isString ())
|
||||
{
|
||||
data.push_back (new STUInt32 (field, lexical_cast_st<uint32> (value.asString ())));
|
||||
data.push_back (new STUInt32 (field, lexicalCastThrow <uint32> (value.asString ())));
|
||||
}
|
||||
else if (value.isInt ())
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ std::string STUInt8::getText () const
|
||||
return human;
|
||||
}
|
||||
|
||||
return boost::lexical_cast<std::string> (value);
|
||||
return lexicalCastThrow <std::string> (value);
|
||||
}
|
||||
|
||||
Json::Value STUInt8::getJson (int) const
|
||||
@@ -147,7 +147,7 @@ std::string STUInt16::getText () const
|
||||
return item->getName ();
|
||||
}
|
||||
|
||||
return boost::lexical_cast<std::string> (value);
|
||||
return lexicalCastThrow <std::string> (value);
|
||||
}
|
||||
|
||||
Json::Value STUInt16::getJson (int) const
|
||||
@@ -186,7 +186,7 @@ STUInt32* STUInt32::construct (SerializerIterator& u, SField::ref name)
|
||||
|
||||
std::string STUInt32::getText () const
|
||||
{
|
||||
return boost::lexical_cast<std::string> (value);
|
||||
return lexicalCastThrow <std::string> (value);
|
||||
}
|
||||
|
||||
Json::Value STUInt32::getJson (int) const
|
||||
@@ -207,7 +207,7 @@ STUInt64* STUInt64::construct (SerializerIterator& u, SField::ref name)
|
||||
|
||||
std::string STUInt64::getText () const
|
||||
{
|
||||
return boost::lexical_cast<std::string> (value);
|
||||
return lexicalCastThrow <std::string> (value);
|
||||
}
|
||||
|
||||
Json::Value STUInt64::getJson (int) const
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/range/adaptor/copied.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
Reference in New Issue
Block a user