aboutsummaryrefslogtreecommitdiff
path: root/src/json/json_spirit_error_position.h
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2011-05-09 14:00:14 -0400
committerJeff Garzik <jgarzik@pobox.com>2011-05-09 14:00:14 -0400
commitb17be7e14b4a62b7935c75fe7e7645e736fd68d2 (patch)
treebe44c7310683df72aeb5781ec74a85451206cfbc /src/json/json_spirit_error_position.h
parentc0430f42b868dbf996a416d3a9d81d1c8c07e47c (diff)
parent84c3fb07b0b8199c7f85c5de280e7100bad0786f (diff)
Manual merge of jaromil's source tree reorg commit.
Conflicts: src/sha256.cpp
Diffstat (limited to 'src/json/json_spirit_error_position.h')
-rw-r--r--src/json/json_spirit_error_position.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/json/json_spirit_error_position.h b/src/json/json_spirit_error_position.h
new file mode 100644
index 0000000000..17208507df
--- /dev/null
+++ b/src/json/json_spirit_error_position.h
@@ -0,0 +1,54 @@
+#ifndef JSON_SPIRIT_ERROR_POSITION
+#define JSON_SPIRIT_ERROR_POSITION
+
+// Copyright John W. Wilkinson 2007 - 2009.
+// Distributed under the MIT License, see accompanying file LICENSE.txt
+
+// json spirit version 4.03
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <string>
+
+namespace json_spirit
+{
+ // An Error_position exception is thrown by the "read_or_throw" functions below on finding an error.
+ // Note the "read_or_throw" functions are around 3 times slower than the standard functions "read"
+ // functions that return a bool.
+ //
+ struct Error_position
+ {
+ Error_position();
+ Error_position( unsigned int line, unsigned int column, const std::string& reason );
+ bool operator==( const Error_position& lhs ) const;
+ unsigned int line_;
+ unsigned int column_;
+ std::string reason_;
+ };
+
+ inline Error_position::Error_position()
+ : line_( 0 )
+ , column_( 0 )
+ {
+ }
+
+ inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason )
+ : line_( line )
+ , column_( column )
+ , reason_( reason )
+ {
+ }
+
+ inline bool Error_position::operator==( const Error_position& lhs ) const
+ {
+ if( this == &lhs ) return true;
+
+ return ( reason_ == lhs.reason_ ) &&
+ ( line_ == lhs.line_ ) &&
+ ( column_ == lhs.column_ );
+}
+}
+
+#endif