MatchExpression.js 4.4 KB

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