Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3875

Show
Ignore:
Timestamp:
08/11/08 16:36:02 (4 months ago)
Author:
kris
Message:

added a bit of doc

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tango/text/json/Json.d

    r3872 r3875  
    2020private import Float = tango.text.convert.Float; 
    2121 
    22  
    23  
    24 /** 
    25  * Enumerates the seven acceptable JSON value types. 
    26  */ 
    27 /** 
    28  * Represents a JSON value that is one of the seven types specified by the enum 
    29  * Type. 
    30  */ 
    31 /** 
    32  * Represents a single JSON Object. 
    33  */ 
    34  
    3522/******************************************************************************* 
     23 
     24        Parse JSON text into a set of inter-related structures. Typical usage  
     25        is as follows: 
     26        --- 
     27        auto p = new Json!(char); 
     28        auto v = p.parse (`{"t": true, "n":null, "array":["world", [4, 5]]}`);     
     29        ---    
     30 
     31        Converting back to text format employs a delegate: 
     32        --- 
     33        v.print ((char[] s) {Stdout(s);});  
     34        --- 
    3635 
    3736*******************************************************************************/ 
     
    3938class Json(T) : private JsonParser!(T) 
    4039{ 
     40                     /// use these types for external references 
    4141        public alias JsonValue*  Value; 
    4242        public alias NameValue*  Attribute; 
    4343        public alias JsonObject* Composite; 
    4444 
     45                    /// enumerates the seven acceptable JSON value types 
    4546        public enum Type {Null, String, RawString, Number, Object, Array, True, False}; 
    4647 
    4748        /*********************************************************************** 
    4849         
     50                Construct a json instance 
     51 
    4952        ***********************************************************************/ 
    5053         
     
    5659        /*********************************************************************** 
    5760         
     61                Parse the given text and return a resultant Value type  
     62 
    5863        ***********************************************************************/ 
    5964         
    6065        public Value parse (T[] json) 
    6166        { 
    62  
    6367                nesting = 0; 
    6468                attrib.reset; 
     
    327331 
    328332        /*********************************************************************** 
    329          
     333 
     334                Represents a single json Object         
     335 
    330336        ***********************************************************************/ 
    331337         
     
    420426        /*********************************************************************** 
    421427         
     428                Represents a json value that is one of the seven types  
     429                specified via the Json.Type enum  
     430 
    422431        ***********************************************************************/ 
    423432