`make style` applied
diff --git a/compiler/cpp/src/generate/t_c_glib_generator.cc b/compiler/cpp/src/generate/t_c_glib_generator.cc
index 098f63b..dfdd4ef 100644
--- a/compiler/cpp/src/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/generate/t_c_glib_generator.cc
@@ -1804,9 +1804,9 @@
indent(f_service_) << function_signature(&implementing_function) << endl;
scope_up(f_service_);
- f_service_ << indent() << "g_return_val_if_fail (" << this->nspace_uc << "IS_" << service_name_uc
- << "_HANDLER (iface), FALSE);" << endl << endl << indent() << "return " << class_name_uc
- << "_GET_CLASS (iface)"
+ f_service_ << indent() << "g_return_val_if_fail (" << this->nspace_uc << "IS_"
+ << service_name_uc << "_HANDLER (iface), FALSE);" << endl << endl << indent()
+ << "return " << class_name_uc << "_GET_CLASS (iface)"
<< "->" << method_name << " (iface, ";
if (!return_type->is_void()) {
diff --git a/compiler/cpp/src/generate/t_cocoa_generator.cc b/compiler/cpp/src/generate/t_cocoa_generator.cc
index e3e1842..a90c937 100644
--- a/compiler/cpp/src/generate/t_cocoa_generator.cc
+++ b/compiler/cpp/src/generate/t_cocoa_generator.cc
@@ -136,9 +136,11 @@
void generate_cocoa_service_client_interface(std::ofstream& out, t_service* tservice);
void generate_cocoa_service_client_async_interface(std::ofstream& out, t_service* tservice);
- void generate_cocoa_service_client_send_function_implementation(ofstream& out, t_function* tfunction);
+ void generate_cocoa_service_client_send_function_implementation(ofstream& out,
+ t_function* tfunction);
void generate_cocoa_service_client_send_function_invocation(ofstream& out, t_function* tfunction);
- void generate_cocoa_service_client_recv_function_implementation(ofstream& out, t_function* tfunction);
+ void generate_cocoa_service_client_recv_function_implementation(ofstream& out,
+ t_function* tfunction);
void generate_cocoa_service_client_implementation(std::ofstream& out, t_service* tservice);
void generate_cocoa_service_client_async_implementation(std::ofstream& out, t_service* tservice);
@@ -1229,7 +1231,7 @@
generate_cocoa_service_helpers(tservice);
generate_cocoa_service_client_implementation(f_impl_, tservice);
generate_cocoa_service_server_implementation(f_impl_, tservice);
- if(async_clients_) {
+ if (async_clients_) {
generate_cocoa_service_async_protocol(f_header_, tservice);
generate_cocoa_service_client_async_interface(f_header_, tservice);
generate_cocoa_service_client_async_implementation(f_impl_, tservice);
@@ -1324,7 +1326,8 @@
* @param tservice The service to generate a protocol definition for
*/
void t_cocoa_generator::generate_cocoa_service_async_protocol(ofstream& out, t_service* tservice) {
- out << "@protocol " << cocoa_prefix_ << tservice->get_name() << "Async" << " <NSObject>" << endl;
+ out << "@protocol " << cocoa_prefix_ << tservice->get_name() << "Async"
+ << " <NSObject>" << endl;
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::iterator f_iter;
@@ -1393,8 +1396,9 @@
out << "@end" << endl << endl;
}
-void t_cocoa_generator::generate_cocoa_service_client_send_function_implementation(ofstream& out,
- t_function* tfunction) {
+void t_cocoa_generator::generate_cocoa_service_client_send_function_implementation(
+ ofstream& out,
+ t_function* tfunction) {
string funname = tfunction->get_name();
t_function send_function(g_type_void,
@@ -1446,8 +1450,9 @@
out << endl;
}
-void t_cocoa_generator::generate_cocoa_service_client_recv_function_implementation(ofstream& out,
- t_function* tfunction) {
+void t_cocoa_generator::generate_cocoa_service_client_recv_function_implementation(
+ ofstream& out,
+ t_function* tfunction) {
t_struct noargs(program_);
t_function recv_function(tfunction->get_returntype(),
string("recv_") + tfunction->get_name(),
@@ -1468,8 +1473,8 @@
// FIXME - could optimize here to reduce creation of temporary objects.
string resultname = function_result_helper_struct_type(tfunction);
- out << indent() << cocoa_prefix_ << resultname << " * result = [[[" << cocoa_prefix_
- << resultname << " alloc] init] autorelease_stub];" << endl;
+ out << indent() << cocoa_prefix_ << resultname << " * result = [[[" << cocoa_prefix_ << resultname
+ << " alloc] init] autorelease_stub];" << endl;
indent(out) << "[result read: inProtocol];" << endl;
indent(out) << "[inProtocol readMessageEnd];" << endl;
@@ -1483,9 +1488,8 @@
const std::vector<t_field*>& xceptions = xs->get_members();
vector<t_field*>::const_iterator x_iter;
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
- out << indent() << "if ([result " << (*x_iter)->get_name() << "IsSet]) {" << endl
- << indent() << " @throw [result " << (*x_iter)->get_name() << "];" << endl << indent()
- << "}" << endl;
+ out << indent() << "if ([result " << (*x_iter)->get_name() << "IsSet]) {" << endl << indent()
+ << " @throw [result " << (*x_iter)->get_name() << "];" << endl << indent() << "}" << endl;
}
// If you get here it's an exception, unless a void function
@@ -1508,8 +1512,9 @@
*
* @param tfunction The service to generate an implementation for
*/
-void t_cocoa_generator::generate_cocoa_service_client_send_function_invocation(ofstream& out,
- t_function* tfunction) {
+void t_cocoa_generator::generate_cocoa_service_client_send_function_invocation(
+ ofstream& out,
+ t_function* tfunction) {
t_struct* arg_struct = tfunction->get_arglist();
const vector<t_field*>& fields = arg_struct->get_members();
vector<t_field*>::const_iterator fld_iter;
@@ -1558,7 +1563,7 @@
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::const_iterator f_iter;
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-
+
generate_cocoa_service_client_send_function_implementation(out, *f_iter);
if (!(*f_iter)->is_oneway()) {
@@ -1569,7 +1574,7 @@
indent(out) << "- " << function_signature(*f_iter) << endl;
scope_up(out);
generate_cocoa_service_client_send_function_invocation(out, *f_iter);
-
+
out << indent() << "[[outProtocol transport] flush];" << endl;
if (!(*f_iter)->is_oneway()) {
out << indent();
@@ -1592,13 +1597,14 @@
*/
void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ofstream& out,
t_service* tservice) {
- out << "@implementation " << cocoa_prefix_ << tservice->get_name() << "ClientAsync" << endl << endl
- << "- (id) initWithProtocolFactory: (id <TProtocolFactory>) factory "
- "transport: (id <TAsyncTransport>) transport;" << endl;
+ out << "@implementation " << cocoa_prefix_ << tservice->get_name() << "ClientAsync" << endl
+ << endl << "- (id) initWithProtocolFactory: (id <TProtocolFactory>) factory "
+ "transport: (id <TAsyncTransport>) transport;" << endl;
scope_up(out);
out << indent() << "self = [super init];" << endl;
- out << indent() << "inProtocol = [[factory newProtocolOnTransport:transport] retain_stub];" << endl;
+ out << indent() << "inProtocol = [[factory newProtocolOnTransport:transport] retain_stub];"
+ << endl;
out << indent() << "outProtocol = inProtocol;" << endl;
out << indent() << "asyncTransport = transport;" << endl;
out << indent() << "return self;" << endl;
@@ -1609,7 +1615,7 @@
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::const_iterator f_iter;
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-
+
generate_cocoa_service_client_send_function_implementation(out, *f_iter);
if (!(*f_iter)->is_oneway()) {
@@ -1625,11 +1631,10 @@
indent_down();
out << indent() << "} @catch(TException * texception) {" << endl;
indent_up();
- out << indent() << "failureBlock(texception);" << endl
- << indent() << "return;" << endl;
+ out << indent() << "failureBlock(texception);" << endl << indent() << "return;" << endl;
indent_down();
indent(out) << "}" << endl;
-
+
out << indent() << "[asyncTransport flush:^{" << endl;
indent_up();
@@ -2719,10 +2724,9 @@
if (!ttype->is_void()) {
response_param = "void (^)(" + type_name(ttype) + ")";
}
- std::string result = "(void) " + tfunction->get_name()
- + argument_list(tfunction->get_arglist())
- + (targlist->get_members().size() ? " response" : "")
- + ": (" + response_param + ") responseBlock "
+ std::string result = "(void) " + tfunction->get_name() + argument_list(tfunction->get_arglist())
+ + (targlist->get_members().size() ? " response" : "") + ": ("
+ + response_param + ") responseBlock "
+ "failure : (TAsyncFailureBlock) failureBlock";
return result;
}
diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc
index 586ab75..d6aad75 100644
--- a/compiler/cpp/src/generate/t_csharp_generator.cc
+++ b/compiler/cpp/src/generate/t_csharp_generator.cc
@@ -1719,7 +1719,7 @@
scope_up(f_service_);
t_struct* xs = (*f_iter)->get_xceptions();
- prepare_member_name_mapping(xs,xs->get_members(),resultname);
+ prepare_member_name_mapping(xs, xs->get_members(), resultname);
f_service_ << indent() << "TMessage msg = iprot_.ReadMessageBegin();" << endl << indent()
<< "if (msg.Type == TMessageType.Exception) {" << endl;
@@ -1945,7 +1945,7 @@
if (!tfunction->is_oneway() && xceptions.size() > 0) {
indent_down();
f_service_ << indent() << "}";
- prepare_member_name_mapping(xs,xs->get_members(),resultname);
+ prepare_member_name_mapping(xs, xs->get_members(), resultname);
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
f_service_ << " catch (" << type_name((*x_iter)->get_type(), false, false) << " "
<< (*x_iter)->get_name() << ") {" << endl;
@@ -2512,11 +2512,10 @@
// current C# generator policy:
// - prop names are always rendered with an Uppercase first letter
// - struct names are used as given
-
-
+
// prevent name conflicts with struct (CS0542 error)
used_member_names.insert(structname);
-
+
// prevent name conflicts with known methods (THRIFT-2942)
used_member_names.insert("Read");
used_member_names.insert("Write");
diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/generate/t_go_generator.cc
index 82340fd..0030d24 100644
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/generate/t_go_generator.cc
@@ -134,9 +134,9 @@
const string& tstruct_name,
bool is_result = false);
void generate_countsetfields_helper(std::ofstream& out,
- t_struct* tstruct,
- const string& tstruct_name,
- bool is_result = false);
+ t_struct* tstruct,
+ const string& tstruct_name,
+ bool is_result = false);
void generate_go_struct_reader(std::ofstream& out,
t_struct* tstruct,
const string& tstruct_name,
@@ -413,21 +413,22 @@
std::string t_go_generator::camelcase(const std::string& value) const {
std::string value2(value);
std::setlocale(LC_ALL, "C"); // set locale to classic
-
- // as long as we are changing things, let's change _ followed by lowercase to capital and fix common initialisms
+
+ // as long as we are changing things, let's change _ followed by lowercase to capital and fix
+ // common initialisms
for (std::string::size_type i = 1; i < value2.size() - 1; ++i) {
- if (value2[i] == '_'){
+ if (value2[i] == '_') {
if (islower(value2[i + 1])) {
value2.replace(i, 2, 1, toupper(value2[i + 1]));
}
- std::string word = value2.substr(i,value2.find('_', i));
+ std::string word = value2.substr(i, value2.find('_', i));
std::transform(word.begin(), word.end(), word.begin(), ::toupper);
if (commonInitialisms.find(word) != commonInitialisms.end()) {
- value2.replace(i, word.length(), word);
+ value2.replace(i, word.length(), word);
}
}
}
-
+
return value2;
}
@@ -878,16 +879,16 @@
f_types_ << indent() << " " << tenum_name << "_" << iter_name << ' ' << tenum_name << " = "
<< value << endl;
// Dictionaries to/from string names of enums
- to_string_mapping << indent() << " case " << tenum_name << "_" << iter_name
- << ": return \"" << iter_std_name << "\"" << endl;
+ to_string_mapping << indent() << " case " << tenum_name << "_" << iter_name << ": return \""
+ << iter_std_name << "\"" << endl;
if (iter_std_name != escape_string(iter_name)) {
from_string_mapping << indent() << " case \"" << iter_std_name << "\", \""
- << escape_string(iter_name) << "\": return " << tenum_name
- << "_" << iter_name << ", nil " << endl;
+ << escape_string(iter_name) << "\": return " << tenum_name << "_"
+ << iter_name << ", nil " << endl;
} else {
- from_string_mapping << indent() << " case \"" << iter_std_name << "\": return "
- << tenum_name << "_" << iter_name << ", nil " << endl;
+ from_string_mapping << indent() << " case \"" << iter_std_name << "\": return " << tenum_name
+ << "_" << iter_name << ", nil " << endl;
}
}
@@ -1188,9 +1189,8 @@
if (it != (*m_iter)->annotations_.end()) {
gotag = it->second;
}
- indent(out) << publicize((*m_iter)->get_name()) << " " << goType
- << " `thrift:\"" << escape_string((*m_iter)->get_name()) << ","
- << sorted_keys_pos;
+ indent(out) << publicize((*m_iter)->get_name()) << " " << goType << " `thrift:\""
+ << escape_string((*m_iter)->get_name()) << "," << sorted_keys_pos;
if ((*m_iter)->get_req() == t_field::T_REQUIRED) {
out << ",required";
@@ -1248,7 +1248,6 @@
}
}
-
if (tstruct->is_union() && num_setable > 0) {
generate_countsetfields_helper(out, tstruct, tstruct_name, is_result);
}
@@ -1285,8 +1284,7 @@
const string escaped_tstruct_name(escape_string(tstruct->get_name()));
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
- const string field_name(
- publicize(escape_string((*f_iter)->get_name())));
+ const string field_name(publicize(escape_string((*f_iter)->get_name())));
if ((*f_iter)->get_req() == t_field::T_OPTIONAL || is_pointer_field(*f_iter)) {
out << indent() << "func (p *" << tstruct_name << ") IsSet" << field_name << "() bool {"
<< endl;
@@ -1316,16 +1314,15 @@
* Generates the CountSetFields helper method for a struct
*/
void t_go_generator::generate_countsetfields_helper(ofstream& out,
- t_struct* tstruct,
- const string& tstruct_name,
- bool is_result) {
+ t_struct* tstruct,
+ const string& tstruct_name,
+ bool is_result) {
(void)is_result;
const vector<t_field*>& fields = tstruct->get_members();
vector<t_field*>::const_iterator f_iter;
const string escaped_tstruct_name(escape_string(tstruct->get_name()));
- out << indent() << "func (p *" << tstruct_name << ") CountSetFields" << tstruct_name
- << "() int {"
+ out << indent() << "func (p *" << tstruct_name << ") CountSetFields" << tstruct_name << "() int {"
<< endl;
indent_up();
out << indent() << "count := 0" << endl;
@@ -1336,8 +1333,7 @@
if (!is_pointer_field(*f_iter))
continue;
- const string field_name(
- publicize(escape_string((*f_iter)->get_name())));
+ const string field_name(publicize(escape_string((*f_iter)->get_name())));
out << indent() << "if (p.IsSet" << field_name << "()) {" << endl;
indent_up();
@@ -1351,7 +1347,6 @@
out << indent() << "}" << endl << endl;
}
-
/**
* Generates the read method for a struct
*/
@@ -1374,8 +1369,7 @@
// Required variables does not have IsSet functions, so we need tmp vars to check them.
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
if ((*f_iter)->get_req() == t_field::T_REQUIRED) {
- const string field_name(
- publicize(escape_string((*f_iter)->get_name())));
+ const string field_name(publicize(escape_string((*f_iter)->get_name())));
indent(out) << "var isset" << field_name << " bool = false;" << endl;
}
}
@@ -1430,8 +1424,7 @@
// Mark required field as read
if ((*f_iter)->get_req() == t_field::T_REQUIRED) {
- const string field_name(
- publicize(escape_string((*f_iter)->get_name())));
+ const string field_name(publicize(escape_string((*f_iter)->get_name())));
out << indent() << "isset" << field_name << " = true" << endl;
}
@@ -1469,8 +1462,7 @@
// Return error if any required fields are missing.
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
if ((*f_iter)->get_req() == t_field::T_REQUIRED) {
- const string field_name(
- publicize(escape_string((*f_iter)->get_name())));
+ const string field_name(publicize(escape_string((*f_iter)->get_name())));
out << indent() << "if !isset" << field_name << "{" << endl;
out << indent() << " return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, "
"fmt.Errorf(\"Required field " << field_name << " is not set\"));" << endl;
@@ -1517,8 +1509,9 @@
if (tstruct->is_union() && uses_countsetfields) {
std::string tstruct_name(publicize(tstruct->get_name()));
out << indent() << "if c := p.CountSetFields" << tstruct_name << "(); c != 1 {" << endl
- << indent() << " return fmt.Errorf(\"%T write union: exactly one field must be set (%d set).\", p, c)" << endl
- << indent() << "}" << endl;
+ << indent()
+ << " return fmt.Errorf(\"%T write union: exactly one field must be set (%d set).\", p, c)"
+ << endl << indent() << "}" << endl;
}
out << indent() << "if err := oprot.WriteStructBegin(\"" << name << "\"); err != nil {" << endl;
out << indent() << " return thrift.PrependError(fmt.Sprintf("
@@ -1572,8 +1565,7 @@
indent_up();
if (field_required == t_field::T_OPTIONAL) {
- out << indent() << "if p.IsSet" << publicize(field_name) << "() {"
- << endl;
+ out << indent() << "if p.IsSet" << publicize(field_name) << "() {" << endl;
indent_up();
}
@@ -1883,8 +1875,8 @@
f_service_ << indent() << "args := " << argsname << "{" << endl;
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
- f_service_ << indent() << publicize((*fld_iter)->get_name())
- << " : " << variable_name_to_go_name((*fld_iter)->get_name()) << "," << endl;
+ f_service_ << indent() << publicize((*fld_iter)->get_name()) << " : "
+ << variable_name_to_go_name((*fld_iter)->get_name()) << "," << endl;
}
f_service_ << indent() << "}" << endl;
@@ -2030,7 +2022,7 @@
while ((loc = service_module.find(".")) != string::npos) {
service_module.replace(loc, 1, 1, '/');
}
- if(!gen_package_prefix_.empty()) {
+ if (!gen_package_prefix_.empty()) {
service_module = gen_package_prefix_ + service_module;
}
@@ -2631,8 +2623,7 @@
for (xf_iter = x_fields.begin(); xf_iter != x_fields.end(); ++xf_iter) {
f_service_ << indent() << " case " << type_to_go_type(((*xf_iter)->get_type())) << ":"
<< endl;
- f_service_ << indent() << "result."
- << publicize((*xf_iter)->get_name()) << " = v" << endl;
+ f_service_ << indent() << "result." << publicize((*xf_iter)->get_name()) << " = v" << endl;
}
f_service_ << indent() << " default:" << endl;
@@ -2731,11 +2722,10 @@
} else if (type->is_base_type() || type->is_enum()) {
if (declare) {
- t_type* actual_type = use_true_type ? tfield->get_type()->get_true_type()
+ t_type* actual_type = use_true_type ? tfield->get_type()->get_true_type()
: tfield->get_type();
- string type_name = inkey ? type_to_go_key_type(actual_type)
- : type_to_go_type(actual_type);
+ string type_name = inkey ? type_to_go_key_type(actual_type) : type_to_go_type(actual_type);
out << "var " << tfield->get_name() << " " << type_name << endl;
}
diff --git a/compiler/cpp/src/generate/t_gv_generator.cc b/compiler/cpp/src/generate/t_gv_generator.cc
index 59e06a0..b70f2ca 100644
--- a/compiler/cpp/src/generate/t_gv_generator.cc
+++ b/compiler/cpp/src/generate/t_gv_generator.cc
@@ -301,8 +301,7 @@
f_out_ << "function_" << service_name << fn_name;
f_out_ << "[label=\"<return_type>function " << escape_string(fn_name);
f_out_ << " :: ";
- print_type((*fn_iter)->get_returntype(),
- "function_" + service_name + fn_name + ":return_type");
+ print_type((*fn_iter)->get_returntype(), "function_" + service_name + fn_name + ":return_type");
vector<t_field*> args = (*fn_iter)->get_arglist()->get_members();
vector<t_field*>::iterator arg_iter = args.begin();
@@ -314,8 +313,8 @@
print_const_value((*arg_iter)->get_type(), (*arg_iter)->get_value());
}
f_out_ << " :: ";
- print_type((*arg_iter)->get_type(), "function_" + service_name + fn_name
- + ":param_" + (*arg_iter)->get_name());
+ print_type((*arg_iter)->get_type(),
+ "function_" + service_name + fn_name + ":param_" + (*arg_iter)->get_name());
}
// end of node
f_out_ << "\"];" << endl;
diff --git a/compiler/cpp/src/generate/t_haxe_generator.cc b/compiler/cpp/src/generate/t_haxe_generator.cc
index 3c4dadf..a0e2f28 100644
--- a/compiler/cpp/src/generate/t_haxe_generator.cc
+++ b/compiler/cpp/src/generate/t_haxe_generator.cc
@@ -200,7 +200,8 @@
t_base_type::t_base tbase = ((t_base_type*)ttype)->get_base();
switch (tbase) {
case t_base_type::TYPE_STRING:
- //case t_base_type::TYPE_I64: - Int64 is not really nullable, even though it behaved that way before Haxe 3.2.0
+ // case t_base_type::TYPE_I64: - Int64 is not really nullable, even though it behaved that
+ // way before Haxe 3.2.0
return true;
default:
return false;
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index c45c798..8c05d4a 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -398,8 +398,7 @@
}
if (use_option_type_) {
- option = string() +
- "import org.apache.thrift.Option;\n";
+ option = string() + "import org.apache.thrift.Option;\n";
}
return string() + hash_builder + "import org.apache.thrift.scheme.IScheme;\n"
@@ -702,7 +701,7 @@
} else if (type->is_enum()) {
std::string namespace_prefix = type->get_program()->get_namespace("java");
if (namespace_prefix.length() > 0) {
- namespace_prefix += ".";
+ namespace_prefix += ".";
}
render << namespace_prefix << value->get_identifier_with_parent();
} else {
@@ -2164,8 +2163,8 @@
out << get_cap_name("size() {") << endl;
indent_up();
- indent(out) << "return (this." << field_name << " == null) ? 0 : " <<
- "this." << field_name << ".size();" << endl;
+ indent(out) << "return (this." << field_name << " == null) ? 0 : "
+ << "this." << field_name << ".size();" << endl;
indent_down();
indent(out) << "}" << endl << endl;
}
@@ -2181,8 +2180,8 @@
// Iterator getter for sets and lists
if (optional) {
- indent(out) << "public Option<java.util.Iterator<" <<
- type_name(element_type, true, false) << ">> get" << cap_name;
+ indent(out) << "public Option<java.util.Iterator<" << type_name(element_type, true, false)
+ << ">> get" << cap_name;
out << get_cap_name("iterator() {") << endl;
indent_up();
@@ -2198,13 +2197,13 @@
indent_down();
indent(out) << "}" << endl << endl;
} else {
- indent(out) << "public java.util.Iterator<" <<
- type_name(element_type, true, false) << "> get" << cap_name;
+ indent(out) << "public java.util.Iterator<" << type_name(element_type, true, false)
+ << "> get" << cap_name;
out << get_cap_name("iterator() {") << endl;
indent_up();
- indent(out) << "return (this." << field_name << " == null) ? null : " <<
- "this." << field_name << ".iterator();" << endl;
+ indent(out) << "return (this." << field_name << " == null) ? null : "
+ << "this." << field_name << ".iterator();" << endl;
indent_down();
indent(out) << "}" << endl << endl;
}
@@ -2264,8 +2263,7 @@
} else {
if (optional) {
indent(out) << "public Option<" << type_name(type, true) << ">";
- if (type->is_base_type() &&
- ((t_base_type*)type)->get_base() == t_base_type::TYPE_BOOL) {
+ if (type->is_base_type() && ((t_base_type*)type)->get_base() == t_base_type::TYPE_BOOL) {
out << " is";
} else {
out << " get";
@@ -2286,8 +2284,7 @@
indent(out) << "}" << endl << endl;
} else {
indent(out) << "public " << type_name(type);
- if (type->is_base_type() &&
- ((t_base_type*)type)->get_base() == t_base_type::TYPE_BOOL) {
+ if (type->is_base_type() && ((t_base_type*)type)->get_base() == t_base_type::TYPE_BOOL) {
out << " is";
} else {
out << " get";
@@ -2426,17 +2423,20 @@
indent_up();
}
- if (get_true_type(field->get_type())->is_base_type() && ((t_base_type*)(get_true_type(field->get_type())))->is_binary()) {
+ if (get_true_type(field->get_type())->is_base_type()
+ && ((t_base_type*)(get_true_type(field->get_type())))->is_binary()) {
indent(out) << "org.apache.thrift.TBaseHelper.toString(this." << field->get_name() << ", sb);"
<< endl;
- } else if ((field->get_type()->is_set()) &&
- (get_true_type(((t_set*) field->get_type())->get_elem_type())->is_base_type()) &&
- (((t_base_type*) get_true_type(((t_set*) field->get_type())->get_elem_type()))->is_binary())) {
+ } else if ((field->get_type()->is_set())
+ && (get_true_type(((t_set*)field->get_type())->get_elem_type())->is_base_type())
+ && (((t_base_type*)get_true_type(((t_set*)field->get_type())->get_elem_type()))
+ ->is_binary())) {
indent(out) << "org.apache.thrift.TBaseHelper.toString(this." << field->get_name() << ", sb);"
<< endl;
- } else if ((field->get_type()->is_list()) &&
- (get_true_type(((t_list*) field->get_type())->get_elem_type())->is_base_type()) &&
- (((t_base_type*) get_true_type(((t_list*) field->get_type())->get_elem_type()))->is_binary())) {
+ } else if ((field->get_type()->is_list())
+ && (get_true_type(((t_list*)field->get_type())->get_elem_type())->is_base_type())
+ && (((t_base_type*)get_true_type(((t_list*)field->get_type())->get_elem_type()))
+ ->is_binary())) {
indent(out) << "org.apache.thrift.TBaseHelper.toString(this." << field->get_name() << ", sb);"
<< endl;
} else {
@@ -3681,14 +3681,13 @@
indent(out) << prefix << ".put(" << key << ", " << val << ");" << endl;
- if ( reuse_objects_ && !get_true_type(fkey.get_type())->is_base_type()) {
+ if (reuse_objects_ && !get_true_type(fkey.get_type())->is_base_type()) {
indent(out) << key << " = null;" << endl;
}
- if ( reuse_objects_ && !get_true_type(fval.get_type())->is_base_type()) {
+ if (reuse_objects_ && !get_true_type(fval.get_type())->is_base_type()) {
indent(out) << val << " = null;" << endl;
}
-
}
/**
@@ -3715,10 +3714,9 @@
indent(out) << prefix << ".add(" << elem << ");" << endl;
- if ( reuse_objects_ && !get_true_type(felem.get_type())->is_base_type()) {
+ if (reuse_objects_ && !get_true_type(felem.get_type())->is_base_type()) {
indent(out) << elem << " = null;" << endl;
}
-
}
/**
@@ -3745,10 +3743,9 @@
indent(out) << prefix << ".add(" << elem << ");" << endl;
- if ( reuse_objects_ && !get_true_type(felem.get_type())->is_base_type()) {
+ if (reuse_objects_ && !get_true_type(felem.get_type())->is_base_type()) {
indent(out) << elem << " = null;" << endl;
}
-
}
/**
@@ -4723,7 +4720,7 @@
if (reuse_objects_ && (t->is_container() || t->is_struct())) {
indent(out) << "if (this." << field->get_name() << " != null) {" << endl;
indent_up();
- indent(out) << "this." << field->get_name() << ".clear();" << endl;
+ indent(out) << "this." << field->get_name() << ".clear();" << endl;
indent_down();
indent(out) << "}" << endl;
@@ -5096,10 +5093,8 @@
time_t seconds = time(NULL);
struct tm* now = localtime(&seconds);
indent(out) << "@Generated(value = \"" << autogen_summary() << "\", date = \""
- << (now->tm_year + 1900)
- << "-" << setfill('0') << setw(2) << (now->tm_mon + 1)
- << "-" << setfill('0') << setw(2) << now->tm_mday << "\")"
- << endl;
+ << (now->tm_year + 1900) << "-" << setfill('0') << setw(2) << (now->tm_mon + 1) << "-"
+ << setfill('0') << setw(2) << now->tm_mday << "\")" << endl;
}
THRIFT_REGISTER_GENERATOR(
diff --git a/compiler/cpp/src/generate/t_lua_generator.cc b/compiler/cpp/src/generate/t_lua_generator.cc
index 1b3dac6..3ca8ae0 100644
--- a/compiler/cpp/src/generate/t_lua_generator.cc
+++ b/compiler/cpp/src/generate/t_lua_generator.cc
@@ -93,11 +93,20 @@
/**
* Deserialization (Read)
*/
- void generate_deserialize_field(std::ofstream& out, t_field* tfield, bool local, std::string prefix = "");
+ void generate_deserialize_field(std::ofstream& out,
+ t_field* tfield,
+ bool local,
+ std::string prefix = "");
- void generate_deserialize_struct(std::ofstream& out, t_struct* tstruct, bool local, std::string prefix = "");
+ void generate_deserialize_struct(std::ofstream& out,
+ t_struct* tstruct,
+ bool local,
+ std::string prefix = "");
- void generate_deserialize_container(std::ofstream& out, t_type* ttype, bool local, std::string prefix = "");
+ void generate_deserialize_container(std::ofstream& out,
+ t_type* ttype,
+ bool local,
+ std::string prefix = "");
void generate_deserialize_set_element(std::ofstream& out, t_set* tset, std::string prefix = "");
@@ -747,7 +756,10 @@
/**
* Deserialize (Read)
*/
-void t_lua_generator::generate_deserialize_field(ofstream& out, t_field* tfield, bool local, string prefix) {
+void t_lua_generator::generate_deserialize_field(ofstream& out,
+ t_field* tfield,
+ bool local,
+ string prefix) {
t_type* type = get_true_type(tfield->get_type());
if (type->is_void()) {
@@ -805,12 +817,18 @@
}
}
-void t_lua_generator::generate_deserialize_struct(ofstream& out, t_struct* tstruct, bool local, string prefix) {
- indent(out) << (local ? "local " : "") << prefix << " = " << tstruct->get_name() << ":new{}" << endl << indent() << prefix
- << ":read(iprot)" << endl;
+void t_lua_generator::generate_deserialize_struct(ofstream& out,
+ t_struct* tstruct,
+ bool local,
+ string prefix) {
+ indent(out) << (local ? "local " : "") << prefix << " = " << tstruct->get_name() << ":new{}"
+ << endl << indent() << prefix << ":read(iprot)" << endl;
}
-void t_lua_generator::generate_deserialize_container(ofstream& out, t_type* ttype, bool local, string prefix) {
+void t_lua_generator::generate_deserialize_container(ofstream& out,
+ t_type* ttype,
+ bool local,
+ string prefix) {
string size = tmp("_size");
string ktype = tmp("_ktype");
string vtype = tmp("_vtype");
diff --git a/compiler/cpp/src/generate/t_rb_generator.cc b/compiler/cpp/src/generate/t_rb_generator.cc
index 9dac54a..b25c248 100644
--- a/compiler/cpp/src/generate/t_rb_generator.cc
+++ b/compiler/cpp/src/generate/t_rb_generator.cc
@@ -754,11 +754,12 @@
if (tservice->get_extends() != NULL) {
if (namespaced_) {
- f_service_ << "require '" << rb_namespace_to_path_prefix(tservice->get_extends()->get_program()->get_namespace("rb")) << underscore(tservice->get_extends()->get_name())
- << "'" << endl;
+ f_service_ << "require '" << rb_namespace_to_path_prefix(
+ tservice->get_extends()->get_program()->get_namespace("rb"))
+ << underscore(tservice->get_extends()->get_name()) << "'" << endl;
} else {
- f_service_ << "require '" << require_prefix_ << underscore(tservice->get_extends()->get_name())
- << "'" << endl;
+ f_service_ << "require '" << require_prefix_
+ << underscore(tservice->get_extends()->get_name()) << "'" << endl;
}
}
diff --git a/compiler/cpp/src/parse/t_enum.h b/compiler/cpp/src/parse/t_enum.h
index 12b4ad8..7b6a020 100644
--- a/compiler/cpp/src/parse/t_enum.h
+++ b/compiler/cpp/src/parse/t_enum.h
@@ -31,7 +31,7 @@
public:
t_enum(t_program* program) : t_type(program) {}
- void set_name(const std::string &name) { name_ = name; }
+ void set_name(const std::string& name) { name_ = name; }
void append(t_enum_value* constant) { constants_.push_back(constant); }