33 lines
806 B
C++
33 lines
806 B
C++
#pragma once
|
|
|
|
#include <zmq.hpp>
|
|
#include <nlohmann/json.hpp>
|
|
#include <sqlite3.h>
|
|
#include <filesystem>
|
|
#include <QDebug>
|
|
#include <iostream>
|
|
|
|
using json = nlohmann::json;
|
|
|
|
//major minor patch
|
|
#define LITTLESNITCH_VERSION 010
|
|
|
|
template<typename T, typename K>
|
|
bool json_get(json j, T& value, K key) noexcept {
|
|
try {
|
|
j[key].get_to(value);
|
|
return true;
|
|
} catch (nlohmann::detail::type_error& err) {
|
|
qDebug() << err.what();
|
|
} catch (nlohmann::detail::out_of_range& err) {
|
|
qDebug() << err.what();
|
|
} catch (nlohmann::detail::other_error& err) {
|
|
qDebug() << err.what();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
template<typename T, typename K, typename... Ks>
|
|
bool json_get(json j, T& value, K key, Ks... keys) noexcept {
|
|
return json_get(j[key], value, keys...);
|
|
}
|