… | |
… | |
28 | throw txtprt_i_exception ((std::string)"Fileformat invalid, expected '" + c + "' got: '" + o + "' -> '" + line_data.substr (0, 10) + "..."); |
28 | throw txtprt_i_exception ((std::string)"Fileformat invalid, expected '" + c + "' got: '" + o + "' -> '" + line_data.substr (0, 10) + "..."); |
29 | } |
29 | } |
30 | inline void match_achar (char &c) { |
30 | inline void match_achar (char &c) { |
31 | std::string s = line_data.substr (0, 1); |
31 | std::string s = line_data.substr (0, 1); |
32 | c = s[0]; |
32 | c = s[0]; |
33 | cout << "Char: " << c << endl; |
|
|
34 | line_data.erase(0, 1); |
33 | line_data.erase(0, 1); |
35 | } |
34 | } |
36 | |
35 | |
37 | inline void match_space () { match_char (' '); } |
36 | inline void match_space () { match_char (' '); } |
38 | inline void match_nl () { match_char ('\n'); } |
37 | inline void match_nl () { match_char ('\n'); } |
39 | inline void match_number (double &d) { |
38 | inline void match_number (double &d) { |
40 | size_t p = line_data.find_first_not_of ("0123456789.-+"); |
39 | size_t p = line_data.find_first_not_of ("0123456789.-+e"); |
41 | std::string tmp = line_data.substr (0, p); |
40 | std::string tmp = line_data.substr (0, p); |
42 | line_data.erase (0, p); |
41 | line_data.erase (0, p); |
43 | d = strtod (tmp.c_str (), NULL); |
42 | d = strtod (tmp.c_str (), NULL); |
44 | cout << "NUM: " << d << endl; |
|
|
45 | printf("%f\n", d); |
|
|
46 | } |
43 | } |
47 | inline void match_section (char c, std::string §) { // c - section char, sect - name of section |
44 | inline void match_section (char c, std::string §) { // c - section char, sect - name of section |
48 | match_char (c); match_space (); |
45 | match_char (c); match_space (); |
49 | size_t p = line_data.find_first_of ("\n"); |
46 | size_t p = line_data.find_first_of ("\n"); |
50 | sect = line_data.substr (0, p); |
47 | sect = line_data.substr (0, p); |