Refactor some JSON stuff for performance, and fix a build error.

This commit is contained in:
Adam Ierymenko 2017-01-10 13:51:10 -08:00
parent 6fb49f68fc
commit a064e19b8a
7 changed files with 188 additions and 218 deletions

View file

@ -45,6 +45,8 @@
#include <arpa/inet.h>
#endif
#include "../ext/json/json.hpp"
namespace ZeroTier {
/**
@ -267,6 +269,12 @@ public:
*/
static std::string platformDefaultHomePath();
static nlohmann::json jsonParse(const std::string &buf);
static std::string jsonDump(const nlohmann::json &j);
static uint64_t jsonInt(const nlohmann::json &jv,const uint64_t dfl);
static bool jsonBool(const nlohmann::json &jv,const bool dfl);
static std::string jsonString(const nlohmann::json &jv,const char *dfl);
private:
static const unsigned char TOLOWER_TABLE[256];
};