summaryrefslogtreecommitdiff
path: root/src/unstable/json.h
diff options
context:
space:
mode:
authorMike Buland <mbuland@penny-arcade.com>2018-01-18 16:08:24 -0800
committerMike Buland <mbuland@penny-arcade.com>2018-01-18 16:08:24 -0800
commit516fa9045af1e9c85ce524535d0ea5bc395e86cb (patch)
tree482ceb92494c3770d12b91a511f105c304025fa9 /src/unstable/json.h
parentea96e4decaa23fc8ddfb528d4851751ec9496490 (diff)
downloadlibbu++-516fa9045af1e9c85ce524535d0ea5bc395e86cb.tar.gz
libbu++-516fa9045af1e9c85ce524535d0ea5bc395e86cb.tar.bz2
libbu++-516fa9045af1e9c85ce524535d0ea5bc395e86cb.tar.xz
libbu++-516fa9045af1e9c85ce524535d0ea5bc395e86cb.zip
Made json much more helpful. Fixed array iterators.
Diffstat (limited to '')
-rw-r--r--src/unstable/json.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/unstable/json.h b/src/unstable/json.h
index 86074bc..217a69a 100644
--- a/src/unstable/json.h
+++ b/src/unstable/json.h
@@ -3,6 +3,7 @@
3 3
4#include "bu/hash.h" 4#include "bu/hash.h"
5#include "bu/list.h" 5#include "bu/list.h"
6#include "bu/array.h"
6#include "bu/string.h" 7#include "bu/string.h"
7#include "bu/utfstring.h" 8#include "bu/utfstring.h"
8 9
@@ -15,7 +16,7 @@ namespace Bu
15 private: 16 private:
16 Json( char &c, Bu::Stream &sInput ); 17 Json( char &c, Bu::Stream &sInput );
17 typedef Bu::Hash<Bu::String, Json *> JsonHash; 18 typedef Bu::Hash<Bu::String, Json *> JsonHash;
18 typedef Bu::List<Json *> JsonList; 19 typedef Bu::Array<Json *> JsonList;
19 20
20 public: 21 public:
21 typedef JsonList::iterator iterator; 22 typedef JsonList::iterator iterator;
@@ -47,7 +48,8 @@ namespace Bu
47 double getNumber() const; 48 double getNumber() const;
48 bool getBoolean() const; 49 bool getBoolean() const;
49 bool isNull() const; 50 bool isNull() const;
50 Json *operator[]( const Bu::String &sKey ) const; 51 Json &operator[]( const Bu::String &sKey ) const;
52 Json &operator[]( int iIndex ) const;
51 int getSize() const; 53 int getSize() const;
52 iterator begin(); 54 iterator begin();
53 const_iterator begin() const; 55 const_iterator begin() const;
@@ -56,7 +58,19 @@ namespace Bu
56 58
57 bool has( const Bu::String &sKey ) const; 59 bool has( const Bu::String &sKey ) const;
58 void insert( const Bu::String &sKey, Bu::Json *pObj ); 60 void insert( const Bu::String &sKey, Bu::Json *pObj );
61 void insert( const Bu::String &sKey, const Bu::String &sValue );
62 void insert( const Bu::String &sKey, const char *sValue );
63 void insert( const Bu::String &sKey, double dValue );
64 void insert( const Bu::String &sKey, bool bValue );
65 Json &insertObject( const Bu::String &sKey );
66 Json &insertArray( const Bu::String &sKey );
59 void append( Bu::Json *pObj ); 67 void append( Bu::Json *pObj );
68 void append( const Bu::String &sValue );
69 void append( const char *sValue );
70 void append( double dValue );
71 void append( bool bValue );
72 Json &appendObject();
73 Json &appendArray();
60 74
61 void parse( Bu::Stream &sInput ); 75 void parse( Bu::Stream &sInput );
62 void parse( const Bu::String &sInput ); 76 void parse( const Bu::String &sInput );