| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- "use strict";
- FieldRef = require('FieldRef');
- BSONElement = require('BSONElement');
- // Autogenerated by cport.py on 2013-09-17 14:37
- var ElementPath = module.exports = function (){
- }, klass = ElementPath, base = Object , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
- // File: path.h lines: 41-41
- // FieldRef _fieldRef;
- proto._fieldRef = undefined;
- // File: path.h lines: 42-42
- // bool _shouldTraverseLeafArray;
- proto._shouldTraverseLeafArray = undefined;
- // File: path.h lines: 41-41
- // FieldRef _fieldRef;
- proto._fieldRef = undefined;
- // File: path.h lines: 42-42
- // bool _shouldTraverseLeafArray;
- proto._shouldTraverseLeafArray = undefined;
- // File: path_internal.cpp
- /**
- * getFieldDottedOrArray
- *
- * @method getFieldDottedArray
- * @param doc
- * @param path
- * @param idxPathObj This is an object with a pathID element. This allows for pass by ref in calling function.
- * */
- klass.getFieldDottedOrArray = function getFieldDottedOrArray(doc, path, idxPathObj){
- // File path_internal.cpp lines 31-72
- if (path.numParts() === 0 ) { return doc.getField(""); }
-
- var res,curr = doc,
- stop = false,
- partNum = 0;
- while (partNum < path.numParts() && !stop) {
- res = curr.getField( path.getPart( partNum) );
- switch (res.type() ) {
- case 'EOO':
- stop = true;
- break;
- case 'Object':
- curr = res.Obj();
- partNum++;
- break;
- case 'Array':
- stop = true;
- break;
- default:
- if (partNum + 1 < path.numParts() ) {
- res = new BSONELEMENT();
- }
- stope = true;
- break;
- }
- }
- idxPath.pathID = partNum;
- return res;
- };
- /**
- * isAllDigits does what it says on the tin.
- *
- * @method isAllDigits
- * @param str
- */
- klass.isAllDigits = function isAllDigits ( str ){
- // File path_internal.cpp lines 23-29
- digitCheck = /\D/g;
- if (digitCheck.exec(str) === null){ return true; }
- return false;
- };
-
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method fieldRef
- * @param
- *
- */
- proto.fieldRef = function fieldRef( /* */ ){
- // File: path.h lines: 37-36
- return this._fieldRef;
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method init
- * @param
- *
- */
- proto.init = function init( path ){ // const StringData& path
- // File: path.cpp lines: 26-29
- this._shouldTraverseLeafArray = true;
- this._fieldRef.parse( path );
- return Status.OK;
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method setTraverseLeafArray
- * @param
- *
- */
- proto.setTraverseLeafArray = function setTraverseLeafArray( b ){ // bool b
- // File: path.h lines: 35-34
- this._shouldTraverseLeafArray = b;
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method shouldTraverseLeafArray
- * @param
- *
- */
- proto.shouldTraverseLeafArray = function shouldTraverseLeafArray( /* */ ){
- // File: path.h lines: 38-37
- return this._shouldTraverseLeafArray;
- };
|