Update: drop Qt dependency, rewrite as pure Win32 using v142 toolset. Replace Update.ui/qrc and miniz-based Zip with Api/Crypto/Http/Json/Unzip/UpdateWindow modules. CrownClient/CrownServer: update Verify and main sources, retarget x64 configs to v142 (VS2019) with SDK 10.0.19041.0, fix VMProtect SDK paths.
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
#include <memory>
|
|
|
|
namespace updater {
|
|
|
|
class Json {
|
|
public:
|
|
enum Type { Null, Bool, Number, String, Array, Object };
|
|
|
|
Json();
|
|
explicit Json(Type type);
|
|
|
|
Type type() const { return type_; }
|
|
|
|
bool isNull() const { return type_ == Null; }
|
|
bool isBool() const { return type_ == Bool; }
|
|
bool isNumber() const { return type_ == Number; }
|
|
bool isString() const { return type_ == String; }
|
|
bool isArray() const { return type_ == Array; }
|
|
bool isObject() const { return type_ == Object; }
|
|
|
|
bool boolValue(bool def = false) const;
|
|
double numberValue(double def = 0.0) const;
|
|
long long intValue(long long def = 0) const;
|
|
std::string stringValue(const std::string& def = "") const;
|
|
|
|
const Json& operator[](const char* key) const;
|
|
const Json& operator[](const std::string& key) const;
|
|
const Json& operator[](size_t index) const;
|
|
bool contains(const char* key) const;
|
|
|
|
size_t arraySize() const;
|
|
|
|
static bool Parse(const std::string& text, Json& out, std::string& err);
|
|
|
|
private:
|
|
struct Impl;
|
|
std::shared_ptr<Impl> impl_;
|
|
Type type_;
|
|
|
|
friend struct JsonAccess;
|
|
};
|
|
|
|
}
|