mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-14 18:48:36 -07:00
RethinkDB native connector work, minor fixes.
This commit is contained in:
parent
a6203ed038
commit
4e88c80a22
219 changed files with 33295 additions and 0 deletions
|
@ -451,6 +451,21 @@ uint64_t OSUtils::jsonInt(const nlohmann::json &jv,const uint64_t dfl)
|
|||
return dfl;
|
||||
}
|
||||
|
||||
uint64_t OSUtils::jsonIntHex(const nlohmann::json &jv,const uint64_t dfl)
|
||||
{
|
||||
try {
|
||||
if (jv.is_number()) {
|
||||
return (uint64_t)jv;
|
||||
} else if (jv.is_string()) {
|
||||
std::string s = jv;
|
||||
return Utils::hexStrToU64(s.c_str());
|
||||
} else if (jv.is_boolean()) {
|
||||
return ((bool)jv ? 1ULL : 0ULL);
|
||||
}
|
||||
} catch ( ... ) {}
|
||||
return dfl;
|
||||
}
|
||||
|
||||
bool OSUtils::jsonBool(const nlohmann::json &jv,const bool dfl)
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -278,6 +278,7 @@ public:
|
|||
static nlohmann::json jsonParse(const std::string &buf);
|
||||
static std::string jsonDump(const nlohmann::json &j,int indentation = 1);
|
||||
static uint64_t jsonInt(const nlohmann::json &jv,const uint64_t dfl);
|
||||
static uint64_t jsonIntHex(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);
|
||||
static std::string jsonBinFromHex(const nlohmann::json &jv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue