]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef JSON_SPIRIT_ERROR_POSITION\r |
2 | #define JSON_SPIRIT_ERROR_POSITION\r | |
3 | \r | |
4 | // Copyright John W. Wilkinson 2007 - 2011\r | |
5 | // Distributed under the MIT License, see accompanying file LICENSE.txt\r | |
6 | \r | |
7 | // json spirit version 4.05\r | |
8 | \r | |
9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020)\r | |
10 | # pragma once\r | |
11 | #endif\r | |
12 | \r | |
13 | #include <string>\r | |
14 | \r | |
15 | namespace json_spirit\r | |
16 | {\r | |
17 | // An Error_position exception is thrown by the "read_or_throw" functions below on finding an error.\r | |
18 | // Note the "read_or_throw" functions are around 3 times slower than the standard functions "read" \r | |
19 | // functions that return a bool.\r | |
20 | //\r | |
21 | struct Error_position\r | |
22 | {\r | |
23 | Error_position();\r | |
24 | Error_position( unsigned int line, unsigned int column, const std::string& reason );\r | |
25 | bool operator==( const Error_position& lhs ) const;\r | |
26 | unsigned int line_;\r | |
27 | unsigned int column_;\r | |
28 | std::string reason_;\r | |
29 | };\r | |
30 | \r | |
31 | inline Error_position::Error_position()\r | |
32 | : line_( 0 )\r | |
33 | , column_( 0 )\r | |
34 | {\r | |
35 | }\r | |
36 | \r | |
37 | inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason )\r | |
38 | : line_( line )\r | |
39 | , column_( column )\r | |
40 | , reason_( reason )\r | |
41 | {\r | |
42 | }\r | |
43 | \r | |
44 | inline bool Error_position::operator==( const Error_position& lhs ) const\r | |
45 | {\r | |
46 | if( this == &lhs ) return true;\r | |
47 | \r | |
48 | return ( reason_ == lhs.reason_ ) &&\r | |
49 | ( line_ == lhs.line_ ) &&\r | |
50 | ( column_ == lhs.column_ ); \r | |
51 | }\r | |
52 | }\r | |
53 | \r | |
54 | #endif\r |