MatchExpression.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. "use strict";
  2. // Autogenerated by cport.py on 2013-09-17 14:37
  3. var MatchExpression = module.exports = function MatchExpression( type ){
  4. this._matchType = type;
  5. }, klass = MatchExpression, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
  6. // DEPENDENCIES
  7. var errors = require("../../Errors.js"),
  8. ErrorCodes = errors.ErrorCodes;
  9. // File: expression.h lines: 172-172
  10. // MatchType _matchType;
  11. proto._matchType = undefined;
  12. // File: expression.h lines: 173-173
  13. // boost::scoped_ptr<TagData> _tagData;
  14. proto._tagData = undefined;
  15. /**
  16. *
  17. * This documentation was automatically generated. Please update when you touch this function.
  18. * @method _debugAddSpace
  19. * @param
  20. *
  21. */
  22. proto._debugAddSpace = function _debugAddSpace( level ){ // StringBuilder& debug, int level
  23. // File: expression.cpp lines: 37-39
  24. return new Array( level + 1).join(" ");
  25. };
  26. /**
  27. *
  28. * This documentation was automatically generated. Please update when you touch this function.
  29. * @method getChild
  30. * @param
  31. *
  32. */
  33. proto.getChild = function getChild( ) {// size_t i
  34. // File: expression.h lines: 78-77
  35. throw new Error('Virtual function called.');
  36. // return undefined;
  37. };
  38. /**
  39. *
  40. * This documentation was automatically generated. Please update when you touch this function.
  41. * @method getTag
  42. * @param
  43. *
  44. */
  45. proto.getTag = function getTag( ){
  46. // File: expression.h lines: 159-158
  47. return this._tagData;
  48. };
  49. /**
  50. *
  51. * This documentation was automatically generated. Please update when you touch this function.
  52. * @method isArray
  53. * @param
  54. *
  55. */
  56. proto.isArray = function isArray( /* */ ){
  57. // File: expression.h lines: 111-113
  58. switch (this._matchType){
  59. case 'SIZE':
  60. case 'ALL':
  61. case 'ELEM_MATCH_VALUE':
  62. case 'ELEM_MATCH_OBJECT':
  63. return true;
  64. break;
  65. default:
  66. return false;
  67. break;
  68. }
  69. return false;
  70. };
  71. /**
  72. *
  73. * This documentation was automatically generated. Please update when you touch this function.
  74. * @method isLeaf
  75. * @param
  76. *
  77. */
  78. proto.isLeaf = function isLeaf( /* */ ){
  79. // File: expression.h lines: 124-125
  80. return !isArray() && !isLogical();
  81. };
  82. /**
  83. *
  84. * This documentation was automatically generated. Please update when you touch this function.
  85. * @method isLogical
  86. * @param
  87. *
  88. */
  89. proto.isLogical = function isLogical( /* */ ){
  90. // File: expression.h lines: 100-101
  91. switch( this._matchType ){
  92. case 'AND':
  93. case 'OR':
  94. case 'NOT':
  95. case 'NOR':
  96. return true;
  97. default:
  98. return false;
  99. }
  100. return false;
  101. };
  102. /**
  103. *
  104. * This documentation was automatically generated. Please update when you touch this function.
  105. * @method matchType
  106. * @param
  107. *
  108. */
  109. proto.matchType = function matchType( /* */ ){
  110. // File: expression.h lines: 67-66
  111. return this._matchType;
  112. };
  113. /**
  114. *
  115. * This documentation was automatically generated. Please update when you touch this function.
  116. * @method matchesBSON
  117. * @param
  118. *
  119. */
  120. proto.matchesBSON = function matchesBSON(doc, details){ // const BSONObj& doc, MatchDetails* details
  121. // File: expression.cpp lines: 42-44
  122. // bool MatchExpression::matchesBSON( const BSONObj& doc, MatchDetails* details ) const {
  123. // BSONMatchableDocument mydoc( doc );
  124. // return matches( &mydoc, details );
  125. // }
  126. return this.matches(doc, details);
  127. };
  128. /**
  129. *
  130. * This documentation was automatically generated. Please update when you touch this function.
  131. * @method numChildren
  132. * @param
  133. *
  134. */
  135. proto.numChildren = function numChildren( /* */ ){
  136. // File: expression.h lines: 73-72
  137. return 0;
  138. };
  139. /**
  140. *
  141. * This documentation was automatically generated. Please update when you touch this function.
  142. * @method path
  143. * @param
  144. *
  145. */
  146. proto.path = function path( /* */ ){
  147. // File: expression.h lines: 83-82
  148. // virtual const StringData path() const { return StringData(); }
  149. return '';
  150. };
  151. /**
  152. *
  153. * This documentation was automatically generated. Please update when you touch this function.
  154. * @method setTag
  155. * @param
  156. *
  157. */
  158. proto.setTag = function setTag( /* TagData* data */ ){
  159. // File: expression.h lines: 158-157
  160. // void setTag(TagData* data) { _tagData.reset(data); }
  161. this._tagData.reset(data);
  162. };
  163. /**
  164. *
  165. * This documentation was automatically generated. Please update when you touch this function.
  166. * @method toString
  167. * @param
  168. *
  169. */
  170. proto.toString = function toString( /* */ ){
  171. // File: expression.cpp lines: 31-34
  172. // string MatchExpression::toString() const {
  173. // StringBuilder buf;
  174. // debugString( buf, 0 );
  175. // return buf.str();
  176. // }
  177. return this.debugString( 0 );
  178. };