Back to home page

Bitcoin sources

 
 

    


File indexing completed on 2020-06-25 15:43:10

0001 #ifndef JSON_SPIRIT_ERROR_POSITION
0002 #define JSON_SPIRIT_ERROR_POSITION
0003 
0004 //          Copyright John W. Wilkinson 2007 - 2009.
0005 // Distributed under the MIT License, see accompanying file LICENSE.txt
0006 
0007 // json spirit version 4.03
0008 
0009 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
0010 # pragma once
0011 #endif
0012 
0013 #include <string>
0014 
0015 namespace json_spirit
0016 {
0017     // An Error_position exception is thrown by the "read_or_throw" functions below on finding an error.
0018     // Note the "read_or_throw" functions are around 3 times slower than the standard functions "read" 
0019     // functions that return a bool.
0020     //
0021     struct Error_position
0022     {
0023         Error_position();
0024         Error_position( unsigned int line, unsigned int column, const std::string& reason );
0025         bool operator==( const Error_position& lhs ) const;
0026         unsigned int line_;
0027         unsigned int column_;
0028         std::string reason_;
0029     };
0030 
0031     inline Error_position::Error_position()
0032     :   line_( 0 )
0033     ,   column_( 0 )
0034     {
0035     }
0036 
0037     inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason )
0038     :   line_( line )
0039     ,   column_( column )
0040     ,   reason_( reason )
0041     {
0042     }
0043 
0044     inline bool Error_position::operator==( const Error_position& lhs ) const
0045     {
0046         if( this == &lhs ) return true;
0047 
0048         return ( reason_ == lhs.reason_ ) &&
0049                ( line_   == lhs.line_ ) &&
0050                ( column_ == lhs.column_ ); 
0051 }
0052 }
0053 
0054 #endif