TrueReality  v0.1.1912
trUtil/JSON/Base.h
Go to the documentation of this file.
1 /*
2 * True Reality Open Source Game and Simulation Engine
3 * Copyright © 2021 Acid Rain Studios LLC
4 *
5 * This library is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License as published by the Free
7 * Software Foundation; either version 3.0 of the License, or (at your option)
8 * any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * @author Maxim Serebrennik
20 */
21 
22 #pragma once
23 
24 #include <trUtil/Export.h>
25 
26 #include <trUtil/JSON/Value.h>
27 
28 #include <osg/Referenced>
29 
30 #include <stdint.h>
31 #include <string>
32 
38 namespace trUtil::JSON
39 {
45  class Object;
46 
52  class Array;
53 
61  class TR_UTIL_EXPORT Base : osg::Referenced
62  {
63 
64  public:
65 
71  virtual void Clear() = 0;
72 
80  virtual Value& GetJSONRoot() = 0;
81 
87  virtual void PrintJSONRoot() = 0;
88 
98  virtual bool KeyPresent(const std::string &key) const = 0;
99 
109  virtual bool IsNull(const std::string &key) const = 0;
110 
118  virtual void SetNull(const std::string &key) = 0;
119 
129  virtual bool IsBool(const std::string &key) const = 0;
130 
140  virtual bool GetBool(const std::string &key) const = 0;
141 
150  virtual void SetBool(const std::string &key, const bool &value) = 0;
151 
161  virtual bool IsTrue(const std::string &key) const = 0;
162 
172  virtual bool IsFalse(const std::string &key) const = 0;
173 
183  virtual bool IsNumber(const std::string &key) const = 0;
184 
194  virtual bool IsInt(const std::string &key) const = 0;
195 
205  virtual int GetInt(const std::string &key) const = 0;
206 
215  virtual void SetInt(const std::string &key, const int &value) = 0;
216 
226  virtual bool IsDouble(const std::string &key) const = 0;
227 
237  virtual double GetDouble(const std::string &key) const = 0;
238 
247  virtual void SetDouble(const std::string &key, const double &value) = 0;
248 
258  virtual bool IsUInt(const std::string &key) const = 0;
259 
269  virtual unsigned int GetUInt(const std::string &key) const = 0;
270 
279  virtual void SetUInt(const std::string &key, const unsigned int &value) = 0;
280 
290  virtual bool IsInt64(const std::string &key) const = 0;
291 
301  virtual Int64 GetInt64(const std::string &key) const = 0;
302 
311  virtual void SetInt64(const std::string &key, const Int64 &value) = 0;
312 
322  virtual bool IsUInt64(const std::string &key) const = 0;
323 
333  virtual UInt64 GetUInt64(const std::string &key) const = 0;
334 
343  virtual void SetUInt64(const std::string &key, const UInt64 &value) = 0;
344 
354  virtual bool IsFloat(const std::string &key) const = 0;
355 
365  virtual float GetFloat(const std::string &key) const = 0;
366 
375  virtual void SetFloat(const std::string &key, const float &value) = 0;
376 
386  virtual bool IsString(const std::string &key) const = 0;
387 
397  virtual const std::string GetString(const std::string &key) const = 0;
398 
407  virtual void SetString(const std::string &key, const std::string &value) = 0;
408 
418  virtual bool IsArray(const std::string &key) const = 0;
419 
429  virtual Array GetArray(const std::string &key) const = 0;
430 
439  virtual void SetArray(const std::string &key, Array &Array) = 0;
440 
450  virtual bool IsObject(const std::string &key) const = 0;
451 
461  virtual Object GetObject(const std::string &key) const = 0;
462 
471  virtual void SetObject(const std::string &key, Object &Object) = 0;
472  };
473 }
A JSON array.
Definition: Array.h:46
Represents a JSON value.
Definition: Value.h:139
The Base class for all the JSON classes.
int64_t Int64
The fourth int 6.
Definition: Value.h:72
Forward declaration.
Definition: Object.h:46
A class that represents date time utility.
uint64_t UInt64
The fourth u int 6.
Definition: Value.h:74