Loading [MathJax]/extensions/tex2jax.js
Plugins
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
json_toolkit.hpp
Go to the documentation of this file.
1/*
2 * JSON schema validator for JSON for modern C++
3 *
4 * Copyright (c) 2016-2019 Patrick Boettcher <p@yai.se>.
5 *
6 * SPDX-License-Identifier: MIT
7 *
8 */
9
10#ifndef __H__UG__JSON_TOOLKIT_HPP__
11#define __H__UG__JSON_TOOLKIT_HPP__
12
13#include <nlohmann/json-schema.hpp>
14
15#include <fstream>
16#include <iostream>
17
18#include "ug.h"
19#include "common/error.h"
20#include "common/log.h"
21
22#include "common/ug_config.h"
24
25
26namespace ug
27{
28 namespace JSONToolkit
29 {
30
31 // TODO: Move into separate class.
32 struct JSONTool {
34
35 static SmartPtr<void> create_object(const nlohmann::json& j);
36
37 static SmartPtr<nlohmann::json> create(const std::string &s);
38 static SmartPtr<nlohmann::json> create_from_file(const std::string &s);
39
40 static void parse(nlohmann::json& j, std::string s);
41 static bool load_from_file(nlohmann::json& j, std::string filename);
42 static std::string dump(const nlohmann::json& j);
43 };
44
45
46 } // namespace JSONToolkit
47
48} // namespace ug
49
50#endif // __H__UG__JSON_TOOLKIT_HPP__
parameterString s
Definition Biogas.lua:2
Definition json_toolkit.hpp:32
static std::string dump(const nlohmann::json &j)
Definition json_toolkit.cpp:66
static bool load_from_file(nlohmann::json &j, std::string filename)
Definition json_toolkit.cpp:43
JSONTool()
Definition json_toolkit.hpp:33
static SmartPtr< nlohmann::json > create_from_file(const std::string &s)
Definition json_toolkit.cpp:79
static SmartPtr< void > create_object(const nlohmann::json &j)
Definition json_toolkit.cpp:33
static void parse(nlohmann::json &j, std::string s)
Definition json_toolkit.cpp:63
static SmartPtr< nlohmann::json > create(const std::string &s)
Definition json_toolkit.cpp:72