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