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