trunk roundhouse kick

This commit is contained in:
Thomas Göttgens
2023-01-21 14:34:29 +01:00
parent 6cf18b7d07
commit 51b2c431d9
234 changed files with 4989 additions and 5101 deletions

View File

@@ -25,46 +25,49 @@
#ifndef _JSON_H_
#define _JSON_H_
#include <vector>
#include <string>
#include <map>
#include <cstring>
#include <map>
#include <string>
#include <vector>
// Simple function to check a string 's' has at least 'n' characters
static inline bool simplejson_csnlen(const char *s, size_t n) {
if (s == 0)
return false;
static inline bool simplejson_csnlen(const char *s, size_t n)
{
if (s == 0)
return false;
const char *save = s;
while (n-- > 0)
{
if (*(save++) == 0) return false;
}
const char *save = s;
while (n-- > 0) {
if (*(save++) == 0)
return false;
}
return true;
return true;
}
// Custom types
class JSONValue;
typedef std::vector<JSONValue*> JSONArray;
typedef std::map<std::string, JSONValue*> JSONObject;
typedef std::vector<JSONValue *> JSONArray;
typedef std::map<std::string, JSONValue *> JSONObject;
#include "JSONValue.h"
class JSON
{
friend class JSONValue;
public:
static JSONValue* Parse(const char *data);
static std::string Stringify(const JSONValue *value);
protected:
static bool SkipWhitespace(const char **data);
static bool ExtractString(const char **data, std::string &str);
static double ParseInt(const char **data);
static double ParseDecimal(const char **data);
private:
JSON();
friend class JSONValue;
public:
static JSONValue *Parse(const char *data);
static std::string Stringify(const JSONValue *value);
protected:
static bool SkipWhitespace(const char **data);
static bool ExtractString(const char **data, std::string &str);
static double ParseInt(const char **data);
static double ParseDecimal(const char **data);
private:
JSON();
};
#endif