Awali
Another Weighted Automata library
json_ast.hh
Go to the documentation of this file.
1 // This file is part of Awali.
2 // Copyright 2016-2022 Sylvain Lombardy, Victor Marsault, Jacques Sakarovitch
3 //
4 // Awali is a free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef AWALI_JSON_AST_HH
18 #define AWALI_JSON_AST_HH
19 
22 
23 #include<map>
24 
25 namespace awali {
26 
27 using json_ast_t = std::shared_ptr<json::object_t>;
28 
29 
30 namespace json_ast {
31 
33  inline json_ast_t empty() {return std::make_shared<json::object_t>();}
34 
36  json_ast_t from(std::istream& i);
37 
39  json_ast_t from_string_map(std::map<std::string, std::string> const& map);
40 
47  json_ast_t from_file(std::string const& filename);
48 
49 }
50 
51 namespace internal {
52  json_ast_t metadata_ast(std::istream& i);
53 }
54 
55 std::ostream& put(json_ast_t tree, std::ostream& out);
56 
57 }// end of namespace awali
58 
59 
60 
61 
62 #endif
auto map(const std::tuple< Ts... > &ts, Fun f) -> decltype(map_tuple_(f, ts, make_index_sequence< sizeof...(Ts)>()))
Map a function on a tuple, return tuple of the results.
Definition: tuple.hh:134
json_ast_t metadata_ast(std::istream &i)
json_ast_t from_file(std::string const &filename)
Reads json_tree from given file.
json_ast_t from_string_map(std::map< std::string, std::string > const &map)
This function serves to build metadata extra informations.
json_ast_t empty()
Builds an empty json_ast_t.
Definition: json_ast.hh:33
json_ast_t from(std::istream &i)
Builds a json_ast_t from an input stream.
Main namespace of Awali.
Definition: ato.hh:22
std::shared_ptr< json::object_t > json_ast_t
Definition: json_ast.hh:27
std::ostream & put(json_ast_t tree, std::ostream &out)