BsonRegexp class
class BsonRegexp extends BsonObject{ String pattern; String options; BsonCString bsonPattern; BsonCString bsonOptions; bool multiLine; bool caseInsensitive; bool verbose; bool dotAll; bool extended; BsonRegexp(this.pattern,{this.multiLine: false,this.caseInsensitive: false,this.dotAll: false,this.extended: false,this.options: ''}){ createOptionsString(); bsonPattern = new BsonCString(pattern,false); bsonOptions = new BsonCString(options,false); } get value=>this; int get typeByte => _BSON_DATA_REGEXP; byteLength()=>bsonPattern.byteLength()+bsonOptions.byteLength(); unpackValue(BsonBinary buffer){ pattern = buffer.readCString(); options = buffer.readCString(); bsonPattern = new BsonCString(pattern,false); bsonOptions = new BsonCString(options,false); } createOptionsString(){ if (options != '') { return; } var buffer = new StringBuffer(); if (caseInsensitive == true){ buffer.write("i"); } if (multiLine == true){ buffer.write("m"); } if (dotAll == true){ buffer.write("s"); } if (extended == true){ buffer.write("x"); } options = buffer.toString(); } toString()=>"BsonRegexp('$pattern',options:'$options')"; packValue(BsonBinary buffer){ bsonPattern.packValue(buffer); bsonOptions.packValue(buffer); } toJson() => {'\$regex': pattern,'\$oid': options}; }
Extends
BsonObject > BsonRegexp
Constructors
new BsonRegexp(String pattern, {bool multiLine: false, bool caseInsensitive: false, bool dotAll: false, bool extended: false, String options: ''}) #
Creates a new Object instance.
Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.
docs inherited from Object
BsonRegexp(this.pattern,{this.multiLine: false,this.caseInsensitive: false,this.dotAll: false,this.extended: false,this.options: ''}){ createOptionsString(); bsonPattern = new BsonCString(pattern,false); bsonOptions = new BsonCString(options,false); }
Properties
BsonCString bsonOptions #
BsonCString bsonOptions
BsonCString bsonPattern #
BsonCString bsonPattern
final value #
get value=>this;
Methods
dynamic byteLength() #
byteLength()=>bsonPattern.byteLength()+bsonOptions.byteLength();
dynamic createOptionsString() #
createOptionsString(){ if (options != '') { return; } var buffer = new StringBuffer(); if (caseInsensitive == true){ buffer.write("i"); } if (multiLine == true){ buffer.write("m"); } if (dotAll == true){ buffer.write("s"); } if (extended == true){ buffer.write("x"); } options = buffer.toString(); }
dynamic packElement(String name, buffer) #
inherited from BsonObject
packElement(String name, var buffer){ buffer.writeByte(typeByte); if (name != null){ new BsonCString(name).packValue(buffer); } packValue(buffer); }
dynamic packValue(BsonBinary buffer) #
packValue(BsonBinary buffer){ bsonPattern.packValue(buffer); bsonOptions.packValue(buffer); }
dynamic toJson() #
toJson() => {'\$regex': pattern,'\$oid': options};
dynamic toString() #
Returns a string representation of this object.
docs inherited from Object
toString()=>"BsonRegexp('$pattern',options:'$options')";
_ElementPair unpackElement(buffer) #
inherited from BsonObject
_ElementPair unpackElement(buffer){ _ElementPair result = new _ElementPair(); result.name = buffer.readCString(); unpackValue(buffer); result.value = value; return result; }
dynamic unpackValue(BsonBinary buffer) #
unpackValue(BsonBinary buffer){ pattern = buffer.readCString(); options = buffer.readCString(); bsonPattern = new BsonCString(pattern,false); bsonOptions = new BsonCString(options,false); }