Ejemplo n.º 1
0
        public BSONRegularExpression(string pattern, BSONRegularExpressionOptions options)
        {
            if (pattern == null)
            {
                throw new BSONException(StringConsts.ARGUMENT_ERROR + "BSONRegularExpression.ctor(pattern==null)");
            }

            Pattern = pattern;
            Options = options;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns BSON-formatted string for regeax options
        /// (The options are identified by lower-case characters, which must be stored in alphabetical order).
        /// </summary>
        public static string ToBSONString(this BSONRegularExpressionOptions options)
        {
            string result = string.Empty;

            for (int i = 0; i < _values.Length; i++)
            {
                if ((options & _values[i]) != 0)
                {
                    result += _values[i];
                }
            }

            return(result.ToLower());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns regex options count
        /// </summary>
        public static byte Count(this BSONRegularExpressionOptions options)
        {
            byte result = 0;

            for (int i = 0; i < _values.Length; i++)
            {
                if ((options & _values[i]) != 0)
                {
                    result += 1;
                }
            }

            return(result);
        }
Ejemplo n.º 4
0
        public BSONRegularExpression(string pattern, BSONRegularExpressionOptions options)
        {
            if (pattern==null)
             throw new BSONException(StringConsts.ARGUMENT_ERROR+"BSONRegularExpression.ctor(pattern==null)");

              Pattern = pattern;
              Options = options;
        }