RegexMatchExpression.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. "use strict";
  2. var LeafMatchExpression = require('./LeafMatchExpression');
  3. // Autogenerated by cport.py on 2013-09-17 14:37
  4. var RegexMatchExpression = module.exports = function RegexMatchExpression(){
  5. this._matchType = 'REGEX';
  6. }, klass = RegexMatchExpression, base = LeafMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
  7. // File: expression_leaf.h lines: 160-160
  8. // static const size_t MaxPatternSize = 32764;
  9. klass.MaxPatternSize = 32764;
  10. // File: expression_leaf.h lines: 184-184
  11. // std::string _flags;
  12. proto._flags = undefined;
  13. // File: expression_leaf.h lines: 185-185
  14. // boost::scoped_ptr<pcrecpp::RE> _re;
  15. proto._re = undefined;
  16. // File: expression_leaf.h lines: 183-183
  17. // std::string _regex;
  18. proto._regex = undefined;
  19. /**
  20. *
  21. * This documentation was automatically generated. Please update when you touch this function.
  22. * @method debugString
  23. * @param
  24. *
  25. */
  26. proto.debugString = function debugString( level ) { // StringBuilder& debug, int level
  27. // File: expression_leaf.cpp lines: 225-234
  28. return this._debugAddSpace( level ) + this.path() + " regex /" + this._regex + "/" + this._flags + (this.getTags() ? ' ' + this.getTags().debugString : '') + "\n";
  29. };
  30. /**
  31. *
  32. * This documentation was automatically generated. Please update when you touch this function.
  33. * @method equivalent
  34. * @param
  35. *
  36. */
  37. proto.equivalent = function equivalent( other ) { // const MatchExpression* other
  38. // File: expression_leaf.cpp lines: 177-185
  39. return other._matchType == 'REGEX' && this.path() == other.path() && this._regex == other._regex && this._flags == other._flags;
  40. };
  41. /**
  42. *
  43. * This documentation was automatically generated. Please update when you touch this function.
  44. * @method getFlags
  45. * @param
  46. *
  47. */
  48. proto.getFlags = function getFlags( /* */ ){
  49. // File: expression_leaf.h lines: 180-179
  50. return this._flags;
  51. };
  52. /**
  53. *
  54. * This documentation was automatically generated. Please update when you touch this function.
  55. * @method getString
  56. * @param
  57. *
  58. */
  59. proto.getString = function getString( /* */ ){
  60. // File: expression_leaf.h lines: 179-178
  61. return this._regex;
  62. };
  63. /**
  64. *
  65. * This documentation was automatically generated. Please update when you touch this function.
  66. * @method init
  67. * @param
  68. *
  69. */
  70. proto.init = function init( path,regex,flags ) { // const StringData& path, const StringData& regex, const StringData& options
  71. // File: expression_leaf.cpp lines: 196-205
  72. if(regex.length > klass.MaxPatternSize){
  73. return {'code':'BAD_VALUE', 'desc':'Regular Expression too long.'};
  74. }
  75. this._regex = regex;
  76. this._flags = flags;
  77. this._re = new RegExp(regex,flags);
  78. return this.initPath( path );
  79. };
  80. /**
  81. *
  82. * This documentation was automatically generated. Please update when you touch this function.
  83. * @method matchesSingleElement
  84. * @param
  85. *
  86. */
  87. proto.matchesSingleElement = function matchesSingleElement( e ) { // const BSONElement& e
  88. // File: expression_leaf.cpp lines: 208-222
  89. return (e.match) && e.match(this._re);
  90. // No support for SYMBOLS currently
  91. };
  92. /**
  93. *
  94. * This documentation was automatically generated. Please update when you touch this function.
  95. * @method shallowClone
  96. * @param
  97. *
  98. */
  99. proto.shallowClone = function shallowClone( /* */ ){
  100. // File: expression_leaf.h lines: 167-170
  101. var e = new RegexMatchExpression();
  102. e.init( this.path(), this._regex, this._flags );
  103. return e;
  104. };