Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/thrift
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index 523ce24..c7cdd26 100644
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -72,6 +72,9 @@
iter = parsed_options.find("no_client_completion");
gen_no_client_completion_ = (iter != parsed_options.end());
+ iter = parsed_options.find("no_default_operators");
+ gen_no_default_operators_ = (iter != parsed_options.end());
+
iter = parsed_options.find("templates");
gen_templates_ = (iter != parsed_options.end());
@@ -284,6 +287,11 @@
bool gen_no_client_completion_;
/**
+ * True if we should omit generating the default opeartors ==, != and <.
+ */
+ bool gen_no_default_operators_;
+
+ /**
* Strings for namespace, computed once up front then used directly
*/
@@ -970,44 +978,47 @@
out << endl;
if (!pointers) {
- // Generate an equality testing operator. Make it inline since the compiler
- // will do a better job than we would when deciding whether to inline it.
- out <<
- indent() << "bool operator == (const " << tstruct->get_name() << " & " <<
- (members.size() > 0 ? "rhs" : "/* rhs */") << ") const" << endl;
- scope_up(out);
- for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
- // Most existing Thrift code does not use isset or optional/required,
- // so we treat "default" fields as required.
- if ((*m_iter)->get_req() != t_field::T_OPTIONAL) {
- out <<
- indent() << "if (!(" << (*m_iter)->get_name()
- << " == rhs." << (*m_iter)->get_name() << "))" << endl <<
- indent() << " return false;" << endl;
- } else {
- out <<
- indent() << "if (__isset." << (*m_iter)->get_name()
- << " != rhs.__isset." << (*m_iter)->get_name() << ")" << endl <<
- indent() << " return false;" << endl <<
- indent() << "else if (__isset." << (*m_iter)->get_name() << " && !("
- << (*m_iter)->get_name() << " == rhs." << (*m_iter)->get_name()
- << "))" << endl <<
- indent() << " return false;" << endl;
+ // Should we generate default operators?
+ if (!gen_no_default_operators_) {
+ // Generate an equality testing operator. Make it inline since the compiler
+ // will do a better job than we would when deciding whether to inline it.
+ out <<
+ indent() << "bool operator == (const " << tstruct->get_name() << " & " <<
+ (members.size() > 0 ? "rhs" : "/* rhs */") << ") const" << endl;
+ scope_up(out);
+ for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
+ // Most existing Thrift code does not use isset or optional/required,
+ // so we treat "default" fields as required.
+ if ((*m_iter)->get_req() != t_field::T_OPTIONAL) {
+ out <<
+ indent() << "if (!(" << (*m_iter)->get_name()
+ << " == rhs." << (*m_iter)->get_name() << "))" << endl <<
+ indent() << " return false;" << endl;
+ } else {
+ out <<
+ indent() << "if (__isset." << (*m_iter)->get_name()
+ << " != rhs.__isset." << (*m_iter)->get_name() << ")" << endl <<
+ indent() << " return false;" << endl <<
+ indent() << "else if (__isset." << (*m_iter)->get_name() << " && !("
+ << (*m_iter)->get_name() << " == rhs." << (*m_iter)->get_name()
+ << "))" << endl <<
+ indent() << " return false;" << endl;
+ }
}
- }
- indent(out) << "return true;" << endl;
- scope_down(out);
- out <<
- indent() << "bool operator != (const " << tstruct->get_name() << " &rhs) const {" << endl <<
- indent() << " return !(*this == rhs);" << endl <<
- indent() << "}" << endl << endl;
+ indent(out) << "return true;" << endl;
+ scope_down(out);
+ out <<
+ indent() << "bool operator != (const " << tstruct->get_name() << " &rhs) const {" << endl <<
+ indent() << " return !(*this == rhs);" << endl <<
+ indent() << "}" << endl << endl;
- // Generate the declaration of a less-than operator. This must be
- // implemented by the application developer if they wish to use it. (They
- // will get a link error if they try to use it without an implementation.)
- out <<
- indent() << "bool operator < (const "
- << tstruct->get_name() << " & ) const;" << endl << endl;
+ // Generate the declaration of a less-than operator. This must be
+ // implemented by the application developer if they wish to use it. (They
+ // will get a link error if they try to use it without an implementation.)
+ out <<
+ indent() << "bool operator < (const "
+ << tstruct->get_name() << " & ) const;" << endl << endl;
+ }
}
if (read) {
@@ -4635,6 +4646,8 @@
" cob_style: Generate \"Continuation OBject\"-style classes.\n"
" no_client_completion:\n"
" Omit calls to completion__() in CobClient class.\n"
+" no_default_operators:\n"
+" Omits generation of default operators ==, != and <\n"
" templates: Generate templatized reader/writer methods.\n"
" pure_enums: Generate pure enums instead of wrapper classes.\n"
" dense: Generate type specifications for the dense protocol.\n"
diff --git a/doap.rdf b/doap.rdf
index 80e7fa7..f110e43 100755
--- a/doap.rdf
+++ b/doap.rdf
@@ -57,7 +57,12 @@
<release>
<Version>
<name>Apache Thrift</name>
- <created>2011-10-15</created>
+ <created>2013-08-22</created>
+ <revision>0.9.1</revision>
+ </Version>
+ <Version>
+ <name>Apache Thrift</name>
+ <created>2012-10-15</created>
<revision>0.9.0</revision>
</Version>
<Version>
diff --git a/lib/c_glib/thrift_c_glib.pc.in b/lib/c_glib/thrift_c_glib.pc.in
index 3921d05..568c7a2 100644
--- a/lib/c_glib/thrift_c_glib.pc.in
+++ b/lib/c_glib/thrift_c_glib.pc.in
@@ -27,4 +27,4 @@
Version: @VERSION@
Requires: glib-2.0 gobject-2.0
Libs: -L${libdir} -lthrift_c_glib
-Cflags: -I${includedir}/thrift/c_glib
+Cflags: -I${includedir}