Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : */
8 :
9 : #ifndef PARSER_HPP
10 : #define PARSER_HPP
11 :
12 : #include <map>
13 : #include <string>
14 : #include <vector>
15 :
16 : struct parse_error : std::exception
17 : {
18 : std::string info;
19 : int linenr;
20 :
21 0 : parse_error (std::string info_, int linenr_) : info (std::move (info_)), linenr (linenr_)
22 : {
23 : }
24 :
25 0 : ~parse_error () throw ()
26 0 : {
27 0 : }
28 :
29 0 : virtual const char * what () const throw () override
30 : {
31 0 : return info.c_str ();
32 : }
33 : };
34 :
35 : typedef std::vector<std::map<std::string, std::string>> parse_t;
36 :
37 : parse_t parse (std::string const & file);
38 :
39 : #endif
|