Replace const Type& with Type const& for common types.

* std::string
* RippleAccount
* Account
* Currency
* uint256
* STAmount
* Json::Value
This commit is contained in:
Tom Ritchford
2014-08-03 19:17:56 -04:00
committed by Vinnie Falco
parent f5afe0587f
commit 648ccc7c17
143 changed files with 748 additions and 754 deletions

View File

@@ -52,7 +52,7 @@ public:
* is \c false.
* \return \c true if the document was successfully parsed, \c false if an error occurred.
*/
bool parse ( const std::string& document,
bool parse ( std::string const& document,
Value& root,
bool collectComments = true );
@@ -145,11 +145,11 @@ private:
Location& current,
Location end,
unsigned int& unicode );
bool addError ( const std::string& message,
bool addError ( std::string const& message,
Token& token,
Location extra = 0 );
bool recoverFromError ( TokenType skipUntilToken );
bool addErrorAndRecover ( const std::string& message,
bool addErrorAndRecover ( std::string const& message,
Token& token,
TokenType skipUntilToken );
void skipUntilSpace ();

View File

@@ -205,7 +205,7 @@ public:
* \endcode
*/
Value ( const StaticString& value );
Value ( const std::string& value );
Value ( std::string const& value );
Value (beast::String const& beastString);
# ifdef JSON_USE_CPPTL
Value ( const CppTL::ConstString& value );
@@ -307,9 +307,9 @@ public:
/// Access an object value by name, returns null if there is no member with that name.
const Value& operator[] ( const char* key ) const;
/// Access an object value by name, create a null member if it does not exist.
Value& operator[] ( const std::string& key );
Value& operator[] ( std::string const& key );
/// Access an object value by name, returns null if there is no member with that name.
const Value& operator[] ( const std::string& key ) const;
const Value& operator[] ( std::string const& key ) const;
/** \brief Access an object value by name, create a null member if it does not exist.
* If the object as no entry for that name, then the member name used to store
@@ -332,7 +332,7 @@ public:
Value get ( const char* key,
const Value& defaultValue ) const;
/// Return the member named key if it exist, defaultValue otherwise.
Value get ( const std::string& key,
Value get ( std::string const& key,
const Value& defaultValue ) const;
# ifdef JSON_USE_CPPTL
/// Return the member named key if it exist, defaultValue otherwise.
@@ -347,12 +347,12 @@ public:
/// \post type() is unchanged
Value removeMember ( const char* key );
/// Same as removeMember(const char*)
Value removeMember ( const std::string& key );
Value removeMember ( std::string const& key );
/// Return true if the object has a member named key.
bool isMember ( const char* key ) const;
/// Return true if the object has a member named key.
bool isMember ( const std::string& key ) const;
bool isMember ( std::string const& key ) const;
# ifdef JSON_USE_CPPTL
/// Return true if the object has a member named key.
bool isMember ( const CppTL::ConstString& key ) const;
@@ -374,7 +374,7 @@ public:
void setComment ( const char* comment,
CommentPlacement placement );
/// Comments must be //... or /* ... */
void setComment ( const std::string& comment,
void setComment ( std::string const& comment,
CommentPlacement placement );
bool hasComment ( CommentPlacement placement ) const;
/// Include delimiters and embedded newlines.
@@ -468,7 +468,7 @@ public:
PathArgument ();
PathArgument ( UInt index );
PathArgument ( const char* key );
PathArgument ( const std::string& key );
PathArgument ( std::string const& key );
private:
enum Kind
@@ -496,7 +496,7 @@ private:
class Path
{
public:
Path ( const std::string& path,
Path ( std::string const& path,
const PathArgument& a1 = PathArgument (),
const PathArgument& a2 = PathArgument (),
const PathArgument& a3 = PathArgument (),
@@ -513,13 +513,13 @@ private:
typedef std::vector<const PathArgument*> InArgs;
typedef std::vector<PathArgument> Args;
void makePath ( const std::string& path,
void makePath ( std::string const& path,
const InArgs& in );
void addPathInArg ( const std::string& path,
void addPathInArg ( std::string const& path,
const InArgs& in,
InArgs::const_iterator& itInArg,
PathArgument::Kind kind );
void invalidPath ( const std::string& path,
void invalidPath ( std::string const& path,
int location );
Args args_;

View File

@@ -94,15 +94,15 @@ private:
void writeValue ( const Value& value );
void writeArrayValue ( const Value& value );
bool isMultineArray ( const Value& value );
void pushValue ( const std::string& value );
void pushValue ( std::string const& value );
void writeIndent ();
void writeWithIndent ( const std::string& value );
void writeWithIndent ( std::string const& value );
void indent ();
void unindent ();
void writeCommentBeforeValue ( const Value& root );
void writeCommentAfterValueOnSameLine ( const Value& root );
bool hasCommentForValue ( const Value& value );
static std::string normalizeEOL ( const std::string& text );
static std::string normalizeEOL ( std::string const& text );
typedef std::vector<std::string> ChildValues;
@@ -152,15 +152,15 @@ private:
void writeValue ( const Value& value );
void writeArrayValue ( const Value& value );
bool isMultineArray ( const Value& value );
void pushValue ( const std::string& value );
void pushValue ( std::string const& value );
void writeIndent ();
void writeWithIndent ( const std::string& value );
void writeWithIndent ( std::string const& value );
void indent ();
void unindent ();
void writeCommentBeforeValue ( const Value& root );
void writeCommentAfterValueOnSameLine ( const Value& root );
bool hasCommentForValue ( const Value& value );
static std::string normalizeEOL ( const std::string& text );
static std::string normalizeEOL ( std::string const& text );
typedef std::vector<std::string> ChildValues;

View File

@@ -127,7 +127,7 @@ Reader::Reader ( const Features& features )
bool
Reader::parse ( const std::string& document,
Reader::parse ( std::string const& document,
Value& root,
bool collectComments )
{
@@ -742,7 +742,7 @@ Reader::decodeDouble( Token &token )
return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token );
currentValue() = value;
return true;
}
}
@@ -902,7 +902,7 @@ Reader::decodeUnicodeEscapeSequence ( Token& token,
bool
Reader::addError ( const std::string& message,
Reader::addError ( std::string const& message,
Token& token,
Location extra )
{
@@ -936,7 +936,7 @@ Reader::recoverFromError ( TokenType skipUntilToken )
bool
Reader::addErrorAndRecover ( const std::string& message,
Reader::addErrorAndRecover ( std::string const& message,
Token& token,
TokenType skipUntilToken )
{

View File

@@ -41,7 +41,7 @@ const UInt Value::maxUInt = UInt (-1);
// return 0;
//}
//
//inline char *safeStringDup( const std::string &str )
//inline char *safeStringDup( std::string const&str )
//{
// if ( !str.empty() )
// {
@@ -380,7 +380,7 @@ Value::Value ( const char* beginValue,
}
Value::Value ( const std::string& value )
Value::Value ( std::string const& value )
: type_ ( stringValue )
, allocated_ ( true )
, comments_ ( 0 )
@@ -1259,14 +1259,14 @@ Value::operator[] ( const char* key ) const
Value&
Value::operator[] ( const std::string& key )
Value::operator[] ( std::string const& key )
{
return (*this)[ key.c_str () ];
}
const Value&
Value::operator[] ( const std::string& key ) const
Value::operator[] ( std::string const& key ) const
{
return (*this)[ key.c_str () ];
}
@@ -1311,7 +1311,7 @@ Value::get ( const char* key,
Value
Value::get ( const std::string& key,
Value::get ( std::string const& key,
const Value& defaultValue ) const
{
return get ( key.c_str (), defaultValue );
@@ -1353,7 +1353,7 @@ Value::removeMember ( const char* key )
}
Value
Value::removeMember ( const std::string& key )
Value::removeMember ( std::string const& key )
{
return removeMember ( key.c_str () );
}
@@ -1376,7 +1376,7 @@ Value::isMember ( const char* key ) const
bool
Value::isMember ( const std::string& key ) const
Value::isMember ( std::string const& key ) const
{
return isMember ( key.c_str () );
}
@@ -1530,7 +1530,7 @@ Value::setComment ( const char* comment,
void
Value::setComment ( const std::string& comment,
Value::setComment ( std::string const& comment,
CommentPlacement placement )
{
setComment ( comment.c_str (), placement );
@@ -1758,7 +1758,7 @@ PathArgument::PathArgument ( const char* key )
}
PathArgument::PathArgument ( const std::string& key )
PathArgument::PathArgument ( std::string const& key )
: key_ ( key.c_str () )
, kind_ ( kindKey )
{
@@ -1767,7 +1767,7 @@ PathArgument::PathArgument ( const std::string& key )
// class Path
// //////////////////////////////////////////////////////////////////
Path::Path ( const std::string& path,
Path::Path ( std::string const& path,
const PathArgument& a1,
const PathArgument& a2,
const PathArgument& a3,
@@ -1785,7 +1785,7 @@ Path::Path ( const std::string& path,
void
Path::makePath ( const std::string& path,
Path::makePath ( std::string const& path,
const InArgs& in )
{
const char* current = path.c_str ();
@@ -1836,7 +1836,7 @@ Path::makePath ( const std::string& path,
void
Path::addPathInArg ( const std::string& path,
Path::addPathInArg ( std::string const& path,
const InArgs& in,
InArgs::const_iterator& itInArg,
PathArgument::Kind kind )
@@ -1857,7 +1857,7 @@ Path::addPathInArg ( const std::string& path,
void
Path::invalidPath ( const std::string& path,
Path::invalidPath ( std::string const& path,
int location )
{
// Error: invalid path.

View File

@@ -90,7 +90,7 @@ std::string valueToString( double value )
snprintf(buffer, sizeof(buffer), "%.16g", value);
#endif
return buffer;
}
}
std::string valueToString ( bool value )
{
@@ -259,7 +259,7 @@ FastWriter::writeValue ( const Value& value )
it != members.end ();
++it )
{
const std::string& name = *it;
std::string const& name = *it;
if ( it != members.begin () )
document_ += ",";
@@ -348,7 +348,7 @@ StyledWriter::writeValue ( const Value& value )
while ( true )
{
const std::string& name = *it;
std::string const& name = *it;
const Value& childValue = value[name];
writeCommentBeforeValue ( childValue );
writeWithIndent ( valueToQuotedString ( name.c_str () ) );
@@ -474,7 +474,7 @@ StyledWriter::isMultineArray ( const Value& value )
void
StyledWriter::pushValue ( const std::string& value )
StyledWriter::pushValue ( std::string const& value )
{
if ( addChildValues_ )
childValues_.push_back ( value );
@@ -502,7 +502,7 @@ StyledWriter::writeIndent ()
void
StyledWriter::writeWithIndent ( const std::string& value )
StyledWriter::writeWithIndent ( std::string const& value )
{
writeIndent ();
document_ += value;
@@ -560,7 +560,7 @@ StyledWriter::hasCommentForValue ( const Value& value )
std::string
StyledWriter::normalizeEOL ( const std::string& text )
StyledWriter::normalizeEOL ( std::string const& text )
{
std::string normalized;
normalized.reserve ( text.length () );
@@ -659,7 +659,7 @@ StyledStreamWriter::writeValue ( const Value& value )
while ( true )
{
const std::string& name = *it;
std::string const& name = *it;
const Value& childValue = value[name];
writeCommentBeforeValue ( childValue );
writeWithIndent ( valueToQuotedString ( name.c_str () ) );
@@ -785,7 +785,7 @@ StyledStreamWriter::isMultineArray ( const Value& value )
void
StyledStreamWriter::pushValue ( const std::string& value )
StyledStreamWriter::pushValue ( std::string const& value )
{
if ( addChildValues_ )
childValues_.push_back ( value );
@@ -814,7 +814,7 @@ StyledStreamWriter::writeIndent ()
void
StyledStreamWriter::writeWithIndent ( const std::string& value )
StyledStreamWriter::writeWithIndent ( std::string const& value )
{
writeIndent ();
*document_ << value;
@@ -872,7 +872,7 @@ StyledStreamWriter::hasCommentForValue ( const Value& value )
std::string
StyledStreamWriter::normalizeEOL ( const std::string& text )
StyledStreamWriter::normalizeEOL ( std::string const& text )
{
std::string normalized;
normalized.reserve ( text.length () );