summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/path_internal.cpp
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 00:22:50 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 10:56:02 -0400
commit9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch)
tree3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/db/matcher/path_internal.cpp
parent01965cf52bce6976637ecb8f4a622aeb05ab256a (diff)
downloadmongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/matcher/path_internal.cpp')
-rw-r--r--src/mongo/db/matcher/path_internal.cpp47
1 files changed, 21 insertions, 26 deletions
diff --git a/src/mongo/db/matcher/path_internal.cpp b/src/mongo/db/matcher/path_internal.cpp
index d8ccfe0ea9b..31b850e6834 100644
--- a/src/mongo/db/matcher/path_internal.cpp
+++ b/src/mongo/db/matcher/path_internal.cpp
@@ -32,31 +32,27 @@
namespace mongo {
- bool isAllDigits( StringData str ) {
- for ( unsigned i = 0; i < str.size(); i++ ) {
- if ( !isdigit( str[i] ) )
- return false;
- }
- return true;
+bool isAllDigits(StringData str) {
+ for (unsigned i = 0; i < str.size(); i++) {
+ if (!isdigit(str[i]))
+ return false;
}
+ return true;
+}
- BSONElement getFieldDottedOrArray( const BSONObj& doc,
- const FieldRef& path,
- size_t* idxPath ) {
- if ( path.numParts() == 0 )
- return doc.getField( "" );
-
- BSONElement res;
-
- BSONObj curr = doc;
- bool stop = false;
- size_t partNum = 0;
- while ( partNum < path.numParts() && !stop ) {
+BSONElement getFieldDottedOrArray(const BSONObj& doc, const FieldRef& path, size_t* idxPath) {
+ if (path.numParts() == 0)
+ return doc.getField("");
- res = curr.getField( path.getPart( partNum ) );
+ BSONElement res;
- switch ( res.type() ) {
+ BSONObj curr = doc;
+ bool stop = false;
+ size_t partNum = 0;
+ while (partNum < path.numParts() && !stop) {
+ res = curr.getField(path.getPart(partNum));
+ switch (res.type()) {
case EOO:
stop = true;
break;
@@ -71,17 +67,16 @@ namespace mongo {
break;
default:
- if ( partNum+1 < path.numParts() ) {
+ if (partNum + 1 < path.numParts()) {
res = BSONElement();
}
stop = true;
-
- }
}
-
- *idxPath = partNum;
- return res;
}
+ *idxPath = partNum;
+ return res;
+}
+
} // namespace mongo