summaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/OVR_JSON.h
diff options
context:
space:
mode:
Diffstat (limited to 'LibOVR/Src/OVR_JSON.h')
-rw-r--r--LibOVR/Src/OVR_JSON.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/LibOVR/Src/OVR_JSON.h b/LibOVR/Src/OVR_JSON.h
index a2a603c..488cb1d 100644
--- a/LibOVR/Src/OVR_JSON.h
+++ b/LibOVR/Src/OVR_JSON.h
@@ -7,16 +7,16 @@ Created : April 9, 2013
Author : Brant Lewis
Notes :
-Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
+Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved.
-Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License");
+Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
you may not use the Oculus VR Rift SDK except in compliance with the License,
which is provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at
-http://www.oculusvr.com/licenses/LICENSE-3.1
+http://www.oculusvr.com/licenses/LICENSE-3.2
Unless required by applicable law or agreed to in writing, the Oculus VR SDK
distributed under the License is distributed on an "AS IS" BASIS,
@@ -71,12 +71,13 @@ public:
// *** Creation of NEW JSON objects
- static JSON* CreateObject() { return new JSON(JSON_Object);}
- static JSON* CreateNull() { return new JSON(JSON_Null); }
- static JSON* CreateArray() { return new JSON(JSON_Array); }
- static JSON* CreateBool(bool b) { return createHelper(JSON_Bool, b ? 1.0 : 0.0); }
- static JSON* CreateNumber(double num) { return createHelper(JSON_Number, num); }
- static JSON* CreateString(const char *s) { return createHelper(JSON_String, 0.0, s); }
+ static JSON* CreateObject() { return new JSON(JSON_Object);}
+ static JSON* CreateNull() { return new JSON(JSON_Null); }
+ static JSON* CreateArray() { return new JSON(JSON_Array); }
+ static JSON* CreateBool(bool b);
+ static JSON* CreateNumber(double num);
+ static JSON* CreateInt(int num);
+ static JSON* CreateString(const char *s);
// Creates a new JSON object from parsing string.
// Returns null pointer and fills in *perror in case of parse error.
@@ -120,6 +121,7 @@ public:
void AddItem(const char *string, JSON* item);
void AddNullItem(const char* name) { AddItem(name, CreateNull()); }
void AddBoolItem(const char* name, bool b) { AddItem(name, CreateBool(b)); }
+ void AddIntItem(const char* name, int n) { AddItem(name, CreateInt(n)); }
void AddNumberItem(const char* name, double n) { AddItem(name, CreateNumber(n)); }
void AddStringItem(const char* name, const char* s) { AddItem(name, CreateString(s)); }
// void ReplaceItem(unsigned index, JSON* new_item);
@@ -132,6 +134,7 @@ public:
void AddArrayElement(JSON *item);
void InsertArrayElement(int index, JSON* item);
void AddArrayNumber(double n) { AddArrayElement(CreateNumber(n)); }
+ void AddArrayInt(int n) { AddArrayElement(CreateInt(n)); }
void AddArrayString(const char* s) { AddArrayElement(CreateString(s)); }
// Accessed array elements; currently inefficient.
@@ -144,8 +147,6 @@ public:
protected:
JSON(JSONItemType itemType = JSON_Object);
- static JSON* createHelper(JSONItemType itemType, double dval, const char* strVal = 0);
-
// JSON Parsing helper functions.
const char* parseValue(const char *buff, const char** perror);
const char* parseNumber(const char *num);