|
@@ -1,17 +1,11 @@
|
|
|
-"use strict"
|
|
|
|
|
-
|
|
|
|
|
|
|
+"use strict";
|
|
|
|
|
|
|
|
|
|
+var LeafMatchExpression = require('./LeafMatchExpression');
|
|
|
|
|
|
|
|
// Autogenerated by cport.py on 2013-09-17 14:37
|
|
// Autogenerated by cport.py on 2013-09-17 14:37
|
|
|
-var InMatchExpression = module.exports = function (){
|
|
|
|
|
-
|
|
|
|
|
-}, klass = InMatchExpression, base = Object , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// File: expression_leaf.h lines: 294-294
|
|
|
|
|
-// ArrayFilterEntries _arrayEntries;
|
|
|
|
|
-
|
|
|
|
|
-proto._arrayEntries = undefined;
|
|
|
|
|
|
|
+var InMatchExpression = module.exports = function InMatchExpression(){
|
|
|
|
|
+ this._matchType = 'MATCH_IN';
|
|
|
|
|
+}, klass = InMatchExpression, base = LeafMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
|
|
|
|
|
|
|
|
|
|
|
|
|
// File: expression_leaf.h lines: 294-294
|
|
// File: expression_leaf.h lines: 294-294
|
|
@@ -19,27 +13,6 @@ proto._arrayEntries = undefined;
|
|
|
|
|
|
|
|
proto._arrayEntries = undefined;
|
|
proto._arrayEntries = undefined;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- *
|
|
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
|
|
- * @method InMatchExpression
|
|
|
|
|
- * @param
|
|
|
|
|
- *
|
|
|
|
|
- */
|
|
|
|
|
-proto.InMatchExpression = function InMatchExpression( /* MATCH_IN */ ){
|
|
|
|
|
-// File: expression_leaf.h lines: 275-274
|
|
|
|
|
-// InMatchExpression() : LeafMatchExpression( MATCH_IN ){}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
|
* This documentation was automatically generated. Please update when you touch this function.
|
|
* This documentation was automatically generated. Please update when you touch this function.
|
|
@@ -47,24 +20,19 @@ proto.InMatchExpression = function InMatchExpression( /* MATCH_IN */ ){
|
|
|
* @param
|
|
* @param
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
-proto._matchesRealElement = function _matchesRealElement( /* const BSONElement& e */ ){
|
|
|
|
|
-
|
|
|
|
|
|
|
+proto._matchesRealElement = function _matchesRealElement( e ) { // const BSONElement& e
|
|
|
// File: expression_leaf.cpp lines: 422-431
|
|
// File: expression_leaf.cpp lines: 422-431
|
|
|
-// bool InMatchExpression::_matchesRealElement( const BSONElement& e ) const {
|
|
|
|
|
-// if ( _arrayEntries.contains( e ) )
|
|
|
|
|
-// return true;
|
|
|
|
|
-//
|
|
|
|
|
-// for ( unsigned i = 0; i < _arrayEntries.numRegexes(); i++ ) {
|
|
|
|
|
-// if ( _arrayEntries.regex(i)->matchesSingleElement( e ) )
|
|
|
|
|
-// return true;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// return false;
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ if( e in this._arrayEntries ) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ for (var i = 0; i < this._arrayEntries.numRegexes(); i++) {
|
|
|
|
|
+ if(e.match && e.match(this._arrayEntries.regex(i))) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -74,17 +42,11 @@ proto._matchesRealElement = function _matchesRealElement( /* const BSONElement&
|
|
|
* @param
|
|
* @param
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
-proto.copyTo = function copyTo( /* InMatchExpression* toFillIn */ ){
|
|
|
|
|
-
|
|
|
|
|
|
|
+proto.copyTo = function copyTo( toFillIn ) { // InMatchExpression* toFillIn
|
|
|
// File: expression_leaf.cpp lines: 481-483
|
|
// File: expression_leaf.cpp lines: 481-483
|
|
|
-// void InMatchExpression::copyTo( InMatchExpression* toFillIn ) const {
|
|
|
|
|
-// toFillIn->init( path() );
|
|
|
|
|
-// _arrayEntries.copyTo( toFillIn->_arrayEntries );
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ toFillIn.init(this.path());
|
|
|
|
|
+ this._arrayEntries.copyTo( toFillIn._arrayEntries );
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -94,23 +56,10 @@ proto.copyTo = function copyTo( /* InMatchExpression* toFillIn */ ){
|
|
|
* @param
|
|
* @param
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
-proto.debugString = function debugString( /* StringBuilder& debug, int level */ ){
|
|
|
|
|
-
|
|
|
|
|
|
|
+proto.debugString = function debugString( level ) { // StringBuilder& debug, int level
|
|
|
// File: expression_leaf.cpp lines: 455-463
|
|
// File: expression_leaf.cpp lines: 455-463
|
|
|
-// void InMatchExpression::debugString( StringBuilder& debug, int level ) const {
|
|
|
|
|
-// _debugAddSpace( debug, level );
|
|
|
|
|
-// debug << path() << ";$in: TODO ";
|
|
|
|
|
-// MatchExpression::TagData* td = getTag();
|
|
|
|
|
-// if (NULL != td) {
|
|
|
|
|
-// debug << " ";
|
|
|
|
|
-// td->debugString(&debug);
|
|
|
|
|
-// }
|
|
|
|
|
-// debug << "\n";
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ return this._debugAddSpace( level ) + this.path() + ";$in: TODO " + (this.getTag() ? this.getTag().debugString() : '') + "\n";
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -120,21 +69,13 @@ proto.debugString = function debugString( /* StringBuilder& debug, int level *
|
|
|
* @param
|
|
* @param
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
-proto.equivalent = function equivalent( /* const MatchExpression* other */ ){
|
|
|
|
|
-
|
|
|
|
|
|
|
+proto.equivalent = function equivalent( other ) { // const MatchExpression* other
|
|
|
// File: expression_leaf.cpp lines: 466-472
|
|
// File: expression_leaf.cpp lines: 466-472
|
|
|
-// bool InMatchExpression::equivalent( const MatchExpression* other ) const {
|
|
|
|
|
-// if ( matchType() != other->matchType() )
|
|
|
|
|
-// return false;
|
|
|
|
|
-// const InMatchExpression* realOther = static_cast<const InMatchExpression*>( other );
|
|
|
|
|
-// return
|
|
|
|
|
-// path() == realOther->path() &&
|
|
|
|
|
-// _arrayEntries.equivalent( realOther->_arrayEntries );
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ if ( other._matchType != 'MATCH_IN' ) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return this.path() == other.path() && this._arrayEntries.equivalent( other._arrayEntries );
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -146,12 +87,8 @@ proto.equivalent = function equivalent( /* const MatchExpression* other */ ){
|
|
|
*/
|
|
*/
|
|
|
proto.getArrayFilterEntries = function getArrayFilterEntries( /* */ ){
|
|
proto.getArrayFilterEntries = function getArrayFilterEntries( /* */ ){
|
|
|
// File: expression_leaf.h lines: 280-279
|
|
// File: expression_leaf.h lines: 280-279
|
|
|
-// ArrayFilterEntries* getArrayFilterEntries() { return &_arrayEntries; }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ return this._arrayEntries;
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -163,12 +100,8 @@ proto.getArrayFilterEntries = function getArrayFilterEntries( /* */ ){
|
|
|
*/
|
|
*/
|
|
|
proto.getData = function getData( /* */ ){
|
|
proto.getData = function getData( /* */ ){
|
|
|
// File: expression_leaf.h lines: 290-289
|
|
// File: expression_leaf.h lines: 290-289
|
|
|
-// const ArrayFilterEntries& getData() const { return _arrayEntries; }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ return this._arrayEntries;
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -178,16 +111,10 @@ proto.getData = function getData( /* */ ){
|
|
|
* @param
|
|
* @param
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
-proto.init = function init( /* const StringData& path */ ){
|
|
|
|
|
-
|
|
|
|
|
|
|
+proto.init = function init( path ) { // const StringData& path
|
|
|
// File: expression_leaf.cpp lines: 418-419
|
|
// File: expression_leaf.cpp lines: 418-419
|
|
|
-// Status InMatchExpression::init( const StringData& path ) {
|
|
|
|
|
-// return initPath( path );
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ return this.initPath( path );
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -197,33 +124,24 @@ proto.init = function init( /* const StringData& path */ ){
|
|
|
* @param
|
|
* @param
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
-proto.matchesSingleElement = function matchesSingleElement( /* const BSONElement& e */ ){
|
|
|
|
|
-
|
|
|
|
|
|
|
+proto.matchesSingleElement = function matchesSingleElement( e ) { // const BSONElement& e
|
|
|
// File: expression_leaf.cpp lines: 434-452
|
|
// File: expression_leaf.cpp lines: 434-452
|
|
|
-// bool InMatchExpression::matchesSingleElement( const BSONElement& e ) const {
|
|
|
|
|
-// if ( _arrayEntries.hasNull() && e.eoo() )
|
|
|
|
|
-// return true;
|
|
|
|
|
-//
|
|
|
|
|
-// if ( _matchesRealElement( e ) )
|
|
|
|
|
-// return true;
|
|
|
|
|
-//
|
|
|
|
|
-// /*
|
|
|
|
|
-// if ( e.type() == Array ) {
|
|
|
|
|
-// BSONObjIterator i( e.Obj() );
|
|
|
|
|
-// while ( i.more() ) {
|
|
|
|
|
-// BSONElement sub = i.next();
|
|
|
|
|
-// if ( _matchesRealElement( sub ) )
|
|
|
|
|
-// return true;
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// */
|
|
|
|
|
-//
|
|
|
|
|
-// return false;
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ if( this._arrayEntries === null && typeof(e) == 'object' && Object.keys(e).length === 0) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this._matchesRealElement( e )) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (e instanceof Array){
|
|
|
|
|
+ for (var i = 0; i < e.length; i++) {
|
|
|
|
|
+ if(this._matchesRealElement( e[i] )) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -234,14 +152,9 @@ proto.matchesSingleElement = function matchesSingleElement( /* const BSONElemen
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
proto.shallowClone = function shallowClone( /* */ ){
|
|
proto.shallowClone = function shallowClone( /* */ ){
|
|
|
-
|
|
|
|
|
// File: expression_leaf.cpp lines: 475-478
|
|
// File: expression_leaf.cpp lines: 475-478
|
|
|
-// LeafMatchExpression* InMatchExpression::shallowClone() const {
|
|
|
|
|
-// InMatchExpression* next = new InMatchExpression();
|
|
|
|
|
-// copyTo( next );
|
|
|
|
|
-// return next;
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ var e = new InMatchExpression();
|
|
|
|
|
+ this.copyTo( e );
|
|
|
|
|
+ return e;
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
-}
|
|
|