TrueReality  v0.1.1912
Array.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 
25 #include <trUtil/Export.h>
26 
27 #include <trUtil/JSON/ArrayBase.h>
28 #include <trUtil/JSON/Value.h>
29 
30 #include <string>
31 
37 namespace trUtil::JSON
38 {
47  {
48  public:
49 
55  Array();
56 
64  Array(const Value &Array);
65 
71  ~Array();
72 
83  Value operator[](int index);
84 
85  /*
86  * Adds a comment to the internal value
87  */
88 
96  void SetComment(const std::string& comment);
97 
105  bool HasComment() const;
106 
114  std::string GetComment() const;
115 
123  int Size();
124 
132  void Resize(int newSize);
133 
139  void Clear() override;
140 
152  bool RemoveIndex(int index, Value *removedVal);
153 
161  virtual Value& GetJSONRoot() override;
162 
168  virtual void PrintJSONRoot() override;
169 
179  virtual bool IsNull(int &index) const override;
180 
186  virtual void AddNull() override;
187 
197  virtual bool IsBool(int &index) const override;
198 
208  virtual bool GetBool(int &index) const override;
209 
217  virtual void AddBool(const bool &value) override;
218 
228  virtual bool IsTrue(int &index) const override;
229 
239  virtual bool IsFalse(int &index) const override;
240 
250  virtual bool IsNumber(int &index) const override;
251 
261  virtual bool IsInt(int &index) const override;
262 
272  virtual int GetInt(int &index) const override;
273 
281  virtual void AddInt(const int &value) override;
282 
292  virtual bool IsDouble(int &index) const override;
293 
303  virtual double GetDouble(int &index) const override;
304 
312  virtual void AddDouble(const double &value) override;
313 
323  virtual bool IsUInt(int &index) const override;
324 
334  virtual unsigned int GetUInt(int &index) const override;
335 
343  virtual void AddUInt(const unsigned int &value) override;
344 
354  virtual bool IsInt64(int &index) const override;
355 
365  virtual Int64 GetInt64(int &index) const override;
366 
374  virtual void AddInt64(const Int64 &value) override;
375 
385  virtual bool IsUInt64(int &index) const override;
386 
396  virtual UInt64 GetUInt64(int &index) const override;
397 
405  virtual void AddUInt64(const UInt64 &value) override;
406 
416  virtual bool IsFloat(int &index) const override;
417 
427  virtual float GetFloat(int &index) const override;
428 
436  virtual void AddFloat(const float &value) override;
437 
447  virtual bool IsString(int &index) const override;
448 
458  virtual const std::string GetString(int &index) const override;
459 
467  virtual void AddString(const std::string &value) override;
468 
478  virtual bool IsArray(int &index) const override;
479 
489  virtual Array GetArray(int &index) const override;
490 
498  virtual void AddArray(Array &Array) override;
499 
509  virtual bool IsObject(int &index) const override;
510 
520  virtual Object GetObject(int &index) const override;
521 
529  virtual void AddObject(Object &Object) override;
530 
531  private:
534  };
535 }
A JSON array.
Definition: Array.h:46
Represents a JSON value.
Definition: Value.h:139
int64_t Int64
The fourth int 6.
Definition: Value.h:72
Forward declaration.
Definition: Object.h:46
A class that represents date time utility.
bool value
Definition: Value.h:97
uint64_t UInt64
The fourth u int 6.
Definition: Value.h:74
An array base.
Definition: ArrayBase.h:61