summaryrefslogtreecommitdiff
path: root/src/mongo/base/string_data.h
diff options
context:
space:
mode:
authorTyler Brock <tyler.brock@gmail.com>2015-02-06 14:29:45 -0500
committerTyler Brock <tyler.brock@gmail.com>2015-02-06 16:37:35 -0500
commitaa9980b8c02de71c6918fba4aba9f22dd10eed01 (patch)
tree3ade9078069c7e1317a8b31c2e1fc427977d7abe /src/mongo/base/string_data.h
parent3a7675bb6fa110a10be307db3201bfb348cf41cf (diff)
downloadmongo-aa9980b8c02de71c6918fba4aba9f22dd10eed01.tar.gz
SERVER-16940 Change pass-by-const-ref of StringData to pass-by-value
Diffstat (limited to 'src/mongo/base/string_data.h')
-rw-r--r--src/mongo/base/string_data.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/mongo/base/string_data.h b/src/mongo/base/string_data.h
index a1327fefe90..e70d27fc975 100644
--- a/src/mongo/base/string_data.h
+++ b/src/mongo/base/string_data.h
@@ -89,14 +89,14 @@ namespace mongo {
* Returns -1, 0, or 1 if 'this' is less, equal, or greater than 'other' in
* lexicographical order.
*/
- int compare(const StringData& other) const;
+ int compare(StringData other) const;
/**
* note: this uses tolower, and therefore does not handle
* come languages correctly.
* should be use sparingly
*/
- bool equalCaseInsensitive( const StringData& other ) const;
+ bool equalCaseInsensitive( StringData other ) const;
void copyTo( char* dest, bool includeEndingNull ) const;
@@ -107,18 +107,18 @@ namespace mongo {
//
size_t find( char c , size_t fromPos = 0 ) const;
- size_t find( const StringData& needle ) const;
+ size_t find( StringData needle ) const;
size_t rfind( char c, size_t fromPos = std::string::npos ) const;
/**
* Returns true if 'prefix' is a substring of this instance, anchored at position 0.
*/
- bool startsWith( const StringData& prefix ) const;
+ bool startsWith( StringData prefix ) const;
/**
* Returns true if 'suffix' is a substring of this instance, anchored at the end.
*/
- bool endsWith( const StringData& suffix ) const;
+ bool endsWith( StringData suffix ) const;
//
// accessors
@@ -142,7 +142,7 @@ namespace mongo {
* to be consistent across versions.
*/
struct Hasher {
- size_t operator() (const StringData& str) const;
+ size_t operator() (StringData str) const;
};
//
@@ -159,31 +159,31 @@ namespace mongo {
size_t _size; // 'size' does not include the null terminator
};
- inline bool operator==(const StringData& lhs, const StringData& rhs) {
+ inline bool operator==(StringData lhs, StringData rhs) {
return (lhs.size() == rhs.size()) && (lhs.compare(rhs) == 0);
}
- inline bool operator!=(const StringData& lhs, const StringData& rhs) {
+ inline bool operator!=(StringData lhs, StringData rhs) {
return !(lhs == rhs);
}
- inline bool operator<(const StringData& lhs, const StringData& rhs) {
+ inline bool operator<(StringData lhs, StringData rhs) {
return lhs.compare(rhs) < 0 ;
}
- inline bool operator<=(const StringData& lhs, const StringData& rhs) {
+ inline bool operator<=(StringData lhs, StringData rhs) {
return lhs.compare(rhs) <= 0;
}
- inline bool operator>(const StringData& lhs, const StringData& rhs) {
+ inline bool operator>(StringData lhs, StringData rhs) {
return lhs.compare(rhs) > 0;
}
- inline bool operator>=(const StringData& lhs, const StringData& rhs) {
+ inline bool operator>=(StringData lhs, StringData rhs) {
return lhs.compare(rhs) >= 0;
}
- std::ostream& operator<<(std::ostream& stream, const StringData& value);
+ std::ostream& operator<<(std::ostream& stream, StringData value);
} // namespace mongo