/// <summary>
 /// Creates a proper FCL factory for given numer formatting parsing.
 /// </summary>
 internal static IObjectFactory Create(JSonReaderNumberFormat format)
 {
     switch(format)
     {
         case JSonReaderNumberFormat.Default:
             return new JSonObjectFactory();
         case JSonReaderNumberFormat.AsInt32:
             return new JSonObjectInt32Factory();
         case JSonReaderNumberFormat.AsInt64:
             return new JSonObjectInt64Factory();
         case JSonReaderNumberFormat.AsDouble:
             return new JSonObjectDoubleFactory();
         case JSonReaderNumberFormat.AsDecimal:
             return new JSonObjectDecimalFactory();
         default:
             throw new ArgumentOutOfRangeException("format", string.Concat("Unsupported number reading format (", format, ")"));
     }
 }
Example #2
0
        /// <summary>
        /// Creates a proper FCL factory for given numer formatting parsing.
        /// </summary>
        internal static IObjectFactory Create(JSonReaderNumberFormat format)
        {
            switch (format)
            {
            case JSonReaderNumberFormat.Default:
                return(new JSonObjectFactory());

            case JSonReaderNumberFormat.AsInt32:
                return(new JSonObjectInt32Factory());

            case JSonReaderNumberFormat.AsInt64:
                return(new JSonObjectInt64Factory());

            case JSonReaderNumberFormat.AsDouble:
                return(new JSonObjectDoubleFactory());

            case JSonReaderNumberFormat.AsDecimal:
                return(new JSonObjectDecimalFactory());

            default:
                throw new ArgumentOutOfRangeException("format", string.Concat("Unsupported number reading format (", format, ")"));
            }
        }
Example #3
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of JSON-specific objects.
 /// It then allows easier deserialization for objects implementing <see cref="IJSonMutableObject"/> interface as those objects expose
 /// more functionality then the standard .NET ones.
 /// </summary>
 public IJSonMutableObject ReadAsJSonMutableObject(JSonReaderNumberFormat format)
 {
     // numerical formats are ignored as the BSON-spec defines them clearly:
     return ReadAsJSonMutableObject();
 }
Example #4
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of .NET arrays, dictionaries, strings and decimals.
 /// </summary>
 public object Read(JSonReaderNumberFormat format)
 {
     // numerical formats are ignored as the BSON-spec defines them clearly:
     return Read();
 }
Example #5
0
 protected JSonObjectFactory(JSonReaderNumberFormat format)
 {
     Format = format;
 }
 protected JSonObjectFactory(JSonReaderNumberFormat format)
 {
     Format = format;
 }
Example #7
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of JSON-specific objects.
 /// It then allows easier deserialization for objects implementing <see cref="IJSonMutableObject"/> interface as those objects expose
 /// more functionality then the standard .NET ones.
 /// </summary>
 public IJSonMutableObject ReadAsJSonMutableObject(TextReader input, JSonReaderNumberFormat format)
 {
     SetSource(input);
     Reset(JSonMutableObjectFactory.Create(format));
     return ReadInput() as IJSonMutableObject;
 }
Example #8
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of .NET arrays, dictionaries, strings and decimals.
 /// </summary>
 public object Read(TextReader input, JSonReaderNumberFormat format)
 {
     SetSource(input);
     Reset(FclObjectFactory.Create(format));
     return ReadInput();
 }
Example #9
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of JSON-specific objects.
 /// It then allows easier deserialization for objects implementing <see cref="IJSonMutableObject"/> interface as those objects expose
 /// more functionality then the standard .NET ones.
 /// </summary>
 public IJSonMutableObject ReadAsJSonMutableObject(JSonReaderNumberFormat format)
 {
     Reset(JSonMutableObjectFactory.Create(format));
     return ReadInput() as IJSonMutableObject;
 }
Example #10
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of JSON-specific objects.
 /// It then allows easier deserialization for objects implementing <see cref="IJSonMutableObject"/> interface as those objects expose
 /// more functionality then the standard .NET ones.
 /// </summary>
 public IJSonMutableObject ReadAsJSonMutableObject(TextReader input, JSonReaderNumberFormat format)
 {
     SetSource(input);
     Reset(JSonMutableObjectFactory.Create(format));
     return(ReadInput() as IJSonMutableObject);
 }
Example #11
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of .NET arrays, dictionaries, strings and decimals.
 /// </summary>
 public object Read(JSonReaderNumberFormat format)
 {
     Reset(FclObjectFactory.Create(format));
     return ReadInput();
 }
Example #12
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of JSON-specific objects.
 /// It then allows easier deserialization for objects implementing <see cref="IJSonMutableObject"/> interface as those objects expose
 /// more functionality then the standard .NET ones.
 /// </summary>
 public IJSonMutableObject ReadAsJSonMutableObject(JSonReaderNumberFormat format)
 {
     Reset(JSonMutableObjectFactory.Create(format));
     return(ReadInput() as IJSonMutableObject);
 }
Example #13
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of .NET arrays, dictionaries, strings and decimals.
 /// </summary>
 public object Read(TextReader input, JSonReaderNumberFormat format)
 {
     SetSource(input);
     Reset(FclObjectFactory.Create(format));
     return(ReadInput());
 }
Example #14
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of .NET arrays, dictionaries, strings and decimals.
 /// </summary>
 public object Read(JSonReaderNumberFormat format)
 {
     Reset(FclObjectFactory.Create(format));
     return(ReadInput());
 }
Example #15
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of JSON-specific objects.
 /// It then allows easier deserialization for objects implementing <see cref="IJSonMutableObject"/> interface as those objects expose
 /// more functionality then the standard .NET ones.
 /// </summary>
 public IJSonMutableObject ReadAsJSonMutableObject(JSonReaderNumberFormat format)
 {
     // numerical formats are ignored as the BSON-spec defines them clearly:
     return(ReadAsJSonMutableObject());
 }
Example #16
0
 /// <summary>
 /// Converts a JSON string from given input into a tree of .NET arrays, dictionaries, strings and decimals.
 /// </summary>
 public object Read(JSonReaderNumberFormat format)
 {
     // numerical formats are ignored as the BSON-spec defines them clearly:
     return(Read());
 }