Groundwork for exception support:
Auto generate result structs that combine return type and any thrown exceptions
Add __isset struct to all user defined and auto defined struct to mark fields that are explicilty read
Modified client and server generation code to marshal result structs
Added base facebook::thrift::Exception class
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664750 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/Thrift.h b/lib/cpp/src/Thrift.h
index 9986e3b..1f98d82 100644
--- a/lib/cpp/src/Thrift.h
+++ b/lib/cpp/src/Thrift.h
@@ -7,5 +7,20 @@
#include <map>
#include <list>
#include <set>
+#include <exception>
+
+namespace facebook {namespace thrift {
+
+class Exception : public std::exception {
+private:
+ const std::string _message;
+
+public:
+ Exception(const std::string message) : _message(message) {}
+ ~Exception() throw () {}
+ const char* what() {return _message.c_str();}
+};
+
+}} // facebook::thrift
#endif
diff --git a/lib/cpp/src/protocol/TProtocol.h b/lib/cpp/src/protocol/TProtocol.h
index 8c89ba5..329b7bf 100644
--- a/lib/cpp/src/protocol/TProtocol.h
+++ b/lib/cpp/src/protocol/TProtocol.h
@@ -30,23 +30,24 @@
*/
enum TType {
T_STOP = 0,
- T_BOOL = 1,
- T_BYTE = 2,
- T_U08 = 2,
- T_U16 = 3,
- T_I16 = 4,
- T_U32 = 5,
- T_I32 = 6,
- T_U64 = 7,
- T_I64 = 8,
- T_STRING = 9,
- T_UTF7 = 9,
- T_STRUCT = 10,
- T_MAP = 11,
- T_SET = 12,
- T_LIST = 13,
- T_UTF8 = 14,
- T_UTF16 = 15
+ T_VOID = 1,
+ T_BOOL = 2,
+ T_BYTE = 3,
+ T_U08 = 4,
+ T_U16 = 5,
+ T_I16 = 6,
+ T_U32 = 7,
+ T_I32 = 8,
+ T_U64 = 9,
+ T_I64 = 10,
+ T_STRING = 11,
+ T_UTF7 = 12,
+ T_STRUCT = 13,
+ T_MAP = 14,
+ T_SET = 15,
+ T_LIST = 16,
+ T_UTF8 = 17,
+ T_UTF16 = 18
};
/**
@@ -148,7 +149,7 @@
* Reading functions
*/
- virtual uint32_t readMessasgeBegin(shared_ptr<TTransport> in,
+ virtual uint32_t readMessageBegin(shared_ptr<TTransport> in,
TMessageType& messageType,
uint32_t& seqid) const = 0;