Allow field elements to be optional in thrift with xsd_optional keyword
Reviewed By: tbr-dave
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664932 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/parse/t_field.h b/compiler/cpp/src/parse/t_field.h
index 93e14d8..35414ef 100644
--- a/compiler/cpp/src/parse/t_field.h
+++ b/compiler/cpp/src/parse/t_field.h
@@ -14,12 +14,14 @@
t_field(t_type* type, std::string name) :
type_(type),
name_(name),
- key_(0) {}
+ key_(0),
+ xsd_optional_(false) {}
t_field(t_type* type, std::string name, int32_t key) :
type_(type),
name_(name),
- key_(key) {}
+ key_(key),
+ xsd_optional_(false) {}
~t_field() {}
@@ -35,10 +37,21 @@
return key_;
}
+ void set_xsd_optional(bool xsd_optional) {
+ xsd_optional_ = xsd_optional;
+ }
+
+ bool get_xsd_optional() const {
+ return xsd_optional_;
+ }
+
private:
t_type* type_;
std::string name_;
int32_t key_;
+
+ bool xsd_optional_;
+
};
#endif