diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2016-03-16 18:09:25 -0400 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2016-03-24 16:18:46 -0400 |
commit | 0a412aaa51a81325465837e712faaaaaca27e922 (patch) | |
tree | 114138897ef7de572de6baafa8a29eb0eb0d8ff6 /src/mongo/bson/bsonobj.cpp | |
parent | 3fb60720a0df562d176887f95925f7562bb50f8c (diff) | |
download | mongo-0a412aaa51a81325465837e712faaaaaca27e922.tar.gz |
SERVER-22735 Extend woCompare() to optionally accept a StringData::ComparatorInterface
Diffstat (limited to 'src/mongo/bson/bsonobj.cpp')
-rw-r--r-- | src/mongo/bson/bsonobj.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mongo/bson/bsonobj.cpp b/src/mongo/bson/bsonobj.cpp index d1fd73ad43c..8274ab5ccd9 100644 --- a/src/mongo/bson/bsonobj.cpp +++ b/src/mongo/bson/bsonobj.cpp @@ -118,7 +118,10 @@ bool BSONObj::valid() const { return validateBSON(objdata(), objsize()).isOK(); } -int BSONObj::woCompare(const BSONObj& r, const Ordering& o, bool considerFieldName) const { +int BSONObj::woCompare(const BSONObj& r, + const Ordering& o, + bool considerFieldName, + StringData::ComparatorInterface* comparator) const { if (isEmpty()) return r.isEmpty() ? 0 : -1; if (r.isEmpty()) @@ -139,7 +142,7 @@ int BSONObj::woCompare(const BSONObj& r, const Ordering& o, bool considerFieldNa int x; { - x = l.woCompare(r, considerFieldName); + x = l.woCompare(r, considerFieldName, comparator); if (o.descending(mask)) x = -x; } @@ -151,7 +154,10 @@ int BSONObj::woCompare(const BSONObj& r, const Ordering& o, bool considerFieldNa } /* well ordered compare */ -int BSONObj::woCompare(const BSONObj& r, const BSONObj& idxKey, bool considerFieldName) const { +int BSONObj::woCompare(const BSONObj& r, + const BSONObj& idxKey, + bool considerFieldName, + StringData::ComparatorInterface* comparator) const { if (isEmpty()) return r.isEmpty() ? 0 : -1; if (r.isEmpty()) @@ -183,7 +189,7 @@ int BSONObj::woCompare(const BSONObj& r, const BSONObj& idxKey, bool considerFie x = _stricmp(l.valuestr(), r.valuestr()); } else*/ { - x = l.woCompare(r, considerFieldName); + x = l.woCompare(r, considerFieldName, comparator); if (ordered && o.number() < 0) x = -x; } |