summaryrefslogtreecommitdiff
path: root/src/mongo/bson
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2019-04-08 16:27:50 -0400
committerBilly Donahue <billy.donahue@mongodb.com>2019-04-09 15:38:40 -0400
commit1041dd848e25e879260d1015d8da4f72ee7993fe (patch)
treef8ddb4ee7c841e4ef790ea7bd53e75c0a09c4cc2 /src/mongo/bson
parent8cdc51e7810f7fd8898a4c60b935e389f04659ee (diff)
downloadmongo-1041dd848e25e879260d1015d8da4f72ee7993fe.tar.gz
SERVER-40476 remove mongoutils::str
Rename utils/mongoutils/str.h => utils/str.h Rename namespace mongoutils::str => str Rename mongo::strcasecmp => str::caseInsensitiveCompare.
Diffstat (limited to 'src/mongo/bson')
-rw-r--r--src/mongo/bson/bsonelement.cpp3
-rw-r--r--src/mongo/bson/bsonobj.cpp4
-rw-r--r--src/mongo/bson/json.cpp2
-rw-r--r--src/mongo/bson/mutable/algorithm.h4
-rw-r--r--src/mongo/bson/util/bson_check.h2
-rw-r--r--src/mongo/bson/util/bson_extract.cpp53
6 files changed, 31 insertions, 37 deletions
diff --git a/src/mongo/bson/bsonelement.cpp b/src/mongo/bson/bsonelement.cpp
index 35ad1e76391..5bef012b292 100644
--- a/src/mongo/bson/bsonelement.cpp
+++ b/src/mongo/bson/bsonelement.cpp
@@ -43,14 +43,13 @@
#include "mongo/util/duration.h"
#include "mongo/util/hex.h"
#include "mongo/util/log.h"
-#include "mongo/util/mongoutils/str.h"
#include "mongo/util/scopeguard.h"
+#include "mongo/util/str.h"
#include "mongo/util/string_map.h"
#include "mongo/util/stringutils.h"
#include "mongo/util/uuid.h"
namespace mongo {
-namespace str = mongoutils::str;
using std::dec;
using std::hex;
diff --git a/src/mongo/bson/bsonobj.cpp b/src/mongo/bson/bsonobj.cpp
index 376e32016ee..bae36f39544 100644
--- a/src/mongo/bson/bsonobj.cpp
+++ b/src/mongo/bson/bsonobj.cpp
@@ -38,7 +38,7 @@
#include "mongo/util/allocator.h"
#include "mongo/util/hex.h"
#include "mongo/util/log.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
#include "mongo/util/stringutils.h"
namespace mongo {
@@ -622,7 +622,7 @@ void BSONObj::toString(
Status DataType::Handler<BSONObj>::store(
const BSONObj& bson, char* ptr, size_t length, size_t* advanced, std::ptrdiff_t debug_offset) {
if (bson.objsize() > static_cast<int>(length)) {
- mongoutils::str::stream ss;
+ str::stream ss;
ss << "buffer too small to write bson of size (" << bson.objsize()
<< ") at offset: " << debug_offset;
return Status(ErrorCodes::Overflow, ss);
diff --git a/src/mongo/bson/json.cpp b/src/mongo/bson/json.cpp
index 3fff510f25c..8f6587a6eff 100644
--- a/src/mongo/bson/json.cpp
+++ b/src/mongo/bson/json.cpp
@@ -40,7 +40,7 @@
#include "mongo/util/base64.h"
#include "mongo/util/hex.h"
#include "mongo/util/log.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
#include "mongo/util/time_support.h"
namespace mongo {
diff --git a/src/mongo/bson/mutable/algorithm.h b/src/mongo/bson/mutable/algorithm.h
index 53cedd6100c..f2d4ffd1de5 100644
--- a/src/mongo/bson/mutable/algorithm.h
+++ b/src/mongo/bson/mutable/algorithm.h
@@ -36,7 +36,7 @@
#include "mongo/base/string_data_comparator_interface.h"
#include "mongo/bson/mutable/const_element.h"
#include "mongo/bson/mutable/element.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
namespace mutablebson {
@@ -290,7 +290,7 @@ std::string getFullName(ElementType element, char delim = '.') {
curr = curr.parent();
}
- mongoutils::str::stream name;
+ str::stream name;
bool first = true;
for (std::vector<StringData>::reverse_iterator it = names.rbegin(); it != names.rend(); ++it) {
if (!first)
diff --git a/src/mongo/bson/util/bson_check.h b/src/mongo/bson/util/bson_check.h
index 46656ea9802..1ca748d88a2 100644
--- a/src/mongo/bson/util/bson_check.h
+++ b/src/mongo/bson/util/bson_check.h
@@ -33,7 +33,7 @@
#include "mongo/db/command_generic_argument.h"
#include "mongo/db/commands.h"
#include "mongo/db/jsobj.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
#include "mongo/util/string_map.h"
namespace mongo {
diff --git a/src/mongo/bson/util/bson_extract.cpp b/src/mongo/bson/util/bson_extract.cpp
index 6552db87ae2..481c26df5fe 100644
--- a/src/mongo/bson/util/bson_extract.cpp
+++ b/src/mongo/bson/util/bson_extract.cpp
@@ -30,7 +30,7 @@
#include "mongo/bson/util/bson_extract.h"
#include "mongo/db/jsobj.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
@@ -52,8 +52,7 @@ Status bsonExtractFieldImpl(const BSONObj& object,
return kDefaultCase;
}
return Status(ErrorCodes::NoSuchKey,
- mongoutils::str::stream() << "Missing expected field \"" << fieldName.toString()
- << "\"");
+ str::stream() << "Missing expected field \"" << fieldName.toString() << "\"");
}
Status bsonExtractTypedFieldImpl(const BSONObj& object,
@@ -66,11 +65,10 @@ Status bsonExtractTypedFieldImpl(const BSONObj& object,
return status;
if (type != outElement->type()) {
return Status(ErrorCodes::TypeMismatch,
- mongoutils::str::stream() << "\"" << fieldName
- << "\" had the wrong type. Expected "
- << typeName(type)
- << ", found "
- << typeName(outElement->type()));
+ str::stream() << "\"" << fieldName << "\" had the wrong type. Expected "
+ << typeName(type)
+ << ", found "
+ << typeName(outElement->type()));
}
return status;
}
@@ -85,18 +83,17 @@ Status bsonExtractIntegerFieldImpl(const BSONObj& object,
return status;
if (!element.isNumber()) {
return Status(ErrorCodes::TypeMismatch,
- mongoutils::str::stream() << "Expected field \"" << fieldName
- << "\" to have numeric type, but found "
- << typeName(element.type()));
+ str::stream() << "Expected field \"" << fieldName
+ << "\" to have numeric type, but found "
+ << typeName(element.type()));
}
long long result = element.safeNumberLong();
if (result != element.numberDouble()) {
- return Status(
- ErrorCodes::BadValue,
- mongoutils::str::stream() << "Expected field \"" << fieldName
- << "\" to have a value "
- "exactly representable as a 64-bit integer, but found "
- << element);
+ return Status(ErrorCodes::BadValue,
+ str::stream() << "Expected field \"" << fieldName
+ << "\" to have a value "
+ "exactly representable as a 64-bit integer, but found "
+ << element);
}
*out = result;
return status;
@@ -112,9 +109,9 @@ Status bsonExtractDoubleFieldImpl(const BSONObj& object,
return status;
if (!element.isNumber()) {
return Status(ErrorCodes::TypeMismatch,
- mongoutils::str::stream() << "Expected field \"" << fieldName
- << "\" to have numeric type, but found "
- << typeName(element.type()));
+ str::stream() << "Expected field \"" << fieldName
+ << "\" to have numeric type, but found "
+ << typeName(element.type()));
}
*out = element.numberDouble();
return status;
@@ -157,10 +154,9 @@ Status bsonExtractBooleanFieldWithDefault(const BSONObj& object,
if (!element.isNumber() && !element.isBoolean()) {
return Status(ErrorCodes::TypeMismatch,
- mongoutils::str::stream() << "Expected boolean or number type for field \""
- << fieldName
- << "\", found "
- << typeName(element.type()));
+ str::stream() << "Expected boolean or number type for field \"" << fieldName
+ << "\", found "
+ << typeName(element.type()));
}
*out = element.trueValue();
return status;
@@ -263,11 +259,10 @@ Status bsonExtractIntegerFieldWithDefaultIf(const BSONObj& object,
return status;
}
if (!pred(*out)) {
- return Status(
- ErrorCodes::BadValue,
- mongoutils::str::stream() << "Invalid value in field \"" << fieldName << "\": " << *out
- << ": "
- << predDescription);
+ return Status(ErrorCodes::BadValue,
+ str::stream() << "Invalid value in field \"" << fieldName << "\": " << *out
+ << ": "
+ << predDescription);
}
return status;
}