chigraph  master
Systems programming language written for beginners in LLVM
JsonDeserializer.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #ifndef CHI_JSON_DESERIALIZER_HPP
7 #define CHI_JSON_DESERIALIZER_HPP
8 
9 #include "chi/Fwd.hpp"
10 #include "chi/Support/json.hpp"
11 
12 #include <boost/filesystem.hpp>
13 #include <boost/utility/string_view.hpp>
14 
15 namespace chi {
16 
19 
26 Result jsonToGraphModule(Context& createInside, const nlohmann::json& input,
27  const boost::filesystem::path& fullName, GraphModule** toFill = nullptr);
28 
34 Result createGraphFunctionDeclarationFromJson(GraphModule& createInside,
35  const nlohmann::json& input,
36  GraphFunction** toFill = nullptr);
37 
42 Result jsonToGraphFunction(GraphFunction& createInside, const nlohmann::json& input);
43 
50 Result jsonToGraphStruct(GraphModule& mod, boost::string_view name, const nlohmann::json& input,
51  GraphStruct** toFill = nullptr);
52 
56 std::pair<std::string, std::string> parseObjectPair(const nlohmann::json& object);
57 
59 
60 } // namespace chi
61 
62 #endif // CHI_JSON_DESERIALIZER_HPP
Result jsonToGraphStruct(GraphModule &mod, boost::string_view name, const nlohmann::json &input, GraphStruct **toFill=nullptr)
Load a GraphStruct from json.
Forward declares all the chigraph data types.
Result jsonToGraphModule(Context &createInside, const nlohmann::json &input, const boost::filesystem::path &fullName, GraphModule **toFill=nullptr)
Load a GraphModule from json.
Result jsonToGraphFunction(GraphFunction &createInside, const nlohmann::json &input)
Load a GraphFunction–must already exist (use createGraphFunctionDeclarationFromJson) ...
The namespace where chigraph lives.
std::pair< std::string, std::string > parseObjectPair(const nlohmann::json &object)
Parse something that looks like: {"hello": "there"} into {"hello", "there"}.
Result createGraphFunctionDeclarationFromJson(GraphModule &createInside, const nlohmann::json &input, GraphFunction **toFill=nullptr)
Create a forward declaration of a function in a module with an empty graph.