summaryrefslogtreecommitdiff
path: root/src/mongo/bson/mutable
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-05-03 13:57:13 -0400
committerDavid Storch <david.storch@10gen.com>2016-05-04 09:41:58 -0400
commit3e3313409d90026ed5f629e8ffb87b04cca5a524 (patch)
tree89552b979750cb9d5c4abf26472bb9211179eb19 /src/mongo/bson/mutable
parent8f445bef3ad620018a422e7b08ebff552dd0b825 (diff)
downloadmongo-3e3313409d90026ed5f629e8ffb87b04cca5a524.tar.gz
SERVER-23349 make CollatorInterface methods const
Also changes all uses of CollatorInterface* to pointers-to-const.
Diffstat (limited to 'src/mongo/bson/mutable')
-rw-r--r--src/mongo/bson/mutable/const_element-inl.h21
-rw-r--r--src/mongo/bson/mutable/const_element.h25
-rw-r--r--src/mongo/bson/mutable/document-inl.h4
-rw-r--r--src/mongo/bson/mutable/document.cpp6
-rw-r--r--src/mongo/bson/mutable/document.h9
-rw-r--r--src/mongo/bson/mutable/element.h6
6 files changed, 39 insertions, 32 deletions
diff --git a/src/mongo/bson/mutable/const_element-inl.h b/src/mongo/bson/mutable/const_element-inl.h
index a7f3864ae17..2d00ec0b797 100644
--- a/src/mongo/bson/mutable/const_element-inl.h
+++ b/src/mongo/bson/mutable/const_element-inl.h
@@ -164,21 +164,24 @@ inline SafeNum ConstElement::getValueSafeNum() const {
return _basis.getValueSafeNum();
}
-inline int ConstElement::compareWithElement(const ConstElement& other,
- bool considerFieldName,
- StringData::ComparatorInterface* comparator) const {
+inline int ConstElement::compareWithElement(
+ const ConstElement& other,
+ bool considerFieldName,
+ const StringData::ComparatorInterface* comparator) const {
return _basis.compareWithElement(other, considerFieldName, comparator);
}
-inline int ConstElement::compareWithBSONElement(const BSONElement& other,
- bool considerFieldName,
- StringData::ComparatorInterface* comparator) const {
+inline int ConstElement::compareWithBSONElement(
+ const BSONElement& other,
+ bool considerFieldName,
+ const StringData::ComparatorInterface* comparator) const {
return _basis.compareWithBSONElement(other, considerFieldName, comparator);
}
-inline int ConstElement::compareWithBSONObj(const BSONObj& other,
- bool considerFieldName,
- StringData::ComparatorInterface* comparator) const {
+inline int ConstElement::compareWithBSONObj(
+ const BSONObj& other,
+ bool considerFieldName,
+ const StringData::ComparatorInterface* comparator) const {
return _basis.compareWithBSONObj(other, considerFieldName, comparator);
}
diff --git a/src/mongo/bson/mutable/const_element.h b/src/mongo/bson/mutable/const_element.h
index 1997de64a32..d9798309204 100644
--- a/src/mongo/bson/mutable/const_element.h
+++ b/src/mongo/bson/mutable/const_element.h
@@ -88,17 +88,20 @@ public:
inline bool isValueMaxKey() const;
inline SafeNum getValueSafeNum() const;
- inline int compareWithElement(const ConstElement& other,
- bool considerFieldName = true,
- StringData::ComparatorInterface* comparator = nullptr) const;
-
- inline int compareWithBSONElement(const BSONElement& other,
- bool considerFieldName = true,
- StringData::ComparatorInterface* comparator = nullptr) const;
-
- inline int compareWithBSONObj(const BSONObj& other,
- bool considerFieldName = true,
- StringData::ComparatorInterface* comparator = nullptr) const;
+ inline int compareWithElement(
+ const ConstElement& other,
+ bool considerFieldName = true,
+ const StringData::ComparatorInterface* comparator = nullptr) const;
+
+ inline int compareWithBSONElement(
+ const BSONElement& other,
+ bool considerFieldName = true,
+ const StringData::ComparatorInterface* comparator = nullptr) const;
+
+ inline int compareWithBSONObj(
+ const BSONObj& other,
+ bool considerFieldName = true,
+ const StringData::ComparatorInterface* comparator = nullptr) const;
inline void writeTo(BSONObjBuilder* builder) const;
inline void writeArrayTo(BSONArrayBuilder* builder) const;
diff --git a/src/mongo/bson/mutable/document-inl.h b/src/mongo/bson/mutable/document-inl.h
index ec06777e8a5..6942283ceb1 100644
--- a/src/mongo/bson/mutable/document-inl.h
+++ b/src/mongo/bson/mutable/document-inl.h
@@ -32,7 +32,7 @@ namespace mutablebson {
inline int Document::compareWith(const Document& other,
bool considerFieldName,
- StringData::ComparatorInterface* comparator) const {
+ const StringData::ComparatorInterface* comparator) const {
// We cheat and use Element::compareWithElement since we know that 'other' is a
// Document and has a 'hidden' fieldname that is always indentical across all Document
// instances.
@@ -41,7 +41,7 @@ inline int Document::compareWith(const Document& other,
inline int Document::compareWithBSONObj(const BSONObj& other,
bool considerFieldName,
- StringData::ComparatorInterface* comparator) const {
+ const StringData::ComparatorInterface* comparator) const {
return root().compareWithBSONObj(other, considerFieldName, comparator);
}
diff --git a/src/mongo/bson/mutable/document.cpp b/src/mongo/bson/mutable/document.cpp
index 6bb159b0e7c..2afe8c8de96 100644
--- a/src/mongo/bson/mutable/document.cpp
+++ b/src/mongo/bson/mutable/document.cpp
@@ -1487,7 +1487,7 @@ SafeNum Element::getValueSafeNum() const {
int Element::compareWithElement(const ConstElement& other,
bool considerFieldName,
- StringData::ComparatorInterface* comparator) const {
+ const StringData::ComparatorInterface* comparator) const {
verify(ok());
verify(other.ok());
@@ -1570,7 +1570,7 @@ int Element::compareWithElement(const ConstElement& other,
int Element::compareWithBSONElement(const BSONElement& other,
bool considerFieldName,
- StringData::ComparatorInterface* comparator) const {
+ const StringData::ComparatorInterface* comparator) const {
verify(ok());
const Document::Impl& impl = getDocument().getImpl();
@@ -1611,7 +1611,7 @@ int Element::compareWithBSONElement(const BSONElement& other,
int Element::compareWithBSONObj(const BSONObj& other,
bool considerFieldName,
- StringData::ComparatorInterface* comparator) const {
+ const StringData::ComparatorInterface* comparator) const {
verify(ok());
const Document::Impl& impl = getDocument().getImpl();
diff --git a/src/mongo/bson/mutable/document.h b/src/mongo/bson/mutable/document.h
index cca50443311..60cbaab3cde 100644
--- a/src/mongo/bson/mutable/document.h
+++ b/src/mongo/bson/mutable/document.h
@@ -279,12 +279,13 @@ public:
/** Compare this Document to 'other' with the semantics of BSONObj::woCompare. */
inline int compareWith(const Document& other,
bool considerFieldName = true,
- StringData::ComparatorInterface* comparator = nullptr) const;
+ const StringData::ComparatorInterface* comparator = nullptr) const;
/** Compare this Document to 'other' with the semantics of BSONObj::woCompare. */
- inline int compareWithBSONObj(const BSONObj& other,
- bool considerFieldName = true,
- StringData::ComparatorInterface* comparator = nullptr) const;
+ inline int compareWithBSONObj(
+ const BSONObj& other,
+ bool considerFieldName = true,
+ const StringData::ComparatorInterface* comparator = nullptr) const;
//
diff --git a/src/mongo/bson/mutable/element.h b/src/mongo/bson/mutable/element.h
index ee0d6de3d45..690894b285d 100644
--- a/src/mongo/bson/mutable/element.h
+++ b/src/mongo/bson/mutable/element.h
@@ -352,7 +352,7 @@ public:
*/
int compareWithElement(const ConstElement& other,
bool considerFieldName = true,
- StringData::ComparatorInterface* comparator = nullptr) const;
+ const StringData::ComparatorInterface* comparator = nullptr) const;
/** Compare this Element with BSONElement 'other'. You should not call this on the root
* Element of the Document because the root Element does not have a field name. Use
@@ -364,7 +364,7 @@ public:
*/
int compareWithBSONElement(const BSONElement& other,
bool considerFieldName = true,
- StringData::ComparatorInterface* comparator = nullptr) const;
+ const StringData::ComparatorInterface* comparator = nullptr) const;
/** Compare this Element, which must be an Object or an Array, with 'other'.
*
@@ -374,7 +374,7 @@ public:
*/
int compareWithBSONObj(const BSONObj& other,
bool considerFieldName = true,
- StringData::ComparatorInterface* comparator = nullptr) const;
+ const StringData::ComparatorInterface* comparator = nullptr) const;
//