compiler: remove trailing whitespaces
diff --git a/compiler/cpp/src/generate/t_as3_generator.cc b/compiler/cpp/src/generate/t_as3_generator.cc
index e84ab0d..aacc77d 100644
--- a/compiler/cpp/src/generate/t_as3_generator.cc
+++ b/compiler/cpp/src/generate/t_as3_generator.cc
@@ -53,10 +53,10 @@
{
(void) option_string;
std::map<std::string, std::string>::const_iterator iter;
-
+
iter = parsed_options.find("bindable");
bindable_ = (iter != parsed_options.end());
-
+
out_dir_base_ = "gen-as3";
}
@@ -110,13 +110,13 @@
std::string generate_isset_check(std::string field);
void generate_isset_set(ofstream& out, t_field* field);
//removed std::string isset_field_id(t_field* field);
-
+
void generate_service_interface (t_service* tservice);
void generate_service_helpers (t_service* tservice);
void generate_service_client (t_service* tservice);
void generate_service_server (t_service* tservice);
void generate_process_function (t_service* tservice, t_function* tfunction);
-
+
/**
* Serialization constructs
*/
@@ -183,8 +183,8 @@
std::string as3_package();
std::string as3_type_imports();
std::string as3_thrift_imports();
- std::string as3_thrift_gen_imports(t_struct* tstruct, string& imports);
- std::string as3_thrift_gen_imports(t_service* tservice);
+ std::string as3_thrift_gen_imports(t_struct* tstruct, string& imports);
+ std::string as3_thrift_gen_imports(t_service* tservice);
std::string type_name(t_type* ttype, bool in_container=false, bool in_init=false);
std::string base_type_name(t_base_type* tbase, bool in_container=false);
std::string declare_field(t_field* tfield, bool init=false);
@@ -214,8 +214,8 @@
std::string package_name_;
std::ofstream f_service_;
std::string package_dir_;
-
- bool bindable_;
+
+ bool bindable_;
};
@@ -306,7 +306,7 @@
}
}
}
- return imports;
+ return imports;
}
@@ -332,11 +332,11 @@
}
}
- as3_thrift_gen_imports((*f_iter)->get_arglist(), imports);
- as3_thrift_gen_imports((*f_iter)->get_xceptions(), imports);
+ as3_thrift_gen_imports((*f_iter)->get_arglist(), imports);
+ as3_thrift_gen_imports((*f_iter)->get_xceptions(), imports);
}
-
+
return imports;
}
@@ -372,13 +372,13 @@
f_enum <<
autogen_comment() <<
as3_package() << endl;
-
+
scope_up(f_enum);
// Add as3 imports
f_enum << string() +
"import org.apache.thrift.Set;" << endl <<
"import flash.utils.Dictionary;" << endl;
-
+
indent(f_enum) <<
"public class " << tenum->get_name() << " ";
scope_up(f_enum);
@@ -391,10 +391,10 @@
"public static const " << (*c_iter)->get_name() <<
":int = " << value << ";" << endl;
}
-
+
// Create a static Set with all valid values for this enum
f_enum << endl;
-
+
indent(f_enum) << "public static const VALID_VALUES:Set = new Set(";
indent_up();
bool firstValue = true;
@@ -413,13 +413,13 @@
indent(f_enum) << "VALUES_TO_NAMES[" << (*c_iter)->get_name() << "] = \"" << (*c_iter)->get_name() << "\";" << endl;
}
f_enum << endl;
-
+
scope_down(f_enum);
scope_down(f_enum); // end class
-
+
scope_down(f_enum); // end package
-
+
f_enum.close();
}
@@ -438,14 +438,14 @@
// Print header
f_consts <<
autogen_comment() << as3_package();
-
+
scope_up(f_consts);
f_consts << endl;
-
+
f_consts << as3_type_imports();
-
-
+
+
indent(f_consts) <<
"public class " << program_name_ << "Constants {" << endl <<
endl;
@@ -467,7 +467,7 @@
void t_as3_generator::print_const_value(std::ofstream& out, string name, t_type* type, t_const_value* value, bool in_static, bool defval) {
type = get_true_type(type);
-
+
indent(out);
if (!defval) {
out <<
@@ -587,7 +587,7 @@
(void) name;
type = get_true_type(type);
std::ostringstream render;
-
+
if (type->is_base_type()) {
t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
switch (tbase) {
@@ -626,7 +626,7 @@
print_const_value(out, t, type, value, true);
render << t;
}
-
+
return render.str();
}
@@ -666,27 +666,27 @@
f_struct <<
autogen_comment() <<
as3_package();
-
+
scope_up(f_struct);
f_struct << endl;
-
+
string imports;
f_struct <<
as3_type_imports() <<
- as3_thrift_imports() <<
+ as3_thrift_imports() <<
as3_thrift_gen_imports(tstruct, imports) << endl;
-
+
if (bindable_ && ! is_exception) {
f_struct << "import flash.events.Event;" << endl <<
"import flash.events.EventDispatcher;" << endl <<
"import mx.events.PropertyChangeEvent;" << endl;
}
-
+
generate_as3_struct_definition(f_struct,
tstruct,
is_exception);
-
+
scope_down(f_struct); // end of package
f_struct.close();
}
@@ -747,9 +747,9 @@
indent(out) << "public static const " << upcase_string((*m_iter)->get_name()) << ":int = " << (*m_iter)->get_key() << ";" << endl;
}
-
+
out << endl;
-
+
// Inner Isset class
if (members.size() > 0) {
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
@@ -759,11 +759,11 @@
}
}
}
-
+
out << endl;
-
+
generate_as3_meta_data_map(out, tstruct);
-
+
// Static initializer to populate global class to struct metadata map
indent(out) << "{" << endl;
indent_up();
@@ -783,7 +783,7 @@
}
indent_down();
indent(out) << "}" << endl << endl;
-
+
generate_as3_bean_boilerplate(out, tstruct, bindable);
generate_generic_field_getters_setters(out, tstruct);
generate_generic_isset_method(out, tstruct);
@@ -880,7 +880,7 @@
out <<
indent() << "iprot.readStructEnd();" << endl << endl;
-
+
// in non-beans style, check for required fields of primitive type
// (which can be checked here but not in the general validate method)
out << endl << indent() << "// check for required fields of primitive type, which can't be checked in the validate method" << endl;
@@ -907,11 +907,11 @@
void t_as3_generator::generate_as3_validator(ofstream& out,
t_struct* tstruct){
indent(out) << "public function validate():void {" << endl;
- indent_up();
-
+ indent_up();
+
const vector<t_field*>& fields = tstruct->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
out << indent() << "// check for required fields" << endl;
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
if ((*f_iter)->get_req() == t_field::T_REQUIRED) {
@@ -924,7 +924,7 @@
}
}
}
-
+
// check that fields of type enum have valid values
out << indent() << "// check that fields of type enum have valid values" << endl;
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
@@ -937,9 +937,9 @@
indent(out) << "throw new TProtocolError(TProtocolError.UNKNOWN, \"The field '" << field->get_name() << "' has been assigned the invalid value \" + " << field->get_name() << ");" << endl;
indent_down();
indent(out) << "}" << endl;
- }
- }
-
+ }
+ }
+
indent_down();
indent(out) << "}" << endl << endl;
}
@@ -1031,7 +1031,7 @@
out << "(this." << generate_isset_check(*f_iter) << ") {" << endl;
indent_up();
-
+
indent(out) << "oprot.writeFieldBegin(" << constant_name((*f_iter)->get_name()) << "_FIELD_DESC);" << endl;
// Write field contents
@@ -1178,7 +1178,7 @@
t_type* type = get_true_type(field->get_type());
std::string field_name = field->get_name();
std::string cap_name = get_cap_name(field_name);
-
+
// Simple getter
generate_as3_doc(out, field);
indent(out) << "public function get " << field_name << "():" <<
@@ -1187,7 +1187,7 @@
indent(out) << "return this._" << field_name << ";" << endl;
indent_down();
indent(out) << "}" << endl << endl;
-
+
// Simple setter
generate_as3_doc(out, field);
std::string propName = tmp("thriftPropertyChange");
@@ -1200,21 +1200,21 @@
indent(out) << "this._" << field_name << " = " << field_name << ";" <<
endl;
generate_isset_set(out, field);
-
+
if (bindable) {
// We have to use a custom event rather than the default, because if you use the default,
// the setter only gets called if the value has changed - this means calling foo.setIntValue(0)
// will not cause foo.isIntValueSet() to return true since the value of foo._intValue wasn't changed
// so the setter was never called.
indent(out) << "dispatchEvent(new Event(\"" << propName << "\"));" << endl;
-
+
// However, if you just use a custom event, then collections won't be able to detect when elements
// in the collections have changed since they listed for PropertyChangeEvents. So, we dispatch both.
indent(out) << "dispatchEvent(new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE));" << endl;
}
indent_down();
indent(out) << "}" << endl << endl;
-
+
// Unsetter
indent(out) << "public function unset" << cap_name << "():void {" << endl;
indent_up();
@@ -1225,7 +1225,7 @@
}
indent_down();
indent(out) << "}" << endl << endl;
-
+
// isSet method
indent(out) << "// Returns true if field " << field_name << " is set (has been assigned a value) and false otherwise" << endl;
indent(out) << "public function is" << get_cap_name("set") << cap_name << "():Boolean {" << endl;
@@ -1278,7 +1278,7 @@
indent(out) << "} else {" << endl;
indent_up();
}
-
+
if (field->get_type()->is_base_type() && ((t_base_type*)(field->get_type()))->is_binary()) {
indent(out) << " ret += \"BINARY\";" << endl;
} else if(field->get_type()->is_enum()) {
@@ -1294,7 +1294,7 @@
} else {
indent(out) << "ret += this." << (*f_iter)->get_name() << ";" << endl;
}
-
+
if (can_be_null) {
indent_down();
indent(out) << "}" << endl;
@@ -1347,7 +1347,7 @@
out << "TFieldRequirementType.DEFAULT, ";
}
- // Create value meta data
+ // Create value meta data
generate_field_value_meta_data(out, field->get_type());
out << ");" << endl;
}
@@ -1355,7 +1355,7 @@
}
}
-/**
+/**
* Returns a string with the as3 representation of the given thrift type
* (e.g. for the type struct it returns "TType.STRUCT")
*/
@@ -1398,12 +1398,12 @@
} else if (type->is_container()){
if (type->is_list()){
indent(out) << "new ListMetaData(TType.LIST, ";
- t_type* elem_type = ((t_list*)type)->get_elem_type();
- generate_field_value_meta_data(out, elem_type);
+ t_type* elem_type = ((t_list*)type)->get_elem_type();
+ generate_field_value_meta_data(out, elem_type);
} else if (type->is_set()){
indent(out) << "new SetMetaData(TType.SET, ";
- t_type* elem_type = ((t_list*)type)->get_elem_type();
- generate_field_value_meta_data(out, elem_type);
+ t_type* elem_type = ((t_list*)type)->get_elem_type();
+ generate_field_value_meta_data(out, elem_type);
} else{ // map
indent(out) << "new MapMetaData(TType.MAP, ";
t_type* key_type = ((t_map*)type)->get_key_type();
@@ -1436,9 +1436,9 @@
f_service_ <<
autogen_comment() << as3_package();
-
+
scope_up(f_service_);
-
+
f_service_ << endl <<
as3_type_imports() <<
as3_thrift_imports() <<
@@ -1458,16 +1458,16 @@
scope_down(f_service_);
f_service_.close();
-
+
// Now make the implementation/client file
f_service_name = package_dir_+"/"+service_name_+"Impl.as";
f_service_.open(f_service_name.c_str());
-
+
f_service_ <<
autogen_comment() << as3_package();
-
+
scope_up(f_service_);
-
+
f_service_ << endl <<
as3_type_imports() <<
as3_thrift_imports() <<
@@ -1486,46 +1486,46 @@
generate_service_client(tservice);
scope_down(f_service_);
-
+
f_service_ << as3_type_imports();
f_service_ << as3_thrift_imports();
f_service_ << as3_thrift_gen_imports(tservice);
if(!package_name_.empty()) {
f_service_ << "import " << package_name_ << ".*;" << endl;
}
-
+
generate_service_helpers(tservice);
-
+
f_service_.close();
-
+
// Now make the processor/server file
f_service_name = package_dir_+"/"+service_name_+"Processor.as";
f_service_.open(f_service_name.c_str());
-
+
f_service_ <<
autogen_comment() << as3_package();
-
+
scope_up(f_service_);
-
+
f_service_ << endl <<
as3_type_imports() <<
as3_thrift_imports() <<
as3_thrift_gen_imports(tservice) << endl;
-
+
generate_service_server(tservice);
scope_down(f_service_);
-
+
f_service_ << as3_type_imports();
f_service_ << as3_thrift_imports();
f_service_ << as3_thrift_gen_imports(tservice) <<endl;
if(!package_name_.empty()) {
f_service_ << "import " << package_name_ << ".*;" << endl;
}
-
+
generate_service_helpers(tservice);
-
+
f_service_.close();
-
+
}
/**
@@ -1670,7 +1670,7 @@
// Get the struct of function call params
t_struct* arg_struct = (*f_iter)->get_arglist();
-
+
string argsname = (*f_iter)->get_name() + "_args";
vector<t_field*>::const_iterator fld_iter;
const vector<t_field*>& fields = arg_struct->get_members();
@@ -1690,7 +1690,7 @@
f_service_ <<
indent() << "args.write(oprot_);" << endl <<
indent() << "oprot_.writeMessageEnd();" << endl;
-
+
if ((*f_iter)->is_oneway()) {
f_service_ << indent() << "oprot_.getTransport().flush();" << endl;
}
@@ -1742,7 +1742,7 @@
indent() << "if (onSuccess != null) onSuccess();" << endl <<
indent() << "return;" << endl;
} else {
-
+
f_service_ <<
indent() << "if (onError != null) onError(new TApplicationError(TApplicationError.MISSING_RESULT, \"" << (*f_iter)->get_name() << " failed: unknown result\"));" << endl;
}
@@ -1750,8 +1750,8 @@
f_service_ << indent() << "} catch (e:TError) {" << endl <<
indent() << " if (onError != null) onError(e);" << endl <<
indent() << "}" << endl;
-
-
+
+
indent_down();
indent(f_service_) <<
"});" << endl;
@@ -1948,7 +1948,7 @@
first = false;
} else {
f_service_ << ", ";
- }
+ }
f_service_ << "args." << (*f_iter)->get_name();
}
f_service_ << ");" << endl;
@@ -2344,7 +2344,7 @@
indent(out) << "for (var " << iter << ":* in " << prefix << ") {" << endl;
indent(out) << " " << counter << +"++;" << endl;
indent(out) << "}" << endl;
-
+
indent(out) <<
"oprot.writeMapBegin(new TMap(" <<
type_to_enum(((t_map*)ttype)->get_key_type()) << ", " <<
@@ -2567,7 +2567,7 @@
arguments += "onError:Function, onSuccess:Function";
}
- std::string result = "function " +
+ std::string result = "function " +
prefix + tfunction->get_name() + "(" + arguments + "):void";
return result;
}
diff --git a/compiler/cpp/src/generate/t_c_glib_generator.cc b/compiler/cpp/src/generate/t_c_glib_generator.cc
index e143171..dbebedb 100644
--- a/compiler/cpp/src/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/generate/t_c_glib_generator.cc
@@ -162,7 +162,7 @@
void generate_deserialize_list_element(ofstream &out, t_list *tlist, string prefix, string index, int error_ret);
string generate_new_hash_from_type(t_type * key, t_type * value);
- string generate_new_array_from_type(t_type * ttype);
+ string generate_new_array_from_type(t_type * ttype);
string generate_free_func_from_type(t_type * ttype);
string generate_hash_func_from_type(t_type * ttype);
@@ -194,7 +194,7 @@
f_types_impl_ << autogen_comment();
/* include inclusion guard */
- f_types_ <<
+ f_types_ <<
"#ifndef " << this->nspace_uc << program_name_uc << "_TYPES_H" << endl <<
"#define " << this->nspace_uc << program_name_uc << "_TYPES_H" << endl <<
endl;
@@ -239,7 +239,7 @@
// include the types file
f_types_impl_ <<
endl <<
- "#include \"" << this->nspace_lc << program_name_u <<
+ "#include \"" << this->nspace_lc << program_name_u <<
"_types.h\"" << endl <<
"#include <thrift/c_glib/thrift.h>" << endl <<
endl;
@@ -252,7 +252,7 @@
* Finish up generation and close all file streams.
*/
void t_c_glib_generator::close_generator() {
- string program_name_uc = to_upper_case
+ string program_name_uc = to_upper_case
(initial_caps_to_underscores(program_name_));
/* end the header inclusion guard */
@@ -266,11 +266,11 @@
/**
* Generates a Thrift typedef in C code. For example:
- *
- * Thrift:
+ *
+ * Thrift:
* typedef map<i32,i32> SomeMap
- *
- * C:
+ *
+ * C:
* typedef GHashTable * ThriftSomeMap;
*/
void t_c_glib_generator::generate_typedef(t_typedef* ttypedef) {
@@ -278,7 +278,7 @@
indent() << "typedef " << type_name(ttypedef->get_type(), true) <<
" " << this->nspace << ttypedef->get_symbolic() << ";" << endl <<
endl;
-}
+}
/**
* Generates a C enumeration. For example:
@@ -846,7 +846,7 @@
"gboolean " + this->nspace_lc + fname + " (" + this->nspace
+ service_name_ + "If * iface"
+ (has_return ? ", " + type_name(ttype) + "* _return" : "")
- + (has_args ? "" : (", " + argument_list (arglist)))
+ + (has_args ? "" : (", " + argument_list (arglist)))
+ (has_xceptions ? "" : (", " + xception_list (xlist)))
+ ", GError ** error)";
}
@@ -1112,7 +1112,7 @@
" }" << endl <<
" return constant;" << endl <<
"}" << endl <<
- endl;
+ endl;
} else if (type->is_map()) {
t_type *ktype = ((t_map *) type)->get_key_type();
t_type *vtype = ((t_map *) type)->get_val_type();
@@ -1284,7 +1284,7 @@
+ (has_args ? "" : (", " + argument_list (arglist)))
+ (has_xceptions ? "" : (", " + xception_list (xlist)))
+ ", GError **error)";
-
+
indent(f_header_) << "gboolean (*" << funname << ") " << params << ";" <<
endl;
}
@@ -1371,29 +1371,29 @@
// Create all the GObject boilerplate
f_header_ <<
- "GType " << this->nspace_lc << service_name_lc <<
+ "GType " << this->nspace_lc << service_name_lc <<
"_client_get_type (void);" << endl <<
"#define " << this->nspace_uc << "TYPE_" << service_name_uc << "_CLIENT " <<
"(" << this->nspace_lc << service_name_lc << "_client_get_type())" <<
endl <<
"#define " << this->nspace_uc << service_name_uc << "_CLIENT(obj) " <<
- "(G_TYPE_CHECK_INSTANCE_CAST ((obj), " <<
- this->nspace_uc << "TYPE_" << service_name_uc << "_CLIENT, " <<
+ "(G_TYPE_CHECK_INSTANCE_CAST ((obj), " <<
+ this->nspace_uc << "TYPE_" << service_name_uc << "_CLIENT, " <<
this->nspace << service_name_ << "Client))" << endl <<
- "#define " << this->nspace_uc << service_name_uc << "_CLIENT_CLASS(c) " <<
- "(G_TYPE_CHECK_CLASS_CAST ((c), " <<
- this->nspace_uc << "TYPE_" << service_name_uc << "_CLIENT, " <<
+ "#define " << this->nspace_uc << service_name_uc << "_CLIENT_CLASS(c) " <<
+ "(G_TYPE_CHECK_CLASS_CAST ((c), " <<
+ this->nspace_uc << "TYPE_" << service_name_uc << "_CLIENT, " <<
this->nspace << service_name_ << "ClientClass))" << endl <<
"#define " << this->nspace_uc << service_name_uc << "_IS_CLIENT(obj) " <<
- "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), " <<
- this->nspace_uc << "TYPE_" << service_name_uc << "_CLIENT))" << endl <<
- "#define " << this->nspace_uc << service_name_uc <<
- "_IS_CLIENT_CLASS(c) " << "(G_TYPE_CHECK_CLASS_TYPE ((c), " <<
+ "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), " <<
this->nspace_uc << "TYPE_" << service_name_uc << "_CLIENT))" << endl <<
"#define " << this->nspace_uc << service_name_uc <<
- "_CLIENT_GET_CLASS(obj) " << "(G_TYPE_INSTANCE_GET_CLASS ((obj), " <<
+ "_IS_CLIENT_CLASS(c) " << "(G_TYPE_CHECK_CLASS_TYPE ((c), " <<
+ this->nspace_uc << "TYPE_" << service_name_uc << "_CLIENT))" << endl <<
+ "#define " << this->nspace_uc << service_name_uc <<
+ "_CLIENT_GET_CLASS(obj) " << "(G_TYPE_INSTANCE_GET_CLASS ((obj), " <<
this->nspace_uc << "TYPE_" << service_name_uc << "_CLIENT, " <<
- this->nspace << service_name_ << "ClientClass))" << endl <<
+ this->nspace << service_name_ << "ClientClass))" << endl <<
endl;
/* write out the function prototypes */
@@ -1418,7 +1418,7 @@
if (!(*f_iter)->is_oneway()) {
t_struct noargs (program_);
t_function recv_function ((*f_iter)->get_returntype(),
- service_name_lc + string ("_client_recv_")
+ service_name_lc + string ("_client_recv_")
+ funname,
&noargs,
(*f_iter)->get_xceptions());
@@ -1456,7 +1456,7 @@
const vector<t_field *>& fields = arglist->get_members();
vector<t_field *>::const_iterator f_iter_field;
for (f_iter_field = fields.begin(); f_iter_field != fields.end(); ++f_iter_field) {
- params_without_type += (*f_iter_field)->get_name();
+ params_without_type += (*f_iter_field)->get_name();
params_without_type += ", ";
}
@@ -1471,7 +1471,7 @@
"gboolean" << endl <<
this->nspace_lc << service_name_lc << "_if_" << funname << " " <<
params << endl <<
- "{" << endl <<
+ "{" << endl <<
" return " << this->nspace_uc << service_name_uc <<
"_IF_GET_INTERFACE (iface)->" << funname << " (" <<
params_without_type << "error);" << endl <<
@@ -1621,7 +1621,7 @@
// Serialize the request
f_service_ <<
indent() << "gint32 cseqid = 0;" << endl <<
- indent() << "ThriftProtocol * protocol = " <<
+ indent() << "ThriftProtocol * protocol = " <<
this->nspace_uc << base_service_name_uc <<
"_CLIENT (iface)->output_protocol;" << endl <<
endl <<
@@ -1648,7 +1648,7 @@
indent() <<
" return FALSE;" << endl <<
endl <<
- indent() <<
+ indent() <<
"return TRUE;" << endl;
scope_down(f_service_);
@@ -1670,11 +1670,11 @@
indent() << "gint32 rseqid;" << endl <<
indent() << "gchar * fname = NULL;" << endl <<
indent() << "ThriftMessageType mtype;" << endl <<
- indent() << "ThriftProtocol * protocol = " <<
+ indent() << "ThriftProtocol * protocol = " <<
this->nspace_uc << base_service_name_uc <<
"_CLIENT (iface)->input_protocol;" << endl <<
endl <<
- indent() << "if (thrift_protocol_read_message_begin " <<
+ indent() << "if (thrift_protocol_read_message_begin " <<
"(protocol, &fname, &mtype, &rseqid, error) < 0)" <<
endl <<
indent() << "{" << endl <<
@@ -1696,7 +1696,7 @@
indent() << " if (fname) g_free (fname);" << endl <<
indent() << " thrift_protocol_skip (protocol, T_STRUCT, NULL);" << endl <<
indent() << " thrift_protocol_read_message_end (protocol, NULL);" << endl <<
- indent() << " thrift_transport_read_end (protocol->transport, NULL);" << endl <<
+ indent() << " thrift_transport_read_end (protocol->transport, NULL);" << endl <<
indent() << " g_set_error (error, THRIFT_APPLICATION_EXCEPTION_ERROR, THRIFT_APPLICATION_EXCEPTION_ERROR_INVALID_MESSAGE_TYPE, \"invalid message type %d, expected T_REPLY\", mtype);" << endl <<
indent() << " return FALSE;" << endl <<
indent() << "} else if (strncmp (fname, \"" << name << "\", " << name.length() << ") != 0) {" << endl <<
@@ -1707,7 +1707,7 @@
indent() << " if (fname) g_free (fname);" << endl <<
indent() << " return FALSE;" << endl <<
indent() << "}" << endl <<
- indent() << "if (fname) g_free (fname);" << endl <<
+ indent() << "if (fname) g_free (fname);" << endl <<
endl;
t_struct* xs = (*f_iter)->get_xceptions();
@@ -1715,7 +1715,7 @@
vector<t_field*>::const_iterator x_iter;
{
- t_struct result(program_, tservice->get_name() + "_" +
+ t_struct result(program_, tservice->get_name() + "_" +
(*f_iter)->get_name() + "_result");
t_field success((*f_iter)->get_returntype(), "*_return", 0);
if (!(*f_iter)->get_returntype()->is_void()) {
@@ -1743,7 +1743,7 @@
// copy over any throw exceptions and return failure
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); x_iter++) {
- f_service_ <<
+ f_service_ <<
indent() << "if (*" << (*x_iter)->get_name() << " != NULL)" << endl <<
indent() << "{" << endl <<
indent() << " g_set_error (error, " << this->nspace_uc <<
@@ -1753,7 +1753,7 @@
this->nspace_uc <<
to_upper_case(initial_caps_to_underscores(
(*x_iter)->get_type()->get_name())) <<
- "_ERROR_CODE, \"" << (*x_iter)->get_type()->get_name() <<
+ "_ERROR_CODE, \"" << (*x_iter)->get_type()->get_name() <<
"\");" << endl <<
indent() << " return FALSE;" << endl <<
indent() << "}" << endl;
@@ -3061,7 +3061,7 @@
// close the structure definition and create a typedef
f_types_ <<
"};" << endl <<
- "typedef struct _" << this->nspace << name << " " <<
+ "typedef struct _" << this->nspace << name << " " <<
this->nspace << name << ";" << endl <<
endl;
@@ -3111,7 +3111,7 @@
}
// generate struct I/O methods
- string this_get = this->nspace + name + " * this_object = "
+ string this_get = this->nspace + name + " * this_object = "
+ this->nspace_uc + name_uc + "(object);";
generate_struct_reader (f_types_impl_, tstruct, "this_object->", this_get);
generate_struct_writer (f_types_impl_, tstruct, "this_object->", this_get);
@@ -3501,7 +3501,7 @@
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_type* t = get_true_type ((*m_iter)->get_type());
- if (t->is_container()) {
+ if (t->is_container()) {
string name = (*m_iter)->get_name();
if (t->is_map() || t->is_set()) {
f_types_impl_ << indent() << "if (tobject->" << name << " != NULL)" << endl;
@@ -3524,7 +3524,7 @@
case t_base_type::TYPE_BOOL:
case t_base_type::TYPE_BYTE:
case t_base_type::TYPE_I16:
- case t_base_type::TYPE_I32:
+ case t_base_type::TYPE_I32:
case t_base_type::TYPE_I64:
case t_base_type::TYPE_DOUBLE:
destructor_function = "g_array_unref";
@@ -3584,7 +3584,7 @@
class_name_lc << "_class_init (" << class_name << "Class * cls)" << endl;
scope_up(f_types_impl_);
- f_types_impl_ <<
+ f_types_impl_ <<
indent() << "GObjectClass *gobject_class = G_OBJECT_CLASS (cls);" << endl <<
indent() << "ThriftStructClass *struct_class = " <<
"THRIFT_STRUCT_CLASS (cls);" << endl <<
@@ -3869,7 +3869,7 @@
if ((*f_iter)->get_req() == t_field::T_OPTIONAL) {
indent(out) << "if (this_object->__isset_" << (*f_iter)->get_name() << " == TRUE) {" << endl;
indent_up();
- }
+ }
out <<
indent() << "if ((ret = thrift_protocol_write_field_begin (protocol, " <<
@@ -4221,7 +4221,7 @@
tval_ptr = tval->is_string() || !tval->is_base_type() ? "" : "*";
out <<
- indent() << "g_hash_table_foreach ((GHashTable *) " << prefix <<
+ indent() << "g_hash_table_foreach ((GHashTable *) " << prefix <<
", thrift_hash_table_get_keys, &key_list);" << endl <<
indent() << tkey_name << tkey_ptr <<
" keys[g_list_length (key_list)];" << endl <<
@@ -4356,7 +4356,7 @@
+ index + ")";
if (ttype->is_base_type()) {
- t_base_type::t_base tbase = ((t_base_type *) ttype)->get_base();
+ t_base_type::t_base tbase = ((t_base_type *) ttype)->get_base();
switch (tbase) {
case t_base_type::TYPE_VOID:
throw "compiler error: cannot determine array type";
@@ -4585,7 +4585,7 @@
generate_deserialize_map_element (out, (t_map *) ttype, prefix, error_ret);
scope_down(out);
out << endl;
-
+
// read map end
out <<
indent() << "/* read the map end marker */" << endl <<
@@ -4637,7 +4637,7 @@
scope_down(out);
out <<
- indent() << "if ((ret = thrift_protocol_read_list_end (protocol, error)) < 0)" << endl <<
+ indent() << "if ((ret = thrift_protocol_read_list_end (protocol, error)) < 0)" << endl <<
indent() << " return " << error_ret << ";" << endl <<
indent() << "xfer += ret;" << endl <<
endl;
@@ -4980,7 +4980,7 @@
ret += tolower (tmp[pos]);
pos++;
for (unsigned int i = pos; i < name.length(); i++) {
- char lc = tolower (tmp[i]);
+ char lc = tolower (tmp[i]);
if (lc != tmp[i]) {
ret += '_';
}
diff --git a/compiler/cpp/src/generate/t_cocoa_generator.cc b/compiler/cpp/src/generate/t_cocoa_generator.cc
index f765f7d..cbed831 100644
--- a/compiler/cpp/src/generate/t_cocoa_generator.cc
+++ b/compiler/cpp/src/generate/t_cocoa_generator.cc
@@ -52,13 +52,13 @@
{
(void) option_string;
std::map<std::string, std::string>::const_iterator iter;
-
+
iter = parsed_options.find("log_unexpected");
- log_unexpected_ = (iter != parsed_options.end());
-
+ log_unexpected_ = (iter != parsed_options.end());
+
iter = parsed_options.find("validate_required");
- validate_required_ = (iter != parsed_options.end());
-
+ validate_required_ = (iter != parsed_options.end());
+
out_dir_base_ = "gen-cocoa";
}
@@ -408,7 +408,7 @@
for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
if ((*c_iter)->get_type()->is_container() ||
(*c_iter)->get_type()->is_struct()) {
- print_const_value(f_impl_,
+ print_const_value(f_impl_,
cocoa_prefix_+(*c_iter)->get_name(),
(*c_iter)->get_type(),
(*c_iter)->get_value(),
@@ -582,7 +582,7 @@
*/
void t_cocoa_generator::generate_cocoa_struct_init_with_coder_method(ofstream &out,
t_struct* tstruct,
- bool is_exception)
+ bool is_exception)
{
indent(out) << "- (id) initWithCoder: (NSCoder *) decoder" << endl;
scope_up(out);
@@ -601,45 +601,45 @@
out << indent() << "if ([decoder containsValueForKey: @\""<< (*m_iter)->get_name() <<"\"])" << endl;
scope_up(out);
out << indent() << "__" << (*m_iter)->get_name() << " = ";
- if (type_can_be_null(t))
+ if (type_can_be_null(t))
{
out << "[[decoder decodeObjectForKey: @\"" << (*m_iter)->get_name() << "\"] retain_stub];" << endl;
}
- else if (t->is_enum())
+ else if (t->is_enum())
{
- out << "[decoder decodeIntForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
+ out << "[decoder decodeIntForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
}
- else
+ else
{
t_base_type::t_base tbase = ((t_base_type *) t)->get_base();
switch (tbase)
{
case t_base_type::TYPE_BOOL:
- out << "[decoder decodeBoolForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
+ out << "[decoder decodeBoolForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
break;
case t_base_type::TYPE_BYTE:
- out << "[decoder decodeIntForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
+ out << "[decoder decodeIntForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
break;
case t_base_type::TYPE_I16:
- out << "[decoder decodeIntForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
+ out << "[decoder decodeIntForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
break;
case t_base_type::TYPE_I32:
- out << "[decoder decodeInt32ForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
+ out << "[decoder decodeInt32ForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
break;
case t_base_type::TYPE_I64:
- out << "[decoder decodeInt64ForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
+ out << "[decoder decodeInt64ForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
break;
case t_base_type::TYPE_DOUBLE:
- out << "[decoder decodeDoubleForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
+ out << "[decoder decodeDoubleForKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
break;
- default:
+ default:
throw "compiler error: don't know how to decode thrift type: " + t_base_type::t_base_name(tbase);
}
}
out << indent() << "__" << (*m_iter)->get_name() << "_isset = YES;" << endl;
scope_down(out);
}
-
+
out << indent() << "return self;" << endl;
scope_down(out);
out << endl;
@@ -652,7 +652,7 @@
*/
void t_cocoa_generator::generate_cocoa_struct_encode_with_coder_method(ofstream &out,
t_struct* tstruct,
- bool is_exception)
+ bool is_exception)
{
indent(out) << "- (void) encodeWithCoder: (NSCoder *) encoder" << endl;
scope_up(out);
@@ -660,24 +660,24 @@
// NSExceptions conform to NSCoding, so we can call super
out << indent() << "[super encodeWithCoder: encoder];" << endl;
}
-
+
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
-
+
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_type* t = get_true_type((*m_iter)->get_type());
out << indent() << "if (__"<< (*m_iter)->get_name() <<"_isset)" << endl;
scope_up(out);
//out << indent() << "__" << (*m_iter)->get_name() << " = ";
- if (type_can_be_null(t))
+ if (type_can_be_null(t))
{
out << indent() << "[encoder encodeObject: __" << (*m_iter)->get_name() << " forKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
}
- else if (t->is_enum())
+ else if (t->is_enum())
{
out << indent() << "[encoder encodeInt: __" << (*m_iter)->get_name() << " forKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
}
- else
+ else
{
t_base_type::t_base tbase = ((t_base_type *) t)->get_base();
switch (tbase)
@@ -700,13 +700,13 @@
case t_base_type::TYPE_DOUBLE:
out << indent() << "[encoder encodeDouble: __" << (*m_iter)->get_name() << " forKey: @\"" << (*m_iter)->get_name() << "\"];" << endl;
break;
- default:
+ default:
throw "compiler error: don't know how to encode thrift type: " + t_base_type::t_base_name(tbase);
}
}
scope_down(out);
}
-
+
scope_down(out);
out << endl;
}
@@ -786,11 +786,11 @@
scope_down(out);
out << endl;
}
-
+
// initWithCoder for NSCoding
generate_cocoa_struct_init_with_coder_method(out, tstruct, is_exception);
// encodeWithCoder for NSCoding
- generate_cocoa_struct_encode_with_coder_method(out, tstruct, is_exception);
+ generate_cocoa_struct_encode_with_coder_method(out, tstruct, is_exception);
// dealloc
if (!members.empty()) {
@@ -1077,7 +1077,7 @@
const vector<t_field*>& fields = tstruct->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
out << indent() << "// check for required fields" << endl;
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
t_field* field = (*f_iter);
@@ -1228,7 +1228,7 @@
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
t_struct* ts = (*f_iter)->get_arglist();
generate_cocoa_struct_interface(f_impl_, ts, false);
- generate_cocoa_struct_implementation(f_impl_, ts, false, false);
+ generate_cocoa_struct_implementation(f_impl_, ts, false, false);
generate_function_helpers(*f_iter);
}
}
@@ -1274,7 +1274,7 @@
// generate the result struct
generate_cocoa_struct_interface(f_impl_, &result, false);
- generate_cocoa_struct_implementation(f_impl_, &result, false, true);
+ generate_cocoa_struct_implementation(f_impl_, &result, false, true);
}
@@ -1334,12 +1334,12 @@
void t_cocoa_generator::generate_cocoa_service_server_interface(ofstream& out,
t_service* tservice) {
out << "@interface " << cocoa_prefix_ << tservice->get_name() << "Processor : NSObject <TProcessor> ";
-
+
scope_up(out);
out << indent() << "id <" << cocoa_prefix_ << tservice->get_name() <<"> mService;" << endl;
out << indent() << "NSDictionary * mMethodMap;" << endl;
scope_down(out);
-
+
out << "- (id) initWith" << tservice->get_name() << ": (id <" << cocoa_prefix_ << tservice->get_name() << ">) service;" << endl;
out << "- (id<"<<cocoa_prefix_ << tservice->get_name() << ">) service;" << endl;
@@ -1557,7 +1557,7 @@
t_service* tservice) {
out << "@implementation " << cocoa_prefix_ << tservice->get_name() << "Processor" << endl;
indent_up();
-
+
// initializer
out << endl;
out << "- (id) initWith" << tservice->get_name() << ": (id <" << cocoa_prefix_ << tservice->get_name() << ">) service" << endl;
@@ -1568,7 +1568,7 @@
out << indent() << "}" << endl;
out << indent() << "mService = [service retain_stub];" << endl;
out << indent() << "mMethodMap = [[NSMutableDictionary dictionary] retain_stub];" << endl;
-
+
// generate method map for routing incoming calls
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::const_iterator f_iter;
@@ -1585,7 +1585,7 @@
}
out << indent() << "return self;" << endl;
scope_down(out);
-
+
// implementation of the 'service' method which returns the service associated with this
// processor
out << endl;
@@ -1593,7 +1593,7 @@
out << indent() << "{" << endl;
out << indent() << " return [[mService retain_stub] autorelease_stub];" << endl;
out << indent() << "}" << endl;
-
+
// implementation of the TProcess method, which dispatches the incoming call using the method map
out << endl;
out << indent() << "- (BOOL) processOnInputProtocol: (id <TProtocol>) inProtocol" << endl;
@@ -1628,7 +1628,7 @@
out << indent() << " [i invoke];" << endl;
out << indent() << " return YES;" << endl;
out << indent() << "}" << endl;
-
+
// generate a process_XXXX method for each service function, which reads args, calls the service, and writes results
functions = tservice->get_functions();
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
@@ -1640,7 +1640,7 @@
out << indent() << argstype << " * args = [[" << argstype << " alloc] init];" << endl;
out << indent() << "[args read: inProtocol];" << endl;
out << indent() << "[inProtocol readMessageEnd];" << endl;
-
+
// prepare the result if not oneway
if (!(*f_iter)->is_oneway()) {
string resulttype = cocoa_prefix_ + function_result_helper_struct_type(*f_iter);
@@ -1672,7 +1672,7 @@
out << "]";
}
out << ";" << endl;
-
+
// write out the result if not oneway
if (!(*f_iter)->is_oneway()) {
out << indent() << "[outProtocol writeMessageBeginWithName: @\"" << funname << "\"" << endl;
@@ -1684,10 +1684,10 @@
out << indent() << "[result release_stub];" << endl;
}
out << indent() << "[args release_stub];" << endl;
-
+
scope_down(out);
}
-
+
// dealloc
out << endl;
out << "- (void) dealloc" << endl;
@@ -2380,7 +2380,7 @@
t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
switch (tbase) {
case t_base_type::TYPE_STRING:
- // We must handle binary constant but the syntax of IDL defines
+ // We must handle binary constant but the syntax of IDL defines
// nothing about binary constant.
// if ((t_base_type*)type)->is_binary())
// // binary code
@@ -2469,7 +2469,7 @@
render << "[[" << type_name(type, true) << " alloc] init";
bool first = true;
for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
- // FIXME The generated code does not match with initWithXXX
+ // FIXME The generated code does not match with initWithXXX
// initializer and causes compile error.
// Try: test/DebugProtoTest.thrift and test/SmallTest.thrift
t_type* field_type = NULL;
@@ -2579,7 +2579,7 @@
if (type_can_be_null(tfield->get_type()))
render << "retain, ";
-
+
render << "getter=" << decapitalize(tfield->get_name()) <<
", setter=set" << capitalize(tfield->get_name()) + ":) " <<
type_name(tfield->get_type()) << " " << tfield->get_name() << ";";
diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc
index 1d66cef..0b9ae2a 100644
--- a/compiler/cpp/src/generate/t_csharp_generator.cc
+++ b/compiler/cpp/src/generate/t_csharp_generator.cc
@@ -80,7 +80,7 @@
if (serialize_) {
wcf_namespace_ = iter->second; // since there can be only one namespace
}
-
+
iter = parsed_options.find("wcf");
wcf_ = (iter != parsed_options.end());
if (wcf_) {
@@ -163,7 +163,7 @@
std::string type_to_enum(t_type* ttype);
std::string prop_name(t_field* tfield, bool suppress_mapping = false);
std::string get_enum_class_name(t_type* type);
-
+
bool field_has_default(t_field* tfield) {
return tfield->get_value() != NULL;
}
@@ -232,7 +232,7 @@
namespace_dir_ = subdir;
init_keywords();
member_mapping_scope = NULL;
-
+
pverbose("C# options:\n");
pverbose("- async ...... %s\n", (async_ ? "ON" : "off"));
pverbose("- async_ctp .. %s\n", (async_ctp_ ? "ON" : "off"));
@@ -258,7 +258,7 @@
void t_csharp_generator::init_keywords() {
csharp_keywords.clear();
-
+
// C# keywords
csharp_keywords["abstract"] = 1;
csharp_keywords["as"]= 1;
@@ -652,13 +652,13 @@
prepare_member_name_mapping( tstruct);
indent(out) << "#if !SILVERLIGHT" << endl;
- indent(out) << "[Serializable]" << endl;
+ indent(out) << "[Serializable]" << endl;
indent(out) << "#endif" << endl;
if ((serialize_||wcf_) &&!is_exception) {
indent(out) << "[DataContract(Namespace=\"" << wcf_namespace_ << "\")]" << endl; // do not make exception classes directly WCF serializable, we provide a seperate "fault" for that
}
bool is_final = (tstruct->annotations_.find("final") != tstruct->annotations_.end());
-
+
indent(out) << "public " << (is_final ? "sealed " : "") << "partial class " << normalize_name(tstruct->get_name()) << " : ";
if (is_exception) {
@@ -730,7 +730,7 @@
if (!is_required && (!nullable_ || has_default)) {
if(serialize_||wcf_) {
indent(out) << "[DataMember]" << endl;
- }
+ }
indent(out) << "public bool " << normalize_name((*m_iter)->get_name()) << ";" << endl;
}
}
@@ -740,7 +740,7 @@
if(generate_isset && (serialize_||wcf_)) {
indent(out) << "#region XmlSerializer support" << endl << endl;
-
+
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
bool is_required = field_is_required((*m_iter));
bool has_default = field_has_default((*m_iter));
@@ -760,7 +760,7 @@
indent(out) << "#endregion XmlSerializer support" << endl << endl;
}
}
-
+
// We always want a default, no argument constructor for Reading
indent(out) << "public " << normalize_name(tstruct->get_name()) << "() {" << endl;
indent_up();
@@ -782,7 +782,7 @@
}
indent_down();
indent(out) << "}" << endl << endl;
-
+
if (has_required_fields) {
indent(out) << "public " << tstruct->get_name() << "(";
bool first = true;
@@ -808,7 +808,7 @@
indent_down();
indent(out) << "}" << endl << endl;
}
-
+
generate_csharp_struct_reader(out, tstruct);
if (is_result) {
generate_csharp_struct_result_writer(out, tstruct);
@@ -917,7 +917,7 @@
if (is_required) {
indent(out) << "isset_" << (*f_iter)->get_name() << " = true;" << endl;
}
-
+
indent_down();
out <<
indent() << "} else { " << endl <<
@@ -1040,7 +1040,7 @@
} else {
out << " else if ";
}
-
+
if (nullable_) {
out << "(this." << prop_name((*f_iter)) << " != null) {" << endl;
} else {
@@ -1142,8 +1142,8 @@
indent(out) <<
"__sb.Append(\", " << prop_name((*f_iter)) << ": \");" << endl;
}
-
-
+
+
t_type* ttype = (*f_iter)->get_type();
if (ttype->is_xception() || ttype->is_struct()) {
indent(out) <<
@@ -1152,7 +1152,7 @@
indent(out) <<
"__sb.Append(" << prop_name((*f_iter)) << ");" << endl;
}
-
+
if (!is_required) {
indent_down();
indent(out) << "}" << endl;
@@ -1256,7 +1256,7 @@
indent(out) << "field.Type = " << type_to_enum(tfield->get_type()) << ";" << endl;
indent(out) << "field.ID = " << tfield->get_key() << ";" << endl;
indent(out) << "oprot.WriteFieldBegin(field);" << endl;
-
+
generate_serialize_field(out, tfield, "_data", true, true);
indent(out) << "oprot.WriteFieldEnd();" << endl;
@@ -1273,16 +1273,16 @@
void t_csharp_generator::generate_csharp_struct_equals(ofstream& out, t_struct* tstruct) {
indent(out) << "public override bool Equals(object that) {" << endl;
indent_up();
-
+
indent(out) << "var other = that as " << type_name(tstruct) << ";" << endl;
indent(out) << "if (other == null) return false;" << endl;
indent(out) << "if (ReferenceEquals(this, other)) return true;" << endl;
-
+
const vector<t_field*>& fields = tstruct->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
bool first = true;
-
+
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
if (first) {
first = false;
@@ -1293,8 +1293,8 @@
indent(out) << "&& ";
}
if (!field_is_required((*f_iter)) && !(nullable_ && !field_has_default((*f_iter)))) {
- out << "((__isset." << normalize_name((*f_iter)->get_name())
- << " == other.__isset." << normalize_name((*f_iter)->get_name())
+ out << "((__isset." << normalize_name((*f_iter)->get_name())
+ << " == other.__isset." << normalize_name((*f_iter)->get_name())
<< ") && ((!__isset." << normalize_name((*f_iter)->get_name()) << ") || (";
}
t_type* ttype = (*f_iter)->get_type();
@@ -1314,7 +1314,7 @@
out << ";" << endl;
indent_down();
}
-
+
indent_down();
indent(out) << "}" << endl << endl;
}
@@ -1322,14 +1322,14 @@
void t_csharp_generator::generate_csharp_struct_hashcode(ofstream& out, t_struct* tstruct) {
indent(out) << "public override int GetHashCode() {" << endl;
indent_up();
-
+
indent(out) << "int hashcode = 0;" << endl;
indent(out) << "unchecked {" << endl;
indent_up();
-
+
const vector<t_field*>& fields = tstruct->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
t_type* ttype = (*f_iter)->get_type();
indent(out) << "hashcode = (hashcode * 397) ^ ";
@@ -1351,11 +1351,11 @@
}
out << ");" << endl;
}
-
+
indent_down();
indent(out) << "}" << endl;
indent(out) << "return hashcode;" << endl;
-
+
indent_down();
indent(out) << "}" << endl << endl;
}
@@ -1432,7 +1432,7 @@
indent(f_service_) <<
function_signature_async_begin(*f_iter, "Begin_") << ";" << endl;
indent(f_service_) <<
- function_signature_async_end(*f_iter, "End_") << ";" << endl;
+ function_signature_async_end(*f_iter, "End_") << ";" << endl;
if(async_||async_ctp_) {
indent(f_service_) <<
function_signature_async(*f_iter) << ";" << endl;
@@ -1511,7 +1511,7 @@
indent(f_service_) << "get { return oprot_; }" << endl;
scope_down(f_service_);
f_service_ << endl << endl;
-
+
indent(f_service_) << "#region \" IDisposable Support \"" << endl;
indent(f_service_) << "private bool _IsDisposed;" << endl << endl;
indent(f_service_) << "// IDisposable" << endl;
@@ -1548,7 +1548,7 @@
string funname = (*f_iter)->get_name();
indent(f_service_) << endl;
-
+
if (!async_) {
indent(f_service_) << "#if SILVERLIGHT" << endl;
}
@@ -1560,7 +1560,7 @@
"return " << "send_" << funname << "(callback, state";
t_struct* arg_struct = (*f_iter)->get_arglist();
- prepare_member_name_mapping( arg_struct);
+ prepare_member_name_mapping( arg_struct);
const vector<t_field*>& fields = arg_struct->get_members();
vector<t_field*>::const_iterator fld_iter;
@@ -1571,7 +1571,7 @@
f_service_ << ");" << endl;
scope_down(f_service_);
f_service_ << endl;
-
+
// End
indent(f_service_) <<
"public " << function_signature_async_end(*f_iter, "End_") << endl;
@@ -1595,7 +1595,7 @@
indent(f_service_) <<
"public async " << function_signature_async(*f_iter, "") << endl;
scope_up(f_service_);
-
+
if (!(*f_iter)->get_returntype()->is_void()) {
indent(f_service_) <<
type_name( (*f_iter)->get_returntype()) << " retval;" << endl;
@@ -1615,7 +1615,7 @@
f_service_ <<
"return ";
}
- f_service_ <<
+ f_service_ <<
funname << "(";
first = true;
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
@@ -1628,16 +1628,16 @@
}
f_service_ << ");" << endl;
indent_down();
- indent(f_service_) <<
+ indent(f_service_) <<
"});" << endl;
if (!(*f_iter)->get_returntype()->is_void()) {
- indent(f_service_) <<
+ indent(f_service_) <<
"return retval;" << endl;
}
scope_down(f_service_);
f_service_ << endl;
}
-
+
if (!async_) {
indent(f_service_) << "#endif" << endl << endl;
}
@@ -1731,7 +1731,7 @@
f_service_ <<
indent() << "args.Write(oprot_);" << endl <<
indent() << "oprot_.WriteMessageEnd();" << endl;;
-
+
if (!async_) {
indent(f_service_) << "#if SILVERLIGHT" << endl;
}
@@ -1742,7 +1742,7 @@
indent(f_service_) << "#endif" << endl;
}
- cleanup_member_name_mapping( arg_struct);
+ cleanup_member_name_mapping( arg_struct);
scope_down(f_service_);
f_service_ << endl;
@@ -1757,7 +1757,7 @@
indent(f_service_) <<
"public " << function_signature(&recv_function) << endl;
scope_up(f_service_);
- prepare_member_name_mapping( (*f_iter)->get_xceptions());
+ prepare_member_name_mapping( (*f_iter)->get_xceptions());
f_service_ <<
indent() << "TMessage msg = iprot_.ReadMessageBegin();" << endl <<
@@ -1821,7 +1821,7 @@
indent() << "throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, \"" << (*f_iter)->get_name() << " failed: unknown result\");" << endl;
}
- cleanup_member_name_mapping( (*f_iter)->get_xceptions());
+ cleanup_member_name_mapping( (*f_iter)->get_xceptions());
scope_down(f_service_);
f_service_ << endl;
}
@@ -1998,7 +1998,7 @@
f_service_ <<
"iface_." << normalize_name(tfunction->get_name()) << "(";
bool first = true;
- prepare_member_name_mapping(arg_struct);
+ prepare_member_name_mapping(arg_struct);
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
if (first) {
first = false;
@@ -2010,13 +2010,13 @@
f_service_ << ".Value";
}
}
- cleanup_member_name_mapping(arg_struct);
+ cleanup_member_name_mapping(arg_struct);
f_service_ << ");" << endl;
if (!tfunction->is_oneway() && xceptions.size() > 0) {
indent_down();
f_service_ << indent() << "}";
- prepare_member_name_mapping( xs);
+ prepare_member_name_mapping( xs);
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;
if (!tfunction->is_oneway()) {
@@ -2029,7 +2029,7 @@
f_service_ << "}";
}
}
- cleanup_member_name_mapping( xs);
+ cleanup_member_name_mapping( xs);
f_service_ << endl;
}
@@ -2083,7 +2083,7 @@
indent(out) << type_name((*f_iter)->get_type()) << " temp;" << endl;
generate_deserialize_field(out, (*f_iter), "temp", true);
indent(out) << "retval = new " << (*f_iter)->get_name() << "(temp);" << endl;
-
+
indent_down();
out <<
indent() << "} else { " << endl <<
@@ -2308,7 +2308,7 @@
}
string name = prefix + (is_propertyless ? "" : prop_name(tfield));
-
+
if (type->is_void()) {
throw "CANNOT GENERATE SERIALIZE CODE FOR void TYPE: " + name;
}
@@ -2320,7 +2320,7 @@
} else if (type->is_base_type() || type->is_enum()) {
indent(out) <<
"oprot.";
-
+
string nullable_name = nullable_ && !is_element && !field_is_required(tfield)
? name + ".Value"
: name;
@@ -2518,7 +2518,7 @@
// tests rely on this
assert( ('A' < 'Z') && ('a' < 'z') && ('0' < '9'));
-
+
// if the first letter is a number, we add an additional underscore in front of it
char c = str.at(0);
if( ('0' <= c) && (c <= '9')) {
@@ -2527,10 +2527,10 @@
// following chars: letter, number or underscore
for( size_t i = 0; i < str.size(); ++i) {
- c = str.at(i);
- if( (('A' > c) || (c > 'Z')) &&
- (('a' > c) || (c > 'z')) &&
- (('0' > c) || (c > '9')) &&
+ c = str.at(i);
+ if( (('A' > c) || (c > 'Z')) &&
+ (('a' > c) || (c > 'z')) &&
+ (('0' > c) || (c > '9')) &&
('_' != c) ) {
str.replace( i, 1, "_");
}
@@ -2576,14 +2576,14 @@
member_mapping_scope = scope;
member_name_mapping.clear();
-
+
std::set<std::string> used_member_names;
vector<t_field*>::const_iterator iter;
-
- // current C# generator policy:
+
+ // current C# generator policy:
// - prop names are always rendered with an Uppercase first letter
// - struct names are used as given
-
+
for (iter = members.begin(); iter != members.end(); ++iter) {
string oldname = (*iter)->get_name();
string newname = prop_name(*iter, true);
@@ -2591,7 +2591,7 @@
// name conflicts with struct (CS0542 error)
if( structname.compare( newname) == 0) {
pverbose("struct %s: member %s conflicts with struct (preventing CS0542)\n", structname.c_str(), newname.c_str());
- newname += '_';
+ newname += '_';
}
// new name conflicts with another member
@@ -2601,7 +2601,7 @@
continue;
}
- // add always, this helps us to detect edge cases like
+ // add always, this helps us to detect edge cases like
// different spellings ("foo" and "Foo") within the same struct
pverbose("struct %s: member mapping %s => %s\n", structname.c_str(), oldname.c_str(), newname.c_str());
member_name_mapping[oldname] = newname;
@@ -2699,7 +2699,7 @@
throw "NO T_VOID CONSTRUCT";
case t_base_type::TYPE_STRING:
result += " = null";
- break;
+ break;
case t_base_type::TYPE_BOOL:
result += " = false";
break;
diff --git a/compiler/cpp/src/generate/t_d_generator.cc b/compiler/cpp/src/generate/t_d_generator.cc
index c23aa1f..622fb29 100644
--- a/compiler/cpp/src/generate/t_d_generator.cc
+++ b/compiler/cpp/src/generate/t_d_generator.cc
@@ -743,7 +743,7 @@
ss << "Compiler error: Invalid requirement level " << req;
throw ss.str();
}
-
+
}
}
diff --git a/compiler/cpp/src/generate/t_delphi_generator.cc b/compiler/cpp/src/generate/t_delphi_generator.cc
index 35b8da9..1012614 100644
--- a/compiler/cpp/src/generate/t_delphi_generator.cc
+++ b/compiler/cpp/src/generate/t_delphi_generator.cc
@@ -73,7 +73,7 @@
events_ = (iter != parsed_options.end());
iter = parsed_options.find("xmldoc");
xmldoc_ = (iter != parsed_options.end());
-
+
out_dir_base_ = "gen-delphi";
escape_.clear();
@@ -163,10 +163,10 @@
std::string normalize_clsnm(std::string name, std::string prefix, bool b_no_check_keyword = false);
std::string make_valid_delphi_identifier( std::string const & fromName);
std::string input_arg_prefix( t_type* ttype);
-
+
std::string base_type_name(t_base_type* tbase);
std::string declare_field(t_field* tfield, bool init=false, std::string prefix="", bool is_xception_class = false);
- std::string function_signature(t_function* tfunction, std::string full_cls="", bool is_xception = false);
+ std::string function_signature(t_function* tfunction, std::string full_cls="", bool is_xception = false);
std::string argument_list(t_struct* tstruct);
std::string constructor_argument_list(t_struct* tstruct, std::string current_indent);
std::string type_to_enum(t_type* ttype);
@@ -265,7 +265,7 @@
string t_delphi_generator::replace_all( string contents, string search, string repl) {
string str( contents);
-
+
size_t slen = search.length();
size_t rlen = repl.length();
size_t incr = (rlen > 0) ? rlen : 1;
@@ -277,43 +277,43 @@
found = str.find(search, found+incr);
}
}
-
+
return str;
}
-// XML encoding
+// XML encoding
string t_delphi_generator::xml_encode( string contents) {
string str( contents);
-
+
// escape the escape
str = replace_all( str, "&", "&");
-
+
// other standard XML entities
str = replace_all( str, "<", "<");
str = replace_all( str, ">", ">");
-
+
return str;
}
-// XML attribute encoding
+// XML attribute encoding
string t_delphi_generator::xmlattrib_encode( string contents) {
string str( xml_encode( contents));
-
+
// our attribs are enclosed in "
str = replace_all( str, "\"", "\\\"");
-
+
return str;
}
// XML encoding for doc comments
string t_delphi_generator::xmldoc_encode( string contents) {
string str( xml_encode( contents));
-
+
// XMLDoc specific: convert linebreaks into <para>graphs</para>
str = replace_all( str, "\r\n", "\r");
str = replace_all( str, "\n", "\r");
str = replace_all( str, "\r", "</para>\n<para>");
-
+
return str;
}
@@ -329,8 +329,8 @@
void t_delphi_generator::generate_delphi_doc(ostream &out, t_field* field) {
if( xmldoc_) {
if (field->get_type()->is_enum()) {
- string combined_message = xmldoc_encode( field->get_doc())
- + "\n<seealso cref=\""
+ string combined_message = xmldoc_encode( field->get_doc())
+ + "\n<seealso cref=\""
+ xmldoc_encode( type_name(field->get_type()))
+ "\"/>";
generate_delphi_docstring_comment(out, combined_message);
@@ -578,7 +578,7 @@
}
init_known_types_list();
-
+
string unitname, nsname;
const vector<t_program*>& includes = program_->get_includes();
for (size_t i = 0; i < includes.size(); ++i) {
@@ -594,7 +594,7 @@
MKDIR(get_out_dir().c_str());
}
-void t_delphi_generator::close_generator() {
+void t_delphi_generator::close_generator() {
std::string unitname = program_name_;
if( "" != namespace_name_) {
unitname = namespace_name_;
@@ -666,8 +666,8 @@
f_all << s_struct_impl.str();
f_all << s_service_impl.str();
f_all << s_const_impl.str();
-
-
+
+
if (register_types_)
{
f_all << endl;
@@ -675,7 +675,7 @@
f_all << s_type_factory_funcs.str();
f_all << "procedure RegisterTypeFactories;" << endl;
f_all << "begin" << endl;
- f_all << s_type_factory_registration.str();
+ f_all << s_type_factory_registration.str();
f_all << "end;" << endl;
}
f_all << endl;
@@ -683,7 +683,7 @@
string constants_class = make_constants_classname();
f_all << "initialization" << endl;
- if ( has_const ) {
+ if ( has_const ) {
f_all << "{$IF CompilerVersion < 21.0} // D2010" << endl;
f_all << " " << constants_class.c_str() << "_Initialize;" << endl;
f_all << "{$IFEND}" << endl;
@@ -694,16 +694,16 @@
f_all << endl;
f_all << "finalization" << endl;
- if ( has_const ) {
+ if ( has_const ) {
f_all << "{$IF CompilerVersion < 21.0} // D2010" << endl;
f_all << " " << constants_class.c_str() << "_Finalize;" << endl;
f_all << "{$IFEND}" << endl;
}
f_all << endl << endl;
-
+
f_all << "end." << endl;
f_all.close();
-
+
if( ! typedefs_pending.empty()) {
pwarning(0, "%d typedefs with unresolved type references left:\n", typedefs_pending.size());
for( std::list<t_typedef*>::iterator iter = typedefs_pending.begin(); typedefs_pending.end() != iter; ++iter) {
@@ -723,30 +723,30 @@
// Forward declare struct def
has_forward = true;
pverbose("forward declaration of %s\n", type_name(tstruct).c_str());
-
+
string what = tstruct->is_xception() ? "class" : "interface";
indent_up();
- indent(s_forward_decr) <<
+ indent(s_forward_decr) <<
type_name(tstruct,tstruct->is_xception(),true) << " = " << what << ";" << endl;
indent_down();
-
+
add_defined_type(tstruct);
}
void t_delphi_generator::generate_typedef(t_typedef* ttypedef) {
t_type* type = ttypedef->get_type();
- // write now or save for later?
+ // write now or save for later?
if( ! is_fully_defined_type( type)) {
pverbose("typedef %s: unresolved dependencies found\n", type_name(ttypedef).c_str());
- typedefs_pending.push_back( ttypedef);
+ typedefs_pending.push_back( ttypedef);
return;
}
indent_up();
generate_delphi_doc(s_struct, ttypedef);
- indent(s_struct) <<
+ indent(s_struct) <<
type_name(ttypedef) << " = ";
// commented out: the benefit is not big enough to risk breaking existing code
@@ -757,7 +757,7 @@
s_struct << type_name(ttypedef->get_type()) << ";" << endl <<
endl;
indent_down();
-
+
add_defined_type( ttypedef);
}
@@ -773,7 +773,7 @@
if (ttype->is_typedef()) {
return (1 == types_known[ type_name(ttype)]);
}
-
+
if (ttype->is_base_type()) {
return (1 == types_known[ base_type_name((t_base_type*)ttype)]);
} else if (ttype->is_enum()) {
@@ -796,19 +796,19 @@
void t_delphi_generator::add_defined_type( t_type* ttype) {
// mark as known type
types_known[ type_name(ttype)] = 1;
-
+
// check all pending typedefs
std::list<t_typedef*>::iterator iter;
bool more = true;
while( more && (! typedefs_pending.empty()))
{
more = false;
-
+
for( iter = typedefs_pending.begin(); typedefs_pending.end() != iter; ++iter)
{
t_typedef* ttypedef = (*iter);
if( is_fully_defined_type( ttypedef->get_type()))
- {
+ {
pverbose("typedef %s: all pending references are now resolved\n", type_name(ttypedef).c_str());
typedefs_pending.erase( iter);
generate_typedef( ttypedef);
@@ -868,7 +868,7 @@
// tests rely on this
assert( ('A' < 'Z') && ('a' < 'z') && ('0' < '9'));
-
+
// if the first letter is a number, we add an additional underscore in front of it
char c = str.at(0);
if( ('0' <= c) && (c <= '9')) {
@@ -877,10 +877,10 @@
// following chars: letter, number or underscore
for( size_t i = 0; i < str.size(); ++i) {
- c = str.at(i);
- if( (('A' > c) || (c > 'Z')) &&
- (('a' > c) || (c > 'z')) &&
- (('0' > c) || (c > '9')) &&
+ c = str.at(i);
+ if( (('A' > c) || (c > 'Z')) &&
+ (('a' > c) || (c > 'z')) &&
+ (('0' > c) || (c > '9')) &&
('_' != c) ) {
str.replace( i, 1, "_");
}
@@ -894,7 +894,7 @@
if( constprefix_) {
return make_valid_delphi_identifier( "T" + program_name_ + "Constants");
} else {
- return "TConstants"; // compatibility
+ return "TConstants"; // compatibility
}
}
@@ -924,7 +924,7 @@
indent_up();
for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
generate_delphi_doc(s_const, *c_iter);
- print_const_prop(s_const, normalize_name((*c_iter)->get_name()),
+ print_const_prop(s_const, normalize_name((*c_iter)->get_name()),
(*c_iter)->get_type(), (*c_iter)->get_value());
}
indent(s_const) << "{$IF CompilerVersion >= 21.0}" << endl;
@@ -1184,7 +1184,7 @@
indent_up();
generate_delphi_struct_definition(s_struct, tstruct, is_exception);
indent_down();
-
+
add_defined_type( tstruct);
generate_delphi_struct_impl(s_struct_impl, "", tstruct, is_exception);
@@ -1385,7 +1385,7 @@
bool is_final = (tstruct->annotations_.find("final") != tstruct->annotations_.end());
string struct_intf_name;
string struct_name;
- string isset_name;
+ string isset_name;
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
@@ -1670,20 +1670,20 @@
indent_impl(s_service_impl) << "constructor " << normalize_clsnm( service_name_, "T") << ".TClient.Create( prot: IProtocol);" << endl;
indent_impl(s_service_impl) << "begin" << endl;
indent_up_impl();
- indent_impl(s_service_impl) << "Create( prot, prot );" << endl;
+ indent_impl(s_service_impl) << "Create( prot, prot );" << endl;
indent_down_impl();
indent_impl(s_service_impl) << "end;" << endl << endl;
indent(s_service) << "constructor Create( const iprot: IProtocol; const oprot: IProtocol); overload;" << endl;
- indent_impl(s_service_impl) <<
- "constructor " << normalize_clsnm( service_name_, "T") <<
+ indent_impl(s_service_impl) <<
+ "constructor " << normalize_clsnm( service_name_, "T") <<
".TClient.Create( const iprot: IProtocol; const oprot: IProtocol);" << endl;
indent_impl(s_service_impl) << "begin" << endl;
indent_up_impl();
- indent_impl(s_service_impl) << "inherited Create;" << endl;
- indent_impl(s_service_impl) << "iprot_ := iprot;" << endl;
- indent_impl(s_service_impl) << "oprot_ := oprot;" << endl;
+ indent_impl(s_service_impl) << "inherited Create;" << endl;
+ indent_impl(s_service_impl) << "iprot_ := iprot;" << endl;
+ indent_impl(s_service_impl) << "oprot_ := oprot;" << endl;
indent_down_impl();
indent_impl(s_service_impl) << "end;" << endl << endl;
@@ -1878,7 +1878,7 @@
}
if (!(*f_iter)->get_returntype()->is_void()) {
- indent_impl(s_service_impl) <<
+ indent_impl(s_service_impl) <<
"raise TApplicationException.Create(TApplicationException.TExceptionType.MissingResult, '" << (*f_iter)->get_name() << " failed: unknown result');" << endl;
}
@@ -1934,7 +1934,7 @@
}
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
- indent_impl(s_service_impl) <<
+ indent_impl(s_service_impl) <<
"processMap_.AddOrSetValue( '" << (*f_iter)->get_name() << "', " << (*f_iter)->get_name() << "_Process);" << endl;
}
indent_down_impl();
@@ -2088,7 +2088,7 @@
indent(s_service) <<
"procedure " << funcname << "_Process( seqid: Integer; const iprot: IProtocol; const oprot: IProtocol" <<
- (events_ ? "; const events : IRequestEvents" : "") <<
+ (events_ ? "; const events : IRequestEvents" : "") <<
");" << endl;
if (tfunction->is_oneway()) {
@@ -2099,7 +2099,7 @@
indent_impl(s_service_impl) <<
"procedure " << full_cls << "." << funcname << "_Process( seqid: Integer; const iprot: IProtocol; const oprot: IProtocol" <<
- (events_ ? "; const events : IRequestEvents" : "") <<
+ (events_ ? "; const events : IRequestEvents" : "") <<
");" << endl;
indent_impl(s_service_impl) << "var" << endl;
indent_up_impl();
@@ -2112,7 +2112,7 @@
indent_down_impl();
indent_impl(s_service_impl) << "begin" << endl;
indent_up_impl();
-
+
if( events_) {
indent_impl(s_service_impl) << "if events <> nil then events.PreRead;" << endl;
}
@@ -2171,7 +2171,7 @@
indent_up_impl();
if (!tfunction->is_oneway()) {
string factory_name = normalize_clsnm((*x_iter)->get_type()->get_name(),"",true) + "Factory";
- indent_impl(s_service_impl) <<
+ indent_impl(s_service_impl) <<
"ret." << prop_name(*x_iter) << " := E." << factory_name << ";" << endl;
}
indent_down_impl();
@@ -2334,7 +2334,7 @@
indent_impl(out) << obj << " := iprot.ReadListBegin();" << endl;
}
- indent_impl(out) <<
+ indent_impl(out) <<
"for " << counter << " := 0 to " << obj << ".Count - 1 do" << endl;
indent_impl(out) << "begin" << endl;
indent_up_impl();
@@ -2404,7 +2404,7 @@
}
string name = prefix + prop_name(tfield, is_xception);
-
+
if (type->is_void()) {
throw "CANNOT GENERATE SERIALIZE CODE FOR void TYPE: " + name;
}
@@ -2414,7 +2414,7 @@
} else if (type->is_container()) {
generate_serialize_container(out, is_xception, type, name, local_vars);
} else if (type->is_base_type() || type->is_enum()) {
-
+
indent_impl(out) <<
"oprot.";
@@ -2490,7 +2490,7 @@
} else if (ttype->is_set()) {
obj = tmp("set_");
local_vars << " " << obj << " : ISet;" << endl;
- indent_impl(out) << obj << " := TSetImpl.Create(" <<
+ indent_impl(out) << obj << " := TSetImpl.Create(" <<
type_to_enum(((t_set*)ttype)->get_elem_type()) << ", " <<
prefix << ".Count);" << endl;
indent_impl(out) <<
@@ -2498,7 +2498,7 @@
} else if (ttype->is_list()) {
obj = tmp("list_");
local_vars << " " << obj << " : IList;" << endl;
- indent_impl(out) << obj << " := TListImpl.Create(" <<
+ indent_impl(out) << obj << " := TListImpl.Create(" <<
type_to_enum(((t_list*)ttype)->get_elem_type()) << ", " <<
prefix << ".Count);" << endl;
indent_impl(out) <<
@@ -2604,9 +2604,9 @@
string t_delphi_generator::type_name( t_type* ttype, bool b_cls, bool b_no_postfix, bool b_exception_factory, bool b_full_exception_factory) {
- if (ttype->is_typedef()) {
+ if (ttype->is_typedef()) {
t_typedef* tdef = (t_typedef*)ttype;
- if( tdef->is_forward_typedef()) { // forward types according to THRIFT-2421
+ if( tdef->is_forward_typedef()) { // forward types according to THRIFT-2421
if( tdef->get_type() != NULL) {
return type_name( tdef->get_type(), b_cls, b_no_postfix, b_exception_factory, b_full_exception_factory);
} else {
@@ -2616,7 +2616,7 @@
return normalize_name( "T"+tdef->get_symbolic());
}
}
-
+
string typ_nm;
string s_factory;
@@ -2686,13 +2686,13 @@
// base types
if (ttype->is_base_type()) {
switch (((t_base_type*)ttype)->get_base()) {
-
+
// these should be const'ed for optimal performamce
case t_base_type::TYPE_STRING: // refcounted pointer
case t_base_type::TYPE_I64: // larger than 32 bit
case t_base_type::TYPE_DOUBLE: // larger than 32 bit
return "const ";
-
+
// all others don't need to be
case t_base_type::TYPE_BYTE:
case t_base_type::TYPE_I16:
@@ -2700,16 +2700,16 @@
case t_base_type::TYPE_BOOL:
case t_base_type::TYPE_VOID:
return "";
-
+
// we better always report any unknown types
default:
throw "compiler error: no input_arg_prefix() for base type " + t_base_type::t_base_name(((t_base_type*)ttype)->get_base());
}
-
+
// enums
} else if (ttype->is_enum()) {
return ""; // usually <= 32 bit
-
+
// containers
} else if (ttype->is_map()) {
return "const "; // refcounted pointer
@@ -2721,7 +2721,7 @@
return "const "; // refcounted pointer
}
-
+
// any other type, either TSomething or ISomething
return "const "; // possibly refcounted pointer
}
@@ -3062,7 +3062,7 @@
}
indent_impl(out) << "Result.UpdateMessageProperty;" << endl;
-
+
indent_down_impl();
indent_impl(out) << "end;" << endl << endl;
}
@@ -3082,13 +3082,13 @@
// local bools for required fields
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
if ((*f_iter)->get_req() == t_field::T_REQUIRED) {
- indent_impl(local_vars) <<
+ indent_impl(local_vars) <<
"_req_isset_" << prop_name(*f_iter, is_exception) << " : Boolean;" << endl;
- indent_impl(code_block) <<
+ indent_impl(code_block) <<
"_req_isset_" << prop_name(*f_iter, is_exception) << " := FALSE;" << endl;
}
}
-
+
indent_impl(code_block) << "struc := iprot.ReadStructBegin;" << endl;
indent_impl(code_block) << "try" << endl;
@@ -3131,7 +3131,7 @@
// required field?
if ((*f_iter)->get_req() == t_field::T_REQUIRED) {
- indent_impl(code_block) <<
+ indent_impl(code_block) <<
"_req_isset_" << prop_name(*f_iter, is_exception) << " := TRUE;" << endl;
}
@@ -3176,17 +3176,17 @@
indent_down_impl();
indent_impl(code_block) << "end;" << endl;
- // all required fields have been read?
+ // all required fields have been read?
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
if ((*f_iter)->get_req() == t_field::T_REQUIRED) {
- indent_impl(code_block) <<
+ indent_impl(code_block) <<
"if not _req_isset_" << prop_name(*f_iter, is_exception) << endl;
- indent_impl(code_block) <<
- "then raise TProtocolException.Create( TProtocolException.INVALID_DATA, '" <<
+ indent_impl(code_block) <<
+ "then raise TProtocolException.Create( TProtocolException.INVALID_DATA, '" <<
prop_name(*f_iter, is_exception) << "');" << endl;
}
}
-
+
indent_down_impl();
indent_impl(code_block) << "end;" << endl << endl;
@@ -3295,10 +3295,10 @@
indent_impl(code_block) <<
"if (" << prop_name((*f_iter), is_exception) << " <> nil)";
if (is_optional) {
- code_block <<
+ code_block <<
" and __isset_" << prop_name(*f_iter,is_exception);
}
- code_block <<
+ code_block <<
" then" << endl;
indent_impl(code_block) << "begin" << endl;
indent_up_impl();
@@ -3390,9 +3390,9 @@
if( useFirstFlag) {
indent_impl(out) << tmp_first << " := TRUE;" << endl;
}
-
+
bool had_required = false; // set to true after first required field has been processed
-
+
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
bool null_allowed = type_can_be_null((*f_iter)->get_type());
bool is_optional = ((*f_iter)->get_req() != t_field::T_REQUIRED);
@@ -3437,12 +3437,12 @@
indent_impl(out) <<
tmp_sb << ".Append(" << prop_name((*f_iter), is_exception) << ");" << endl;
}
-
+
if (null_allowed || is_optional) {
indent_down_impl();
indent_impl(out) << "end;" << endl;
- }
-
+ }
+
if (!is_optional) {
had_required = true; // now __first must be false, so we don't need to check it anymore
}
@@ -3482,9 +3482,9 @@
return false;
}
-THRIFT_REGISTER_GENERATOR(delphi, "delphi",
-" ansistr_binary: Use AnsiString for binary datatype (default is TBytes).\n"
-" register_types: Enable TypeRegistry, allows for creation of struct, union\n"
+THRIFT_REGISTER_GENERATOR(delphi, "delphi",
+" ansistr_binary: Use AnsiString for binary datatype (default is TBytes).\n"
+" register_types: Enable TypeRegistry, allows for creation of struct, union\n"
" and container instances by interface or TypeInfo()\n"
" constprefix: Name TConstants classes after IDL to reduce ambiguities\n"
" events: Enable and use processing events in the generated code.\n"
diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/generate/t_go_generator.cc
index ec45e40..0fdb519 100644
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/generate/t_go_generator.cc
@@ -1328,7 +1328,7 @@
if( have_switch) {
indent(out) << "switch fieldId {" << endl;
}
-
+
// All the fields we know
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
field_id = (*f_iter)->get_key();
@@ -1341,7 +1341,7 @@
field_id *= -1;
}
- out <<
+ out <<
indent() <<"case " << field_id << ":" << endl;
indent_up();
thriftFieldTypeId = type_to_enum((*f_iter)->get_type());
@@ -1357,13 +1357,13 @@
indent_down();
}
- // Begin switch default case
+ // Begin switch default case
if( have_switch) {
out <<
indent() << "default:" << endl;
indent_up();
}
-
+
// Skip unknown fields in either case
out <<
indent() << "if err := iprot.Skip(fieldTypeId); err != nil {" << endl <<
@@ -1526,10 +1526,10 @@
string test_suffix("_test");
string filename = lowercase(service_name_);
string f_service_name;
-
+
size_t fname_len = filename.length();
size_t suffix_len = test_suffix.length();
-
+
if ((fname_len >= suffix_len) && (filename.compare(fname_len-suffix_len, suffix_len, test_suffix) == 0)) {
f_service_name = package_dir_ + "/" + filename + "_.go";
} else {
@@ -2538,7 +2538,7 @@
}
f_service_ << "); err2 != nil {" << endl;
-
+
t_struct* exceptions = tfunction->get_xceptions();
const vector<t_field*>& x_fields = exceptions->get_members();
if( ! x_fields.empty()) {
@@ -2551,14 +2551,14 @@
indent() << " case " << type_to_go_type(((*xf_iter)->get_type())) << ":" << endl <<
indent() << "result." << publicize(variable_name_to_go_name((*xf_iter)->get_name())) << " = v" << endl;
}
-
+
f_service_ <<
indent() << " default:" << endl;
}
if (!tfunction->is_oneway()) {
f_service_ <<
- indent() << " x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, \"Internal error processing " <<
+ indent() << " x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, \"Internal error processing " <<
escape_string(tfunction->get_name()) << ": \" + err2.Error())" << endl <<
indent() << " oprot.WriteMessageBegin(\"" << escape_string(tfunction->get_name()) << "\", thrift.EXCEPTION, seqId)" << endl <<
indent() << " x.Write(oprot)" << endl <<
@@ -2581,12 +2581,12 @@
if (!tfunction->get_returntype()->is_void()) {
f_service_ << " else {" << endl; // make sure we set Success retval only on success
indent_up();
- f_service_ <<
+ f_service_ <<
indent() << "result.Success = ";
if(need_reference) {
f_service_ << "&";
}
- f_service_ <<
+ f_service_ <<
"retval" << endl;
indent_down();
f_service_ << "}" << endl;
@@ -2594,7 +2594,7 @@
f_service_ << endl;
}
f_service_ <<
- indent() << "if err2 = oprot.WriteMessageBegin(\"" << escape_string(tfunction->get_name()) <<
+ indent() << "if err2 = oprot.WriteMessageBegin(\"" << escape_string(tfunction->get_name()) <<
"\", thrift.REPLY, seqId); err2 != nil {" << endl <<
indent() << " err = err2" << endl <<
indent() << "}" << endl <<
diff --git a/compiler/cpp/src/generate/t_gv_generator.cc b/compiler/cpp/src/generate/t_gv_generator.cc
index 46c9d38..a6ab53a 100644
--- a/compiler/cpp/src/generate/t_gv_generator.cc
+++ b/compiler/cpp/src/generate/t_gv_generator.cc
@@ -275,7 +275,7 @@
print_const_value( ((t_list*)type)->get_elem_type(), *list_iter);
} else {
print_const_value( ((t_set*)type)->get_elem_type(), *list_iter);
- }
+ }
}
f_out_ << " \\}";
}
diff --git a/compiler/cpp/src/generate/t_hs_generator.cc b/compiler/cpp/src/generate/t_hs_generator.cc
index e9c769a..c969619 100644
--- a/compiler/cpp/src/generate/t_hs_generator.cc
+++ b/compiler/cpp/src/generate/t_hs_generator.cc
@@ -271,7 +271,7 @@
"import qualified Control.Exception as X\n"
"import qualified Control.Monad as M ( liftM, ap, when )\n"
"import Data.Functor ( (<$>) )\n"
- "import qualified Data.ByteString.Lazy as LBS\n"
+ "import qualified Data.ByteString.Lazy as LBS\n"
"import qualified Data.Hashable as H\n"
"import qualified Data.Int as I\n"
"import qualified Data.Maybe as M (catMaybes)\n"
@@ -1149,7 +1149,7 @@
}
f_client_ << "})" << endl;
indent(f_client_) << "T.writeMessageEnd op" << endl;
-
+
// Write to the stream
indent(f_client_) << "T.tFlush (T.getTransport op)" << endl;
indent_down();
@@ -1187,7 +1187,7 @@
indent(f_client_) << "P.return $ " << field_name(resultname, "success") << " res" << endl;
else
indent(f_client_) << "P.return ()" << endl;
-
+
// Close function
indent_down();
}
@@ -1379,7 +1379,7 @@
f_service_ << ") :: X.SomeException -> P.IO ()))" << endl;
indent_down();
indent_down();
-
+
}
// Close function
indent_down();
diff --git a/compiler/cpp/src/generate/t_html_generator.cc b/compiler/cpp/src/generate/t_html_generator.cc
index 8632721..5b368bb 100644
--- a/compiler/cpp/src/generate/t_html_generator.cc
+++ b/compiler/cpp/src/generate/t_html_generator.cc
@@ -56,14 +56,14 @@
: t_generator(program)
{
(void) parsed_options;
- (void) option_string;
+ (void) option_string;
out_dir_base_ = "gen-html";
input_type_ = INPUT_UNKNOWN;
-
+
std::map<std::string, std::string>::const_iterator iter;
iter = parsed_options.find("standalone");
standalone_ = (iter != parsed_options.end());
-
+
escape_.clear();
escape_['&'] = "&";
escape_['<'] = "<";
@@ -89,7 +89,7 @@
bool is_utf8_sequence(std::string const & str, size_t firstpos);
void detect_input_encoding(std::string const & str, size_t firstpos);
void init_allowed__markup();
-
+
/**
* Program-level generation functions
*/
@@ -110,8 +110,8 @@
std::ofstream f_out_;
std::string current_file_;
input_type input_type_;
- std::map<std::string, int> allowed_markup;
- bool standalone_;
+ std::map<std::string, int> allowed_markup;
+ bool standalone_;
};
@@ -321,7 +321,7 @@
f_out_ << "</div></body></html>" << endl;
f_out_.close();
-
+
generate_index();
generate_css();
}
@@ -372,7 +372,7 @@
}
/**
- * Generates the CSS tag.
+ * Generates the CSS tag.
* Depending on "standalone", either a CSS file link (default), or the entire CSS is embedded inline.
*/
void t_html_generator::generate_style_tag() {
@@ -382,11 +382,11 @@
f_out_ << "<style type=\"text/css\"/><!--" << endl;
generate_css_content( f_out_);
f_out_ << "--></style>" << endl;
- }
+ }
}
/**
- * Returns the target file for a <a href> link
+ * Returns the target file for a <a href> link
* The returned string is empty, whenever filename refers to the current file.
*/
std::string t_html_generator::make_file_link( std::string filename) {
@@ -430,11 +430,11 @@
if( (c & 0xC0) != 0x80) {
//pdebug("UTF-8 test: char '%c' (%d) is not a valid UTF-8 following byte", c, int(c));
return false; // no UTF-8
- }
+ }
--count;
++pos;
}
-
+
// true if the sequence is complete
return (0 == count);
}
@@ -447,7 +447,7 @@
return;
}
- // fallback
+ // fallback
pwarning( 1, "Input is not UTF-8, treating as plain ANSI");
input_type_ = INPUT_PLAIN;
}
@@ -510,7 +510,7 @@
allowed_markup["h6"] = 1;
allowed_markup["/h6"] = 1;
}
-
+
std::string t_html_generator::escape_html_tags(std::string const & str) {
std::ostringstream result;
@@ -519,8 +519,8 @@
size_t firstpos = 0;
while( firstpos < str.length()) {
- // look for non-ASCII char
- lastpos = firstpos;
+ // look for non-ASCII char
+ lastpos = firstpos;
while( lastpos < str.length()) {
c = str.at(lastpos);
if( ('<' == c) || ('>' == c)) {
@@ -528,13 +528,13 @@
}
++lastpos;
}
-
- // copy what we got so far
+
+ // copy what we got so far
if( lastpos > firstpos) {
result << str.substr( firstpos, lastpos-firstpos);
firstpos = lastpos;
}
-
+
// reached the end?
if( firstpos >= str.length()) {
break;
@@ -572,13 +572,13 @@
tag_key[i] = tolower(tag_key[i]);
}
if( allowed_markup.find(tag_key) != allowed_markup.end()) {
- result << "<" << tag_content << ">";
+ result << "<" << tag_content << ">";
} else {
- result << "<" << tagstream.str() << ">";
+ result << "<" << tagstream.str() << ">";
pverbose("illegal markup <%s> in doc-comment\n", tag_key.c_str());
}
}
-
+
return result.str();
}
@@ -588,7 +588,7 @@
if( input_type_ == INPUT_UTF8) {
return escape_html_tags(str);
}
-
+
// convert unsafe chars to their &#<num>; equivalent
std::ostringstream result;
unsigned char c = '?';
@@ -597,8 +597,8 @@
size_t firstpos = 0;
while( firstpos < str.length()) {
- // look for non-ASCII char
- lastpos = firstpos;
+ // look for non-ASCII char
+ lastpos = firstpos;
while( lastpos < str.length()) {
c = str.at(lastpos);
ic = c;
@@ -607,8 +607,8 @@
}
++lastpos;
}
-
- // copy what we got so far
+
+ // copy what we got so far
if( lastpos > firstpos) {
result << str.substr( firstpos, lastpos-firstpos);
firstpos = lastpos;
@@ -624,8 +624,8 @@
{
switch( c)
{
- case '\r' :
- case '\n' :
+ case '\r' :
+ case '\n' :
case '\t' :
result << c;
break;
@@ -633,9 +633,9 @@
break;
}
++firstpos;
- continue;
+ continue;
}
-
+
// reached the end?
if( firstpos >= str.length()) {
break;
@@ -650,18 +650,18 @@
break;
}
}
-
+
// convert the character to something useful based on the detected encoding
switch( input_type_) {
- case INPUT_PLAIN:
- result << "&#" << ic << ";";
+ case INPUT_PLAIN:
+ result << "&#" << ic << ";";
++firstpos;
break;
default:
throw "Unexpected or unrecognized input encoding";
}
}
-
+
return escape_html_tags(result.str());
}
@@ -727,12 +727,12 @@
f_out_ << "<code><a href=\"" + make_file_link(fname) + "#Const_" + name +"\">" + name + "</a></code>";
return;
}
-
+
t_type* truetype = type;
while (truetype->is_typedef()) {
truetype = ((t_typedef*)truetype)->get_type();
}
-
+
bool first = true;
if (truetype->is_base_type()) {
t_base_type::t_base tbase = ((t_base_type*)truetype)->get_base();
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index 11b4754..e22a4d9 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -282,7 +282,7 @@
std::string make_valid_java_filename( std::string const & fromName);
std::string make_valid_java_identifier( std::string const & fromName);
-
+
bool type_can_be_null(t_type* ttype) {
ttype = get_true_type(ttype);
@@ -366,7 +366,7 @@
string hash_builder;
string tree_set_and_map;
if (sorted_containers_) {
- tree_set_and_map = string() +
+ tree_set_and_map = string() +
"import java.util.TreeSet;\n" +
"import java.util.TreeMap;\n";
}
@@ -392,7 +392,7 @@
"import java.util.Set;\n" +
"import java.util.HashSet;\n" +
"import java.util.EnumSet;\n" +
- tree_set_and_map +
+ tree_set_and_map +
"import java.util.Collections;\n" +
"import java.util.BitSet;\n" +
"import java.nio.ByteBuffer;\n"
@@ -440,7 +440,7 @@
// Add java imports
f_enum << string() +
- "import java.util.Map;\n" +
+ "import java.util.Map;\n" +
"import java.util.HashMap;\n" +
"import org.apache.thrift.TEnum;" << endl << endl;
@@ -498,7 +498,7 @@
}
indent(f_enum) << "default:" << endl;
- indent(f_enum) << " return null;" << endl;
+ indent(f_enum) << " return null;" << endl;
indent_down();
@@ -695,7 +695,7 @@
}
/**
- * Generates a struct definition for a thrift data type. This will be a org.apache.thrift.TBase
+ * Generates a struct definition for a thrift data type. This will be a org.apache.thrift.TBase
* implementor.
*
* @param tstruct The struct definition
@@ -912,7 +912,7 @@
indent(out) << " if (getSetField() == _Fields." << constant_name(field->get_name()) << ") {" << endl;
indent(out) << " return (" << type_name(field->get_type(), true) << ")getFieldValue();" << endl;
indent(out) << " } else {" << endl;
- indent(out) << " throw new RuntimeException(\"Cannot get field '" << field->get_name()
+ indent(out) << " throw new RuntimeException(\"Cannot get field '" << field->get_name()
<< "' because union is currently set to \" + getFieldDesc(getSetField()).name);" << endl;
indent(out) << " }" << endl;
indent(out) << "}" << endl;
@@ -999,8 +999,8 @@
indent(out) << " if (value instanceof " << type_name(field->get_type(), true, false, true) << ") {" << endl;
indent(out) << " break;" << endl;
indent(out) << " }" << endl;
- indent(out) << " throw new ClassCastException(\"Was expecting value of type "
- << type_name(field->get_type(), true, false) << " for field '" << field->get_name()
+ indent(out) << " throw new ClassCastException(\"Was expecting value of type "
+ << type_name(field->get_type(), true, false) << " for field '" << field->get_name()
<< "', but got \" + value.getClass().getSimpleName());" << endl;
// do the real check here
}
@@ -1056,7 +1056,7 @@
indent_down();
indent(out) << "} else {" << endl;
- indent_up();
+ indent_up();
indent(out) << "org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);" << endl;
indent(out) << "return null;" << endl;
indent_down();
@@ -1083,7 +1083,7 @@
indent(out) << "case " << constant_name(field->get_name()) << ":" << endl;
indent_up();
- indent(out) << type_name(field->get_type(), true, false) << " " << field->get_name()
+ indent(out) << type_name(field->get_type(), true, false) << " " << field->get_name()
<< " = (" << type_name(field->get_type(), true, false) << ")value_;" << endl;
generate_serialize_field(out, field, "");
indent(out) << "return;" << endl;
@@ -1104,21 +1104,21 @@
void t_java_generator::generate_tuple_scheme_read_value(ofstream& out, t_struct* tstruct) {
indent(out) << "@Override" << endl;
indent(out) << "protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {" << endl;
-
+
indent_up();
-
+
indent(out) << "_Fields setField = _Fields.findByThriftId(fieldID);" << endl;
indent(out) << "if (setField != null) {" << endl;
indent_up();
indent(out) << "switch (setField) {" << endl;
indent_up();
-
+
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
-
+
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_field* field = (*m_iter);
-
+
indent(out) << "case " << constant_name(field->get_name()) << ":" << endl;
indent_up();
indent(out) << type_name(field->get_type(), true, false) << " " << field->get_name() << ";" << endl;
@@ -1126,13 +1126,13 @@
indent(out) << "return " << field->get_name() << ";" << endl;
indent_down();
}
-
+
indent(out) << "default:" << endl;
indent(out) << " throw new IllegalStateException(\"setField wasn't null, but didn't match any of the case statements!\");" << endl;
-
+
indent_down();
indent(out) << "}" << endl;
-
+
indent_down();
indent(out) << "} else {" << endl;
indent_up();
@@ -1146,35 +1146,35 @@
void t_java_generator::generate_tuple_scheme_write_value(ofstream& out, t_struct* tstruct) {
indent(out) << "@Override" << endl;
indent(out) << "protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {" << endl;
-
+
indent_up();
-
+
indent(out) << "switch (setField_) {" << endl;
indent_up();
-
+
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
-
+
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_field* field = (*m_iter);
-
+
indent(out) << "case " << constant_name(field->get_name()) << ":" << endl;
indent_up();
- indent(out) << type_name(field->get_type(), true, false) << " " << field->get_name()
+ indent(out) << type_name(field->get_type(), true, false) << " " << field->get_name()
<< " = (" << type_name(field->get_type(), true, false) << ")value_;" << endl;
generate_serialize_field(out, field, "");
indent(out) << "return;" << endl;
indent_down();
}
-
+
indent(out) << "default:" << endl;
indent(out) << " throw new IllegalStateException(\"Cannot write union with unknown field \" + setField_);" << endl;
-
+
indent_down();
indent(out) << "}" << endl;
-
+
indent_down();
-
+
indent(out) << "}" << endl;
}
@@ -1452,7 +1452,7 @@
break;
case ISSET_BITSET:
indent(out) << "__isset_bit_vector.clear();" << endl;
- indent(out) << "__isset_bit_vector.or(other.__isset_bit_vector);" << endl;
+ indent(out) << "__isset_bit_vector.or(other.__isset_bit_vector);" << endl;
break;
}
@@ -1893,7 +1893,7 @@
(void) tstruct;
indent(out) << "public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {" << endl;
indent_up();
- indent(out) << "schemes.get(iprot.getScheme()).getScheme().read(iprot, this);" << endl;
+ indent(out) << "schemes.get(iprot.getScheme()).getScheme().read(iprot, this);" << endl;
indent_down();
indent(out) << "}" << endl <<
endl;
@@ -1973,7 +1973,7 @@
indent(out) << "public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {" << endl;
indent_up();
indent(out) << "schemes.get(oprot.getScheme()).getScheme().write(oprot, this);" << endl;
-
+
indent_down();
indent(out) << " }" << endl << endl;
}
@@ -2273,7 +2273,7 @@
indent(out) << "__isset_bit_vector.set(" << isset_field_id(field) << ", value);" << endl;
}
indent_down();
- indent(out) << "}" << endl << endl;
+ indent(out) << "}" << endl << endl;
}
}
@@ -2387,7 +2387,7 @@
indent(out) << "}" << endl << endl;
}
-/**
+/**
* Returns a string with the java representation of the given thrift type
* (e.g. for the type struct it returns "org.apache.thrift.protocol.TType.STRUCT")
*/
@@ -2435,12 +2435,12 @@
} else if (type->is_container()){
if (type->is_list()){
indent(out) << "new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, ";
- t_type* elem_type = ((t_list*)type)->get_elem_type();
- generate_field_value_meta_data(out, elem_type);
+ t_type* elem_type = ((t_list*)type)->get_elem_type();
+ generate_field_value_meta_data(out, elem_type);
} else if (type->is_set()){
indent(out) << "new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, ";
- t_type* elem_type = ((t_list*)type)->get_elem_type();
- generate_field_value_meta_data(out, elem_type);
+ t_type* elem_type = ((t_list*)type)->get_elem_type();
+ generate_field_value_meta_data(out, elem_type);
} else{ // map
indent(out) << "new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, ";
t_type* key_type = ((t_map*)type)->get_key_type();
@@ -2748,7 +2748,7 @@
indent(f_service_) << " private org.apache.thrift.async.TAsyncClientManager clientManager;" << endl;
indent(f_service_) << " private org.apache.thrift.protocol.TProtocolFactory protocolFactory;" << endl;
indent(f_service_) << " public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {" << endl;
- indent(f_service_) << " this.clientManager = clientManager;" << endl;
+ indent(f_service_) << " this.clientManager = clientManager;" << endl;
indent(f_service_) << " this.protocolFactory = protocolFactory;" << endl;
indent(f_service_) << " }" << endl;
indent(f_service_) << " public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {" << endl;
@@ -2780,7 +2780,7 @@
string args_name = (*f_iter)->get_name() + "_args";
string result_name = (*f_iter)->get_name() + "_result";
- // Main method body
+ // Main method body
indent(f_service_) << "public " << function_signature_async(*f_iter, false) << " throws org.apache.thrift.TException {" << endl;
indent(f_service_) << " checkReady();" << endl;
indent(f_service_) << " " << funclassname << " method_call = new " + funclassname + "(" << async_argument_list(*f_iter, arg_struct, ret_type) << ", this, ___protocolFactory, ___transport);" << endl;
@@ -2818,7 +2818,7 @@
// Serialize request
// NOTE we are leaving seqid as 0, for now (see above)
- f_service_ <<
+ f_service_ <<
indent() << "prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage(\"" <<
funname << "\", org.apache.thrift.protocol." <<
((*f_iter)->is_oneway() ? "TMessageType.ONEWAY" : "TMessageType.CALL") <<
@@ -2829,14 +2829,14 @@
f_service_ << indent() << "args.set" << get_cap_name((*fld_iter)->get_name()) << "(" << (*fld_iter)->get_name() << ");" << endl;
}
- f_service_ <<
+ f_service_ <<
indent() << "args.write(prot);" << endl <<
indent() << "prot.writeMessageEnd();" << endl;
indent_down();
indent(f_service_) << "}" << endl << endl;
- // Return method
+ // Return method
indent(f_service_) << "public " + type_name(ret_type) + " getResult() throws ";
vector<t_field*>::const_iterator x_iter;
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
@@ -2854,7 +2854,7 @@
if (!(*f_iter)->is_oneway()) {
indent(f_service_);
if (!ret_type->is_void()) {
- f_service_ << "return ";
+ f_service_ << "return ";
}
f_service_ << "(new Client(prot)).recv" + sep + javaname + "();" << endl;
}
@@ -3386,13 +3386,13 @@
} else {
// Declare variables, read header
if (ttype->is_map()) {
- indent(out) << "org.apache.thrift.protocol.TMap " << obj << " = new org.apache.thrift.protocol.TMap(" <<
+ indent(out) << "org.apache.thrift.protocol.TMap " << obj << " = new org.apache.thrift.protocol.TMap(" <<
type_to_enum(((t_map*)ttype)->get_key_type()) << ", " << type_to_enum(((t_map*)ttype)->get_val_type()) << ", " << "iprot.readI32());" << endl;
} else if (ttype->is_set()) {
- indent(out) << "org.apache.thrift.protocol.TSet " << obj << " = new org.apache.thrift.protocol.TSet(" <<
+ indent(out) << "org.apache.thrift.protocol.TSet " << obj << " = new org.apache.thrift.protocol.TSet(" <<
type_to_enum(((t_set*)ttype)->get_elem_type()) << ", iprot.readI32());" << endl;
} else if (ttype->is_list()) {
- indent(out) << "org.apache.thrift.protocol.TList " << obj << " = new org.apache.thrift.protocol.TList(" <<
+ indent(out) << "org.apache.thrift.protocol.TList " << obj << " = new org.apache.thrift.protocol.TList(" <<
type_to_enum(((t_set*)ttype)->get_elem_type()) << ", iprot.readI32());" << endl;
}
}
@@ -3402,8 +3402,8 @@
indent_up();
}
- out <<
- indent() << prefix << " = new " << type_name(ttype, false, true);
+ out <<
+ indent() << prefix << " = new " << type_name(ttype, false, true);
// size the collection correctly
if (sorted_containers_ && (ttype->is_map() || ttype->is_set())) {
@@ -3450,7 +3450,7 @@
*/
void t_java_generator::generate_deserialize_map_element(ofstream& out,
t_map* tmap,
- string prefix,
+ string prefix,
string obj, bool has_metadata) {
string key = tmp("_key");
string val = tmp("_val");
@@ -3466,7 +3466,7 @@
"for (int " << i << " = 0; " <<
i << " < " << obj << ".size" << "; " <<
"++" << i << ")" << endl;
-
+
scope_up(out);
generate_deserialize_field(out, &fkey, "", has_metadata);
@@ -3480,7 +3480,7 @@
*/
void t_java_generator::generate_deserialize_set_element(ofstream& out,
t_set* tset,
- string prefix,
+ string prefix,
string obj, bool has_metadata) {
string elem = tmp("_elem");
t_field felem(tset->get_elem_type(), elem);
@@ -3494,7 +3494,7 @@
i << " < " << obj << ".size" << "; " <<
"++" << i << ")" << endl;
scope_up(out);
-
+
generate_deserialize_field(out, &felem, "", has_metadata);
indent(out) << prefix << ".add(" << elem << ");" << endl;
@@ -3506,7 +3506,7 @@
*/
void t_java_generator::generate_deserialize_list_element(ofstream& out,
t_list* tlist,
- string prefix,
+ string prefix,
string obj, bool has_metadata) {
string elem = tmp("_elem");
t_field felem(tlist->get_elem_type(), elem);
@@ -3520,7 +3520,7 @@
i << " < " << obj << ".size" << "; " <<
"++" << i << ")" << endl;
scope_up(out);
-
+
generate_deserialize_field(out, &felem, "", has_metadata);
indent(out) << prefix << ".add(" << elem << ");" << endl;
@@ -3557,7 +3557,7 @@
indent(out) << "oprot.";
if (type->is_base_type()) {
- t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
+ t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
switch (tbase) {
case t_base_type::TYPE_VOID:
throw "compiler error: cannot serialize void field in a struct: " + name;
@@ -3763,7 +3763,7 @@
if (in_init) {
if (sorted_containers_) {
prefix = "TreeSet";
- } else {
+ } else {
prefix = "HashSet";
}
} else {
@@ -4058,7 +4058,7 @@
// tests rely on this
assert( ('A' < 'Z') && ('a' < 'z') && ('0' < '9'));
-
+
// if the first letter is a number, we add an additional underscore in front of it
char c = str.at(0);
if( ('0' <= c) && (c <= '9')) {
@@ -4067,10 +4067,10 @@
// following chars: letter, number or underscore
for( size_t i = 0; i < str.size(); ++i) {
- c = str.at(i);
- if( (('A' > c) || (c > 'Z')) &&
- (('a' > c) || (c > 'z')) &&
- (('0' > c) || (c > '9')) &&
+ c = str.at(i);
+ if( (('A' > c) || (c > 'Z')) &&
+ (('a' > c) || (c > 'z')) &&
+ (('0' > c) || (c > '9')) &&
('_' != c) ) {
str.replace( i, 1, "_");
}
@@ -4160,7 +4160,7 @@
source_name = source_name_p1;
else
source_name = source_name_p1 + "." + source_name_p2;
-
+
bool copy_construct_container;
if (container->is_map()) {
t_map *tmap = (t_map *)container;
@@ -4319,8 +4319,8 @@
void t_java_generator::generate_scheme_map(ofstream& out, t_struct* tstruct) {
indent(out) << "private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();" << endl;
indent(out) << "static {" << endl;
- indent(out) << " schemes.put(StandardScheme.class, new " << tstruct->get_name() << "StandardSchemeFactory());" << endl;
- indent(out) << " schemes.put(TupleScheme.class, new " << tstruct->get_name() << "TupleSchemeFactory());" << endl;
+ indent(out) << " schemes.put(StandardScheme.class, new " << tstruct->get_name() << "StandardSchemeFactory());" << endl;
+ indent(out) << " schemes.put(TupleScheme.class, new " << tstruct->get_name() << "TupleSchemeFactory());" << endl;
indent(out) << "}" << endl;
}
@@ -4620,7 +4620,7 @@
void t_java_generator::generate_standard_writer(ofstream& out, t_struct* tstruct, bool is_result) {
indent_up();
out <<
- indent() << "public void write(org.apache.thrift.protocol.TProtocol oprot, " <<
+ indent() << "public void write(org.apache.thrift.protocol.TProtocol oprot, " <<
tstruct->get_name() << " struct) throws org.apache.thrift.TException {" << endl;
indent_up();
const vector<t_field*>& fields = tstruct->get_sorted_members();
@@ -4662,7 +4662,7 @@
}
}
// Write the struct map
- out <<
+ out <<
indent() << "oprot.writeFieldStop();" << endl <<
indent() << "oprot.writeStructEnd();" << endl;
@@ -4727,7 +4727,7 @@
}
}
indent_down();
- indent(out) << "}" << endl;
+ indent(out) << "}" << endl;
}
void t_java_generator::generate_java_struct_tuple_writer(ofstream& out, t_struct* tstruct) {
diff --git a/compiler/cpp/src/generate/t_javame_generator.cc b/compiler/cpp/src/generate/t_javame_generator.cc
index c28571e..eb934ac 100644
--- a/compiler/cpp/src/generate/t_javame_generator.cc
+++ b/compiler/cpp/src/generate/t_javame_generator.cc
@@ -389,14 +389,14 @@
indent(f_enum) << "case " << value << ":" << endl;
indent(f_enum) << " return " << (*c_iter)->get_name() << ";" << endl;
}
-
+
indent(f_enum) << "default:" << endl;
- indent(f_enum) << " return null;" << endl;
+ indent(f_enum) << " return null;" << endl;
indent_down();
indent(f_enum) << "}" << endl;
-
+
indent_down();
indent(f_enum) << "}" << endl;
@@ -617,7 +617,7 @@
}
/**
- * Generates a struct definition for a thrift data type. This will be a TBase
+ * Generates a struct definition for a thrift data type. This will be a TBase
* implementor.
*
* @param tstruct The struct definition
@@ -705,7 +705,7 @@
f_struct << endl;
generate_union_getters_and_setters(f_struct, tstruct);
-
+
f_struct << endl;
generate_union_comparisons(f_struct, tstruct);
@@ -746,14 +746,14 @@
indent(out) << " " << type_name(tstruct) << " x = new " << type_name(tstruct) << "();" << endl;
indent(out) << " x.set" << get_cap_name((*m_iter)->get_name()) << "(value);" << endl;
indent(out) << " return x;" << endl;
- indent(out) << "}" << endl << endl;
+ indent(out) << "}" << endl << endl;
}
}
void t_javame_generator::generate_union_getters_and_setters(ofstream& out, t_struct* tstruct) {
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
-
+
bool first = true;
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
if (first) {
@@ -769,11 +769,11 @@
indent(out) << " if (getSetField() == _Fields." << constant_name(field->get_name()) << ") {" << endl;
indent(out) << " return (" << type_name(field->get_type(), true) << ")getFieldValue();" << endl;
indent(out) << " } else {" << endl;
- indent(out) << " throw new RuntimeException(\"Cannot get field '" << field->get_name()
+ indent(out) << " throw new RuntimeException(\"Cannot get field '" << field->get_name()
<< "' because union is currently set to \" + getFieldDesc(getSetField()).name);" << endl;
indent(out) << " }" << endl;
indent(out) << "}" << endl;
-
+
out << endl;
generate_java_doc(out, field);
@@ -812,23 +812,23 @@
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_field* field = (*m_iter);
-
+
indent(out) << "case " << constant_name(field->get_name()) << ":" << endl;
indent(out) << " if (value instanceof " << type_name(field->get_type(), true, false, true) << ") {" << endl;
indent(out) << " break;" << endl;
indent(out) << " }" << endl;
- indent(out) << " throw new ClassCastException(\"Was expecting value of type "
- << type_name(field->get_type(), true, false) << " for field '" << field->get_name()
+ indent(out) << " throw new ClassCastException(\"Was expecting value of type "
+ << type_name(field->get_type(), true, false) << " for field '" << field->get_name()
<< "', but got \" + value.getClass().getSimpleName());" << endl;
// do the real check here
}
-
+
indent(out) << "default:" << endl;
indent(out) << " throw new IllegalArgumentException(\"Unknown field id \" + setField);" << endl;
indent_down();
indent(out) << "}" << endl;
-
+
indent_down();
indent(out) << "}" << endl;
}
@@ -849,7 +849,7 @@
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_field* field = (*m_iter);
-
+
indent(out) << "case " << constant_name(field->get_name()) << ":" << endl;
indent_up();
indent(out) << "if (field.type == " << constant_name(field->get_name()) << "_FIELD_DESC.type) {" << endl;
@@ -896,16 +896,16 @@
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_field* field = (*m_iter);
-
+
indent(out) << "case " << constant_name(field->get_name()) << ":" << endl;
indent_up();
- indent(out) << type_name(field->get_type(), true, false) << " " << field->get_name()
+ indent(out) << type_name(field->get_type(), true, false) << " " << field->get_name()
<< " = (" << type_name(field->get_type(), true, false) << ")value_;" << endl;
generate_serialize_field(out, field, "");
indent(out) << "return;" << endl;
indent_down();
}
-
+
indent(out) << "default:" << endl;
indent(out) << " throw new IllegalStateException(\"Cannot write union with unknown field \" + setField_);" << endl;
@@ -922,7 +922,7 @@
void t_javame_generator::generate_get_field_desc(ofstream& out, t_struct* tstruct) {
indent(out) << "protected TField getFieldDesc(_Fields setField) {" << endl;
indent_up();
-
+
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
@@ -1509,7 +1509,7 @@
out << "(this." << generate_isset_check(*f_iter) << ") {" << endl;
indent_up();
-
+
indent(out) << "oprot.writeFieldBegin(" << constant_name((*f_iter)->get_name()) << "_FIELD_DESC);" << endl;
// Write field contents
@@ -1737,7 +1737,7 @@
indent(out) << "__isset_vector[" << isset_field_id(field) << "] = value;" << endl;
}
indent_down();
- indent(out) << "}" << endl << endl;
+ indent(out) << "}" << endl << endl;
}
}
@@ -1778,13 +1778,13 @@
indent(out) << "} else {" << endl;
indent_up();
}
-
+
if (field->get_type()->is_base_type() && ((t_base_type*)(field->get_type()))->is_binary()) {
indent(out) << "TBaseHelper.toString(this." << field->get_name() << ", sb);" << endl;
} else {
indent(out) << "sb.append(this." << (*f_iter)->get_name() << ");" << endl;
}
-
+
if (can_be_null) {
indent_down();
indent(out) << "}" << endl;
@@ -1806,7 +1806,7 @@
endl;
}
-/**
+/**
* Returns a string with the java representation of the given thrift type
* (e.g. for the type struct it returns "TType.STRUCT")
*/
@@ -1849,12 +1849,12 @@
} else if (type->is_container()){
if (type->is_list()){
indent(out) << "new ListMetaData(TType.LIST, ";
- t_type* elem_type = ((t_list*)type)->get_elem_type();
- generate_field_value_meta_data(out, elem_type);
+ t_type* elem_type = ((t_list*)type)->get_elem_type();
+ generate_field_value_meta_data(out, elem_type);
} else if (type->is_set()){
indent(out) << "new SetMetaData(TType.SET, ";
- t_type* elem_type = ((t_list*)type)->get_elem_type();
- generate_field_value_meta_data(out, elem_type);
+ t_type* elem_type = ((t_list*)type)->get_elem_type();
+ generate_field_value_meta_data(out, elem_type);
} else{ // map
indent(out) << "new MapMetaData(TType.MAP, ";
t_type* key_type = ((t_map*)type)->get_key_type();
@@ -1930,7 +1930,7 @@
if (tservice->get_extends() != NULL) {
extends_iface = " extends " + type_name(tservice->get_extends()) + "Iface";
}
-
+
f_iface <<
autogen_comment() <<
java_package() <<
@@ -2346,7 +2346,7 @@
f_service_ <<
indent() << "args.read(iprot);" << endl;
indent_down();
- f_service_ <<
+ f_service_ <<
indent() << "} catch (TProtocolException e) {" << endl;
indent_up();
f_service_ <<
@@ -3238,7 +3238,7 @@
}
indent(out)
- << "for (Enumeration " << enumeration_name << " = " << source_name << ".elements(); "
+ << "for (Enumeration " << enumeration_name << " = " << source_name << ".elements(); "
<< enumeration_name << ".hasMoreElements(); ) {" << endl;
indent_up();
indent(out)
diff --git a/compiler/cpp/src/generate/t_js_generator.cc b/compiler/cpp/src/generate/t_js_generator.cc
index d330be9..d753bbb 100644
--- a/compiler/cpp/src/generate/t_js_generator.cc
+++ b/compiler/cpp/src/generate/t_js_generator.cc
@@ -66,8 +66,8 @@
}
else {
gen_ts_ = false;
- }
-
+ }
+
if (gen_node_ && gen_jquery_) {
throw "Invalid switch: [-gen js:node,jquery] options not compatible, try: [-gen js:node -gen js:jquery]";
}
@@ -289,7 +289,7 @@
if (tdoc->has_doc()) {
std::stringstream doc(tdoc->get_doc());
string item;
-
+
result += ts_indent() + "/**" + endl;
while (std::getline(doc, item)) {
result += ts_indent() + " * " + item + endl;
@@ -2178,7 +2178,7 @@
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
str += (*f_iter)->get_name() + ts_get_req(*f_iter) + ": " + ts_get_type((*f_iter)->get_type());
-
+
if (f_iter + 1 != fields.end()) {
str += ", ";
}
diff --git a/compiler/cpp/src/generate/t_perl_generator.cc b/compiler/cpp/src/generate/t_perl_generator.cc
index 6059ee8..5a5c080 100644
--- a/compiler/cpp/src/generate/t_perl_generator.cc
+++ b/compiler/cpp/src/generate/t_perl_generator.cc
@@ -1162,7 +1162,7 @@
// Serialize the request header
f_service_ <<
indent() << "$self->{output}->writeMessageBegin('" << (*f_iter)->get_name() << "', " <<
- ((*f_iter)->is_oneway() ? "TMessageType::ONEWAY" : "TMessageType::CALL") <<
+ ((*f_iter)->is_oneway() ? "TMessageType::ONEWAY" : "TMessageType::CALL") <<
", $self->{seqid});" << endl;
f_service_ <<
diff --git a/compiler/cpp/src/generate/t_rb_generator.cc b/compiler/cpp/src/generate/t_rb_generator.cc
index 3cfc0b1..0a15500 100644
--- a/compiler/cpp/src/generate/t_rb_generator.cc
+++ b/compiler/cpp/src/generate/t_rb_generator.cc
@@ -186,7 +186,7 @@
t_list* tlist,
std::string iter);
- void generate_rdoc (t_rb_ofstream& out,
+ void generate_rdoc (t_rb_ofstream& out,
t_doc* tdoc);
/**
@@ -383,7 +383,7 @@
generate_rdoc(f_types_, *c_iter);
f_types_.indent() << name << " = " << value << endl;
}
-
+
// Create a hash mapping values back to their names (as strings) since ruby has no native enum type
f_types_.indent() << "VALUE_MAP = {";
for(c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
@@ -393,7 +393,7 @@
f_types_ << value << " => \"" << capitalize((*c_iter)->get_name()) << "\"";
}
f_types_ << "}" << endl;
-
+
// Create a set with valid values for this enum
f_types_.indent() << "VALID_VALUES = Set.new([";
for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
@@ -615,7 +615,7 @@
out.indent() << " " << tstruct->get_name() << ".new(:" << field_name << ", val)" << endl;
out.indent() << "end" << endl;
}
-
+
out.indent_down();
out.indent() << "end" << endl;
@@ -652,7 +652,7 @@
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
std::string field_name = (*f_iter)->get_name();
std::string cap_field_name = upcase_string(field_name);
-
+
out.indent() << cap_field_name << " = " << (*f_iter)->get_key() << endl;
}
out << endl;
@@ -674,15 +674,15 @@
out.indent() << upcase_string((*f_iter)->get_name()) << " => ";
- generate_field_data(out, (*f_iter)->get_type(), (*f_iter)->get_name(), (*f_iter)->get_value(),
+ generate_field_data(out, (*f_iter)->get_type(), (*f_iter)->get_name(), (*f_iter)->get_value(),
(*f_iter)->get_req() == t_field::T_OPTIONAL);
}
out.indent_down();
out << endl;
out.indent() << "}" << endl << endl;
-
+
out.indent() << "def struct_fields; FIELDS; end" << endl << endl;
-
+
}
void t_rb_generator::generate_field_data(t_rb_ofstream& out, t_type* field_type,
@@ -721,7 +721,7 @@
out << ", :binary => true";
}
}
-
+
if(optional) {
out << ", :optional => true";
}
@@ -1191,7 +1191,7 @@
}
}
-void t_rb_generator::generate_rb_struct_required_validator(t_rb_ofstream& out,
+void t_rb_generator::generate_rb_struct_required_validator(t_rb_ofstream& out,
t_struct* tstruct) {
out.indent() << "def validate" << endl;
out.indent_up();
@@ -1218,14 +1218,14 @@
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
t_field* field = (*f_iter);
- if (field->get_type()->is_enum()){
+ if (field->get_type()->is_enum()){
out.indent() << "unless @" << field->get_name() << ".nil? || " <<
full_type_name(field->get_type()) << "::VALID_VALUES.include?(@" <<
field->get_name() << ")" << endl;
out.indent_up();
out.indent() <<
"raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field " <<
- field->get_name() << "!')" << endl;
+ field->get_name() << "!')" << endl;
out.indent_down();
out.indent() << "end" << endl;
}
@@ -1235,7 +1235,7 @@
out.indent() << "end" << endl << endl;
}
-void t_rb_generator::generate_rb_union_validator(t_rb_ofstream& out,
+void t_rb_generator::generate_rb_union_validator(t_rb_ofstream& out,
t_struct* tstruct) {
out.indent() << "def validate" << endl;
out.indent_up();
@@ -1250,12 +1250,12 @@
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
const t_field* field = (*f_iter);
- if (field->get_type()->is_enum()){
+ if (field->get_type()->is_enum()){
out.indent() << "if get_set_field == :" << field->get_name() << endl;
out.indent() <<
" raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field " <<
field->get_name() << "!') unless " << full_type_name(field->get_type()) <<
- "::VALID_VALUES.include?(get_value)" << endl;
+ "::VALID_VALUES.include?(get_value)" << endl;
out.indent() << "end" << endl;
}
}
diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc
index 9e92f1f..ed57596 100755
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/main.cc
@@ -146,7 +146,7 @@
*/
int g_doctext_lineno;
-/**
+/**
* The First doctext comment
*/
char* g_program_doctext_candidate;
@@ -414,10 +414,10 @@
*/
void declare_valid_program_doctext() {
if((g_program_doctext_candidate != NULL) && (g_program_doctext_status == STILL_CANDIDATE)) {
- g_program_doctext_status = ABSOLUTELY_SURE;
+ g_program_doctext_status = ABSOLUTELY_SURE;
pdebug("%s","program doctext set to ABSOLUTELY_SURE");
} else {
- g_program_doctext_status = NO_PROGRAM_DOCTEXT;
+ g_program_doctext_status = NO_PROGRAM_DOCTEXT;
pdebug("%s","program doctext set to NO_PROGRAM_DOCTEXT");
}
}
@@ -908,11 +908,11 @@
if( fgetc(f) == 0xBB) {
if( fgetc(f) == 0xBF) {
return true;
- }
- }
- }
-
- rewind(f);
+ }
+ }
+ }
+
+ rewind(f);
return false;
}
@@ -935,7 +935,7 @@
}
if( skip_utf8_bom( yyin))
pverbose("Skipped UTF-8 BOM at %s\n", path.c_str());
-
+
// Create new scope and scan for includes
pverbose("Scanning %s for includes\n", path.c_str());
g_parse_mode = INCLUDES;
@@ -977,7 +977,7 @@
}
if( skip_utf8_bom( yyin))
pverbose("Skipped UTF-8 BOM at %s\n", path.c_str());
-
+
pverbose("Parsing %s for types\n", path.c_str());
yylineno = 1;
try {
diff --git a/compiler/cpp/src/md5.h b/compiler/cpp/src/md5.h
index 698c995..3baa4dc 100644
--- a/compiler/cpp/src/md5.h
+++ b/compiler/cpp/src/md5.h
@@ -71,7 +71,7 @@
} md5_state_t;
#ifdef __cplusplus
-extern "C"
+extern "C"
{
#endif
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index 1536f81..d18cc5d 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -77,10 +77,10 @@
{
if(scope_)
{
- delete scope_;
- scope_ = NULL;
+ delete scope_;
+ scope_ = NULL;
}
- }
+ }
// Path accessor
const std::string& get_path() const { return path_; }
diff --git a/compiler/cpp/src/parse/t_scope.h b/compiler/cpp/src/parse/t_scope.h
index 4617bf8..e73c0f3 100644
--- a/compiler/cpp/src/parse/t_scope.h
+++ b/compiler/cpp/src/parse/t_scope.h
@@ -65,7 +65,6 @@
} else {
constants_[name] = constant;
}
-
}
t_const* get_constant(std::string name) {
diff --git a/compiler/cpp/src/parse/t_struct.h b/compiler/cpp/src/parse/t_struct.h
index 621f42e..8dd4c73 100644
--- a/compiler/cpp/src/parse/t_struct.h
+++ b/compiler/cpp/src/parse/t_struct.h
@@ -81,7 +81,7 @@
}
}
}
-
+
}
void validate_union_members() {
@@ -90,7 +90,7 @@
for (m_iter = members_in_id_order_.begin(); m_iter != members_in_id_order_.end(); ++m_iter) {
validate_union_member( *m_iter);
}
- members_validated = true;
+ members_validated = true;
}
}
@@ -117,7 +117,7 @@
}
// returns false when there is a conflict of field names
if (get_field_by_name(elem->get_name()) != NULL) {
- return false;
+ return false;
}
members_.push_back(elem);
members_in_id_order_.insert(bounds.second, elem);
@@ -140,7 +140,7 @@
bool is_xception() const {
return is_xception_;
}
-
+
bool is_union() const {
return is_union_;
}
@@ -153,7 +153,7 @@
for (m_iter = members_in_id_order_.begin(); m_iter != members_in_id_order_.end(); ++m_iter) {
rv += (*m_iter)->get_fingerprint_material();
rv += ";";
-
+
if( do_reserve) {
estimation = members_in_id_order_.size() * rv.size() + 16;
rv.reserve( estimation);
diff --git a/compiler/cpp/src/parse/t_typedef.h b/compiler/cpp/src/parse/t_typedef.h
index 52a7567..57d8df5 100644
--- a/compiler/cpp/src/parse/t_typedef.h
+++ b/compiler/cpp/src/parse/t_typedef.h
@@ -73,7 +73,7 @@
std::string ret = get_type()->get_fingerprint_material();
seen_ = false;
return ret;
- }
+ }
return "";
}
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index 1f7dc64..61d4231 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -300,7 +300,7 @@
| tok_namespace tok_identifier tok_identifier
{
pdebug("Header -> tok_namespace tok_identifier tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace($2, $3);
}
@@ -308,7 +308,7 @@
| tok_namespace '*' tok_identifier
{
pdebug("Header -> tok_namespace * tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("*", $3);
}
@@ -318,7 +318,7 @@
{
pwarning(1, "'cpp_namespace' is deprecated. Use 'namespace cpp' instead");
pdebug("Header -> tok_cpp_namespace tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("cpp", $2);
}
@@ -326,7 +326,7 @@
| tok_cpp_include tok_literal
{
pdebug("Header -> tok_cpp_include tok_literal");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->add_cpp_include($2);
}
@@ -335,7 +335,7 @@
{
pwarning(1, "'php_namespace' is deprecated. Use 'namespace php' instead");
pdebug("Header -> tok_php_namespace tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("php", $2);
}
@@ -345,7 +345,7 @@
{
pwarning(1, "'py_module' is deprecated. Use 'namespace py' instead");
pdebug("Header -> tok_py_module tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("py", $2);
}
@@ -355,7 +355,7 @@
{
pwarning(1, "'perl_package' is deprecated. Use 'namespace perl' instead");
pdebug("Header -> tok_perl_namespace tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("perl", $2);
}
@@ -365,7 +365,7 @@
{
pwarning(1, "'ruby_namespace' is deprecated. Use 'namespace rb' instead");
pdebug("Header -> tok_ruby_namespace tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("rb", $2);
}
@@ -375,7 +375,7 @@
{
pwarning(1, "'smalltalk_category' is deprecated. Use 'namespace smalltalk.category' instead");
pdebug("Header -> tok_smalltalk_category tok_st_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("smalltalk.category", $2);
}
@@ -385,7 +385,7 @@
{
pwarning(1, "'smalltalk_prefix' is deprecated. Use 'namespace smalltalk.prefix' instead");
pdebug("Header -> tok_smalltalk_prefix tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("smalltalk.prefix", $2);
}
@@ -395,7 +395,7 @@
{
pwarning(1, "'java_package' is deprecated. Use 'namespace java' instead");
pdebug("Header -> tok_java_package tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("java", $2);
}
@@ -405,7 +405,7 @@
{
pwarning(1, "'cocoa_prefix' is deprecated. Use 'namespace cocoa' instead");
pdebug("Header -> tok_cocoa_prefix tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("cocoa", $2);
}
@@ -415,7 +415,7 @@
{
pwarning(1, "'xsd_namespace' is deprecated. Use 'namespace xsd' instead");
pdebug("Header -> tok_xsd_namespace tok_literal");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("cocoa", $2);
}
@@ -425,7 +425,7 @@
{
pwarning(1, "'csharp_namespace' is deprecated. Use 'namespace csharp' instead");
pdebug("Header -> tok_csharp_namespace tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("csharp", $2);
}
@@ -435,7 +435,7 @@
{
pwarning(1, "'delphi_namespace' is deprecated. Use 'namespace delphi' instead");
pdebug("Header -> tok_delphi_namespace tok_identifier");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == PROGRAM) {
g_program->set_namespace("delphi", $2);
}
@@ -445,7 +445,7 @@
tok_include tok_literal
{
pdebug("Include -> tok_include tok_literal");
- declare_valid_program_doctext();
+ declare_valid_program_doctext();
if (g_parse_mode == INCLUDES) {
std::string path = include_file(std::string($2));
if (!path.empty()) {