Replace boost::lexical_cast with beast::lexicalCast

This commit is contained in:
Vinnie Falco
2013-07-28 19:43:16 -07:00
parent 9486bec0cd
commit ead7b07fd5
32 changed files with 116 additions and 157 deletions

View File

@@ -175,10 +175,10 @@ std::string RangeSet::toString () const
ret += ",";
if (it.first == it.second)
ret += boost::lexical_cast<std::string> ((it.first));
ret += lexicalCastThrow <std::string> ((it.first));
else
ret += boost::lexical_cast<std::string> (it.first) + "-"
+ boost::lexical_cast<std::string> (it.second);
ret += lexicalCastThrow <std::string> (it.first) + "-"
+ lexicalCastThrow <std::string> (it.second);
}
if (ret.empty ())

View File

@@ -38,7 +38,6 @@
#include <boost/format.hpp>
#include <boost/function.hpp>
#include <boost/functional/hash.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/make_shared.hpp>
#include <boost/ptr_container/ptr_vector.hpp> // VFALCO NOTE this looks like junk
#include <boost/ref.hpp>

View File

@@ -209,7 +209,7 @@ bool parseIpPort (const std::string& strSource, std::string& strIP, int& iPort)
if (bValid)
{
strIP = addrIP.to_string ();
iPort = strPortRaw.empty () ? -1 : boost::lexical_cast<int> (strPortRaw);
iPort = strPortRaw.empty () ? -1 : lexicalCastThrow <int> (strPortRaw);
}
}
@@ -235,7 +235,7 @@ bool parseUrl (const std::string& strUrl, std::string& strScheme, std::string& s
boost::algorithm::to_lower (strScheme);
iPort = strPort.empty () ? -1 : lexical_cast_s<int> (strPort);
iPort = strPort.empty () ? -1 : lexicalCast <int> (strPort);
// Log::out() << strUrl << " : " << bMatch << " : '" << strDomain << "' : '" << strPort << "' : " << iPort << " : '" << strPath << "'";
}
@@ -250,11 +250,11 @@ bool parseUrl (const std::string& strUrl, std::string& strScheme, std::string& s
// - floats multiplied by a billion
bool parseQuality (const std::string& strSource, uint32& uQuality)
{
uQuality = lexical_cast_s<uint32> (strSource);
uQuality = lexicalCast <uint32> (strSource);
if (!uQuality)
{
float fQuality = lexical_cast_s<float> (strSource);
float fQuality = lexicalCast <float> (strSource);
if (fQuality)
uQuality = (uint32) (QUALITY_ONE * fQuality);

View File

@@ -168,44 +168,6 @@ inline std::string strGetEnv (const std::string& strKey)
return getenv (strKey.c_str ()) ? getenv (strKey.c_str ()) : "";
}
template<typename T> T lexical_cast_s (const std::string& string)
{
// lexically cast a string to the selected type. Does not throw
try
{
return boost::lexical_cast<T> (string);
}
catch (...)
{
return 0;
}
}
template<typename T> std::string lexical_cast_i (const T& t)
{
// lexicaly cast the selected type to a string. Does not throw
try
{
return boost::lexical_cast<std::string> (t);
}
catch (...)
{
return "";
}
}
template<typename T> T lexical_cast_st (const std::string& string)
{
// lexically cast a string to the selected type. Does throw
return boost::lexical_cast<T> (string);
}
template<typename T> std::string lexical_cast_it (const T& t)
{
// lexicaly cast the selected type to a string. Does not throw
return boost::lexical_cast<std::string> (t);
}
bool parseUrl (const std::string& strUrl, std::string& strScheme, std::string& strDomain, int& iPort, std::string& strPath);
#define ADDRESS(p) strHex(uint64( ((char*) p) - ((char*) 0)))