mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Replace const Type& with Type const& for common types.
* std::string * RippleAccount * Account * Currency * uint256 * STAmount * Json::Value
This commit is contained in:
committed by
Vinnie Falco
parent
f5afe0587f
commit
648ccc7c17
@@ -25,7 +25,7 @@ namespace ripple {
|
||||
|
||||
#define SECTION_DEFAULT_NAME ""
|
||||
|
||||
Section ParseSection (const std::string& strInput, const bool bTrim)
|
||||
Section ParseSection (std::string const& strInput, const bool bTrim)
|
||||
{
|
||||
std::string strData (strInput);
|
||||
std::vector<std::string> vLines;
|
||||
@@ -73,7 +73,7 @@ Section ParseSection (const std::string& strInput, const bool bTrim)
|
||||
return secResult;
|
||||
}
|
||||
|
||||
Section::mapped_type* SectionEntries (Section& secSource, const std::string& strSection)
|
||||
Section::mapped_type* SectionEntries (Section& secSource, std::string const& strSection)
|
||||
{
|
||||
Section::iterator it;
|
||||
Section::mapped_type* smtResult;
|
||||
@@ -94,14 +94,14 @@ Section::mapped_type* SectionEntries (Section& secSource, const std::string& str
|
||||
return smtResult;
|
||||
}
|
||||
|
||||
int SectionCount (Section& secSource, const std::string& strSection)
|
||||
int SectionCount (Section& secSource, std::string const& strSection)
|
||||
{
|
||||
Section::mapped_type* pmtEntries = SectionEntries (secSource, strSection);
|
||||
|
||||
return pmtEntries ? pmtEntries->size () : 0;
|
||||
}
|
||||
|
||||
bool SectionSingleB (Section& secSource, const std::string& strSection, std::string& strValue)
|
||||
bool SectionSingleB (Section& secSource, std::string const& strSection, std::string& strValue)
|
||||
{
|
||||
Section::mapped_type* pmtEntries = SectionEntries (secSource, strSection);
|
||||
bool bSingle = pmtEntries && 1 == pmtEntries->size ();
|
||||
|
||||
@@ -30,10 +30,10 @@ typedef std::map <const std::string, std::vector<std::string> > Section;
|
||||
// VFALCO TODO Wrap this up in a class interface
|
||||
//
|
||||
|
||||
Section ParseSection (const std::string& strInput, const bool bTrim);
|
||||
bool SectionSingleB (Section& secSource, const std::string& strSection, std::string& strValue);
|
||||
int SectionCount (Section& secSource, const std::string& strSection);
|
||||
Section::mapped_type* SectionEntries (Section& secSource, const std::string& strSection);
|
||||
Section ParseSection (std::string const& strInput, const bool bTrim);
|
||||
bool SectionSingleB (Section& secSource, std::string const& strSection, std::string& strValue);
|
||||
int SectionCount (Section& secSource, std::string const& strSection);
|
||||
Section::mapped_type* SectionEntries (Section& secSource, std::string const& strSection);
|
||||
|
||||
/** Parse a section of lines as a key/value array.
|
||||
|
||||
|
||||
@@ -69,10 +69,10 @@ std::string strprintf (const char* format, ...)
|
||||
return str;
|
||||
}
|
||||
|
||||
// NIKB NOTE: This function is only used by strUnHex (const std::string& strSrc)
|
||||
// NIKB NOTE: This function is only used by strUnHex (std::string const& strSrc)
|
||||
// which results in a pointless copy from std::string into std::vector. Should
|
||||
// we just scrap this function altogether?
|
||||
int strUnHex (std::string& strDst, const std::string& strSrc)
|
||||
int strUnHex (std::string& strDst, std::string const& strSrc)
|
||||
{
|
||||
std::string tmp;
|
||||
|
||||
@@ -113,7 +113,7 @@ int strUnHex (std::string& strDst, const std::string& strSrc)
|
||||
return strDst.size ();
|
||||
}
|
||||
|
||||
std::pair<Blob, bool> strUnHex (const std::string& strSrc)
|
||||
std::pair<Blob, bool> strUnHex (std::string const& strSrc)
|
||||
{
|
||||
std::string strTmp;
|
||||
|
||||
@@ -123,7 +123,7 @@ std::pair<Blob, bool> strUnHex (const std::string& strSrc)
|
||||
return std::make_pair(strCopy (strTmp), true);
|
||||
}
|
||||
|
||||
uint64_t uintFromHex (const std::string& strSrc)
|
||||
uint64_t uintFromHex (std::string const& strSrc)
|
||||
{
|
||||
uint64_t uValue (0);
|
||||
|
||||
@@ -147,7 +147,7 @@ uint64_t uintFromHex (const std::string& strSrc)
|
||||
// Misc string
|
||||
//
|
||||
|
||||
Blob strCopy (const std::string& strSrc)
|
||||
Blob strCopy (std::string const& strSrc)
|
||||
{
|
||||
Blob vucDst;
|
||||
|
||||
@@ -170,7 +170,7 @@ std::string strCopy (Blob const& vucSrc)
|
||||
|
||||
}
|
||||
|
||||
extern std::string urlEncode (const std::string& strSrc)
|
||||
extern std::string urlEncode (std::string const& strSrc)
|
||||
{
|
||||
std::string strDst;
|
||||
int iOutput = 0;
|
||||
@@ -208,7 +208,7 @@ extern std::string urlEncode (const std::string& strSrc)
|
||||
//
|
||||
// <-- iPort: "" = -1
|
||||
// VFALCO TODO Make this not require boost... and especially boost::asio
|
||||
bool parseIpPort (const std::string& strSource, std::string& strIP, int& iPort)
|
||||
bool parseIpPort (std::string const& strSource, std::string& strIP, int& iPort)
|
||||
{
|
||||
boost::smatch smMatch;
|
||||
bool bValid = false;
|
||||
@@ -237,7 +237,7 @@ bool parseIpPort (const std::string& strSource, std::string& strIP, int& iPort)
|
||||
|
||||
// VFALCO TODO Callers should be using beast::URL and beast::ParsedURL, not this home-brew.
|
||||
//
|
||||
bool parseUrl (const std::string& strUrl, std::string& strScheme, std::string& strDomain, int& iPort, std::string& strPath)
|
||||
bool parseUrl (std::string const& strUrl, std::string& strScheme, std::string& strDomain, int& iPort, std::string& strPath)
|
||||
{
|
||||
// scheme://username:password@hostname:port/rest
|
||||
static boost::regex reUrl ("(?i)\\`\\s*([[:alpha:]][-+.[:alpha:][:digit:]]*)://([^:/]+)(?::(\\d+))?(/.*)?\\s*?\\'");
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace ripple {
|
||||
|
||||
extern std::string strprintf (const char* format, ...);
|
||||
|
||||
extern std::string urlEncode (const std::string& strSrc);
|
||||
extern std::string urlEncode (std::string const& strSrc);
|
||||
|
||||
// NIKB TODO remove this function - it's only used for some logging in the UNL
|
||||
// code which can be trivially rewritten.
|
||||
@@ -59,7 +59,7 @@ std::string strJoin (Iterator first, Iterator last, std::string strSeperator)
|
||||
}
|
||||
|
||||
// NIKB TODO Remove the need for all these overloads. Move them out of here.
|
||||
inline const std::string strHex (const std::string& strSrc)
|
||||
inline const std::string strHex (std::string const& strSrc)
|
||||
{
|
||||
return strHex (strSrc.begin (), strSrc.size ());
|
||||
}
|
||||
@@ -76,7 +76,7 @@ inline std::string strHex (const std::uint64_t uiHost)
|
||||
return strHex ((unsigned char*) &uBig, sizeof (uBig));
|
||||
}
|
||||
|
||||
inline static std::string sqlEscape (const std::string& strSrc)
|
||||
inline static std::string sqlEscape (std::string const& strSrc)
|
||||
{
|
||||
static boost::format f ("X'%s'");
|
||||
return str (boost::format (f) % strHex (strSrc));
|
||||
@@ -108,23 +108,23 @@ inline static std::string sqlEscape (Blob const& vecSrc)
|
||||
return j;
|
||||
}
|
||||
|
||||
int strUnHex (std::string& strDst, const std::string& strSrc);
|
||||
int strUnHex (std::string& strDst, std::string const& strSrc);
|
||||
|
||||
uint64_t uintFromHex (const std::string& strSrc);
|
||||
uint64_t uintFromHex (std::string const& strSrc);
|
||||
|
||||
std::pair<Blob, bool> strUnHex (const std::string& strSrc);
|
||||
std::pair<Blob, bool> strUnHex (std::string const& strSrc);
|
||||
|
||||
Blob strCopy (const std::string& strSrc);
|
||||
Blob strCopy (std::string const& strSrc);
|
||||
std::string strCopy (Blob const& vucSrc);
|
||||
|
||||
bool parseIpPort (const std::string& strSource, std::string& strIP, int& iPort);
|
||||
bool parseIpPort (std::string const& strSource, std::string& strIP, int& iPort);
|
||||
|
||||
inline std::string strGetEnv (const std::string& strKey)
|
||||
inline std::string strGetEnv (std::string const& strKey)
|
||||
{
|
||||
return getenv (strKey.c_str ()) ? getenv (strKey.c_str ()) : "";
|
||||
}
|
||||
|
||||
bool parseUrl (const std::string& strUrl, std::string& strScheme,
|
||||
bool parseUrl (std::string const& strUrl, std::string& strScheme,
|
||||
std::string& strDomain, int& iPort, std::string& strPath);
|
||||
|
||||
#define ADDRESS(p) strHex(uint64( ((char*) p) - ((char*) 0)))
|
||||
|
||||
Reference in New Issue
Block a user