aboutsummaryrefslogtreecommitdiff
path: root/json/json_spirit_error_position.h
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-02-10 19:41:22 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-02-10 19:41:22 +0000
commit40d324f102295b8eea70ec9ac6b42be417cbbfb8 (patch)
tree449039c92ef7b69afb7f6864032748d444c368a1 /json/json_spirit_error_position.h
parent1c5d5e58c67e63fd83afd945c7db1190de62514a (diff)
downloadbitcoin-40d324f102295b8eea70ec9ac6b42be417cbbfb8.tar.xz
JSON Spirit library from http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx, MIT license
Diffstat (limited to 'json/json_spirit_error_position.h')
-rw-r--r--json/json_spirit_error_position.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/json/json_spirit_error_position.h b/json/json_spirit_error_position.h
new file mode 100644
index 0000000000..4a535ff517
--- /dev/null
+++ b/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