THRIFT-409. java: Add "union" to Thrift
This patch introduces new IDL syntax for creating Unions, explicityly single-valued structs. While the parser changes are portable, this patch only includes the actual generated code changes for the Java library. Other libraries can continue to generate a struct with the same fields and remain compatible until they are able to implement the full shebang.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@810300 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/parse/t_struct.h b/compiler/cpp/src/parse/t_struct.h
index 7980f80..76c24f2 100644
--- a/compiler/cpp/src/parse/t_struct.h
+++ b/compiler/cpp/src/parse/t_struct.h
@@ -58,6 +58,10 @@
is_xception_ = is_xception;
}
+ void set_union(bool is_union) {
+ is_union_ = is_union;
+ }
+
void set_xsd_all(bool xsd_all) {
xsd_all_ = xsd_all;
}
@@ -95,6 +99,10 @@
bool is_xception() const {
return is_xception_;
}
+
+ bool is_union() const {
+ return is_union_;
+ }
virtual std::string get_fingerprint_material() const {
std::string rv = "{";
@@ -120,6 +128,7 @@
members_type members_;
members_type members_in_id_order_;
bool is_xception_;
+ bool is_union_;
bool xsd_all_;
};