| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- "use strict";
- var MatchExpression = require('./MatchExpression');
- var ElementPath = require('./ElementPath');
- // Autogenerated by cport.py on 2013-09-17 14:37
- var LeafMatchExpression = module.exports = function LeafMatchExpression( type ){
- this._matchType = type;
- this._elementPath = new ElementPath();
- }, klass = LeafMatchExpression, base = MatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
- // File: expression_leaf.h lines: 63-63
- // ElementPath _elementPath;
- proto._elementPath = undefined;
- // File: expression_leaf.h lines: 62-62
- // StringData _path;
- proto._path = undefined;
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method initPath
- * @param
- *
- */
- proto.initPath = function initPath( path ) { // const StringData& path
- // File: expression_leaf.cpp lines: 31-33
- this._path = path;
- if(this._elementPath === undefined){
- this._elementPath = new ElementPath();
- }
- return this._elementPath.init( this._path );
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method matches
- * @param
- *
- */
- proto.matches = function matches( doc, details ) { // const MatchableDocument* doc, MatchDetails* details
- // File: expression_leaf.cpp lines: 37-48
- var tDoc = ElementPath.objAtPath( doc, this._path );
- if(typeof(tDoc) != 'object') {
- return this.matchesSingleElement(tDoc);
- }
- var docKeys = Object.keys(tDoc);
- for(var i = 0;i < docKeys.length; i++ ) {
- if(!this.matchesSingleElement( tDoc[docKeys[i]] ))
- continue;
- if( details && details.needRecord() && (tDoc instanceof Array) && i < docKeys.length-1 ) {
- details.setElemMatchKey( docKeys[i+1] );
- }
- return true;
- }
- return false;
- };
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method path
- * @param
- *
- */
- proto.path = function path( /* */ ){
- // File: expression_leaf.h lines: 56-55
- return this._path;
- };
|