mongo-dart / lib / bson / bson_regexp.dart

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]):options=""{
    createOptionsString();    
    bsonPattern = new BsonCString(pattern,false);
    bsonOptions = new BsonCString(options,false);
  }
  
  get value()=>this;
  int get typeByte() => BSON.BSON_DATA_REGEXP;  
  byteLength()=>bsonPattern.byteLength()+bsonOptions.byteLength();
  unpackValue(Binary buffer){
    pattern = buffer.readCString();
    options = buffer.readCString();     
  }   
  createOptionsString(){
    var buffer = new StringBuffer();
    if (caseInsensitive === true){
      buffer.add("i");
    }
    if (multiLine === true){
      buffer.add("m");
    }    
    if (dotAll === true){
      buffer.add("s");
    }    
    if (extended === true){
      buffer.add("x");
    }    
    options = buffer.toString();
  }
  toString()=>"BsonRegexp('$pattern',options:'$options')";
  packValue(Binary buffer){     
     bsonPattern.packValue(buffer);
     bsonOptions.packValue(buffer);
  }  
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.