44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
#pragma once
|
|
#include <string>
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include "json.hpp"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
#define String std::wstring
|
|
|
|
#define NS_BEGIN(n) namespace n {
|
|
|
|
#define NS_END1() }
|
|
#define NS_END2() NS_END1() }
|
|
#define NS_END3() NS_END2() }
|
|
#define NS_END4() NS_END3() }
|
|
#define NS_END5() NS_END4() }
|
|
|
|
#define NS_END(c) NS_END##c()
|
|
|
|
#define Property(type, name, get_access, set_access) \
|
|
private:\
|
|
type _##name;\
|
|
get_access:\
|
|
const type& Get##name() const { return _##name;}\
|
|
set_access:\
|
|
const type& Set##name(const type& value) { _##name = value; return _##name; }
|
|
|
|
#define JProperty(type, name, get_access, set_access, json_doc) \
|
|
get_access:\
|
|
type Get##name() const { return json_doc[#name].get<type>();}\
|
|
set_access:\
|
|
type Set##name(const type& value) { json_doc[#name] = value; return value; }
|
|
|
|
struct SiaHostConfig
|
|
{
|
|
String HostName;
|
|
std::uint16_t HostPort;
|
|
String RequiredVersion;
|
|
};
|
|
|
|
#define API_SUCCESS(t, x) (x == t::Success)
|
|
|
|
#define DEFAULT_CONFIG_FILE_PATH L".\\Config\\SiaDriveConfig.json" |