|
|
@@ -1,11 +1,11 @@
|
|
|
-"use strict"
|
|
|
+"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
// Autogenerated by cport.py on 2013-09-17 14:37
|
|
|
-var MatchExpression = module.exports = function (){
|
|
|
-
|
|
|
-}, klass = MatchExpression, base = Object , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
|
|
|
+var MatchExpression = module.exports = function MatchExpression( type ){
|
|
|
+ this._matchType = type;
|
|
|
+}, klass = MatchExpression, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
|
|
|
|
|
|
|
|
|
// File: expression.h lines: 172-172
|
|
|
@@ -19,40 +19,6 @@ proto._matchType = undefined;
|
|
|
|
|
|
proto._tagData = undefined;
|
|
|
|
|
|
-
|
|
|
-// File: expression.h lines: 172-172
|
|
|
-// MatchType _matchType;
|
|
|
-
|
|
|
-proto._matchType = undefined;
|
|
|
-
|
|
|
-
|
|
|
-// File: expression.h lines: 173-173
|
|
|
-// boost::scoped_ptr<TagData> _tagData;
|
|
|
-
|
|
|
-proto._tagData = undefined;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-/**
|
|
|
- *
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
- * @method MatchExpression
|
|
|
- * @param
|
|
|
- *
|
|
|
- */
|
|
|
-proto.MatchExpression = function MatchExpression( /* MatchType type */ ){
|
|
|
-
|
|
|
-// File: expression.cpp lines: 28-28
|
|
|
-// MatchExpression::MatchExpression( MatchType type )
|
|
|
-// : _matchType( type ) { }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
*
|
|
|
* This documentation was automatically generated. Please update when you touch this function.
|
|
|
@@ -60,17 +26,10 @@ proto.MatchExpression = function MatchExpression( /* MatchType type */ ){
|
|
|
* @param
|
|
|
*
|
|
|
*/
|
|
|
-proto._debugAddSpace = function _debugAddSpace( /* StringBuilder& debug, int level */ ){
|
|
|
-
|
|
|
+proto._debugAddSpace = function _debugAddSpace( level ){ // StringBuilder& debug, int level
|
|
|
// File: expression.cpp lines: 37-39
|
|
|
-// void MatchExpression::_debugAddSpace( StringBuilder& debug, int level ) const {
|
|
|
-// for ( int i = 0; i < level; i++ )
|
|
|
-// debug << " ";
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ return new Array( level + 1).join(" ");
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -80,14 +39,11 @@ proto._debugAddSpace = function _debugAddSpace( /* StringBuilder& debug, int le
|
|
|
* @param
|
|
|
*
|
|
|
*/
|
|
|
-proto.getChild = function getChild( /* size_t i */ ){
|
|
|
+proto.getChild = function getChild( ) {// size_t i
|
|
|
// File: expression.h lines: 78-77
|
|
|
-// virtual const MatchExpression* getChild( size_t i ) const { return NULL; }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ throw new Error('Virtual function called.');
|
|
|
+ // return undefined;
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -97,14 +53,10 @@ proto.getChild = function getChild( /* size_t i */ ){
|
|
|
* @param
|
|
|
*
|
|
|
*/
|
|
|
-proto.getTag = function getTag( /* */ ){
|
|
|
+proto.getTag = function getTag( ){
|
|
|
// File: expression.h lines: 159-158
|
|
|
-// TagData* getTag() const { return _tagData.get(); }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ return this._tagData.get();
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -116,15 +68,20 @@ proto.getTag = function getTag( /* */ ){
|
|
|
*/
|
|
|
proto.isArray = function isArray( /* */ ){
|
|
|
// File: expression.h lines: 111-113
|
|
|
-// bool isArray() const {
|
|
|
-// return SIZE == _matchType || ALL == _matchType || ELEM_MATCH_VALUE == _matchType
|
|
|
-// || ELEM_MATCH_OBJECT == _matchType;
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ switch (this._matchType){
|
|
|
+ case 'SIZE':
|
|
|
+ case 'ALL':
|
|
|
+ case 'ELEM_MATCH_VALUE':
|
|
|
+ case 'ELEM_MATCH_OBJECT':
|
|
|
+ return true;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -136,14 +93,8 @@ proto.isArray = function isArray( /* */ ){
|
|
|
*/
|
|
|
proto.isLeaf = function isLeaf( /* */ ){
|
|
|
// File: expression.h lines: 124-125
|
|
|
-// bool isLeaf() const {
|
|
|
-// return !isArray() && !isLogical();
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ return !isArray() && !isLogical();
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -155,14 +106,17 @@ proto.isLeaf = function isLeaf( /* */ ){
|
|
|
*/
|
|
|
proto.isLogical = function isLogical( /* */ ){
|
|
|
// File: expression.h lines: 100-101
|
|
|
-// bool isLogical() const {
|
|
|
-// return AND == _matchType || OR == _matchType || NOT == _matchType || NOR == _matchType;
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ switch( this._matchType ){
|
|
|
+ case 'AND':
|
|
|
+ case 'OR':
|
|
|
+ case 'NOT':
|
|
|
+ case 'NOR':
|
|
|
+ return true;
|
|
|
+ default:
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -174,12 +128,8 @@ proto.isLogical = function isLogical( /* */ ){
|
|
|
*/
|
|
|
proto.matchType = function matchType( /* */ ){
|
|
|
// File: expression.h lines: 67-66
|
|
|
-// MatchType matchType() const { return _matchType; }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ return this._matchType;
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -189,17 +139,15 @@ proto.matchType = function matchType( /* */ ){
|
|
|
* @param
|
|
|
*
|
|
|
*/
|
|
|
-proto.matchesBSON = function matchesBSON( /* const BSONObj& doc, MatchDetails* details */ ){
|
|
|
+proto.matchesBSON = function matchesBSON( doc,detail ){ // const BSONObj& doc, MatchDetails* details
|
|
|
|
|
|
// File: expression.cpp lines: 42-44
|
|
|
// bool MatchExpression::matchesBSON( const BSONObj& doc, MatchDetails* details ) const {
|
|
|
// BSONMatchableDocument mydoc( doc );
|
|
|
// return matches( &mydoc, details );
|
|
|
// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ return matches(new MatchableDocument(doc),details);
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -211,12 +159,8 @@ proto.matchesBSON = function matchesBSON( /* const BSONObj& doc, MatchDetails*
|
|
|
*/
|
|
|
proto.numChildren = function numChildren( /* */ ){
|
|
|
// File: expression.h lines: 73-72
|
|
|
-// virtual size_t numChildren() const { return 0; }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ return 0;
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -229,11 +173,8 @@ proto.numChildren = function numChildren( /* */ ){
|
|
|
proto.path = function path( /* */ ){
|
|
|
// File: expression.h lines: 83-82
|
|
|
// virtual const StringData path() const { return StringData(); }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ return '';
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -246,11 +187,8 @@ proto.path = function path( /* */ ){
|
|
|
proto.setTag = function setTag( /* TagData* data */ ){
|
|
|
// File: expression.h lines: 158-157
|
|
|
// void setTag(TagData* data) { _tagData.reset(data); }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+ this._tagData.reset(data);
|
|
|
+};
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -269,23 +207,23 @@ proto.toString = function toString( /* */ ){
|
|
|
// return buf.str();
|
|
|
// }
|
|
|
|
|
|
+ return this.debugString();
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
-/**
|
|
|
- *
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
- * @method ~MatchExpression
|
|
|
- * @param
|
|
|
- *
|
|
|
- */
|
|
|
-proto.~MatchExpression = function ~MatchExpression( /* */ ){
|
|
|
-// File: expression.h lines: 58-57
|
|
|
-// virtual ~MatchExpression(){}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-}
|