Update dependencies

This commit is contained in:
James
2017-08-16 11:15:14 -07:00
parent b9c0374fe3
commit f46ea14760
1220 changed files with 142690 additions and 47576 deletions

View File

@@ -409,7 +409,7 @@ void t_cpp_generator::init_generator() {
<< "#include <thrift/transport/TTransport.h>" << endl
<< endl;
// Include C++xx compatibility header
f_types_ << "#include <thrift/cxxfunctional.h>" << endl;
f_types_ << "#include <thrift/stdcxx.h>" << endl;
// Include other Thrift includes
const vector<t_program*>& includes = program_->get_includes();
@@ -1108,7 +1108,7 @@ void t_cpp_generator::generate_struct_declaration(ofstream& out,
continue;
}
if (is_reference((*m_iter))) {
out << endl << indent() << "void __set_" << (*m_iter)->get_name() << "(boost::shared_ptr<"
out << endl << indent() << "void __set_" << (*m_iter)->get_name() << "(::apache::thrift::stdcxx::shared_ptr<"
<< type_name((*m_iter)->get_type(), false, false) << ">";
out << " val);" << endl;
} else {
@@ -1228,7 +1228,7 @@ void t_cpp_generator::generate_struct_definition(ofstream& out,
if (is_reference((*m_iter))) {
std::string type = type_name((*m_iter)->get_type());
out << endl << indent() << "void " << tstruct->get_name() << "::__set_"
<< (*m_iter)->get_name() << "(boost::shared_ptr<"
<< (*m_iter)->get_name() << "(::apache::thrift::stdcxx::shared_ptr<"
<< type_name((*m_iter)->get_type(), false, false) << ">";
out << " val) {" << endl;
} else {
@@ -1276,7 +1276,7 @@ void t_cpp_generator::generate_struct_reader(ofstream& out, t_struct* tstruct, b
// Declare stack tmp variables
out << endl
<< indent() << "apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);" << endl
<< indent() << "::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);" << endl
<< indent() << "uint32_t xfer = 0;" << endl
<< indent() << "std::string fname;" << endl
<< indent() << "::apache::thrift::protocol::TType ftype;" << endl
@@ -1400,7 +1400,7 @@ void t_cpp_generator::generate_struct_writer(ofstream& out, t_struct* tstruct, b
out << indent() << "uint32_t xfer = 0;" << endl;
indent(out) << "apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);" << endl;
indent(out) << "::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);" << endl;
indent(out) << "xfer += oprot->writeStructBegin(\"" << name << "\");" << endl;
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
@@ -1707,7 +1707,7 @@ void t_cpp_generator::generate_service(t_service* tservice) {
<< endl;
if (gen_cob_style_) {
f_header_ << "#include <thrift/transport/TBufferTransports.h>" << endl << // TMemoryBuffer
"#include <thrift/cxxfunctional.h>" << endl
"#include <thrift/stdcxx.h>" << endl
<< "namespace apache { namespace thrift { namespace async {" << endl
<< "class TAsyncChannel;" << endl << "}}}" << endl;
}
@@ -1949,7 +1949,7 @@ void t_cpp_generator::generate_service_interface_factory(t_service* tservice, st
f_header_ << "class " << singleton_factory_name << " : virtual public " << factory_name << " {"
<< endl << " public:" << endl;
indent_up();
f_header_ << indent() << singleton_factory_name << "(const boost::shared_ptr<" << service_if_name
f_header_ << indent() << singleton_factory_name << "(const ::apache::thrift::stdcxx::shared_ptr<" << service_if_name
<< ">& iface) : iface_(iface) {}" << endl << indent() << "virtual ~"
<< singleton_factory_name << "() {}" << endl << endl << indent() << "virtual "
<< service_if_name << "* getHandler("
@@ -1957,7 +1957,7 @@ void t_cpp_generator::generate_service_interface_factory(t_service* tservice, st
<< " return iface_.get();" << endl << indent() << "}" << endl << indent()
<< "virtual void releaseHandler(" << base_if_name << "* /* handler */) {}" << endl;
f_header_ << endl << " protected:" << endl << indent() << "boost::shared_ptr<" << service_if_name
f_header_ << endl << " protected:" << endl << indent() << "::apache::thrift::stdcxx::shared_ptr<" << service_if_name
<< "> iface_;" << endl;
indent_down();
@@ -2065,8 +2065,7 @@ void t_cpp_generator::generate_service_async_skeleton(t_service* tservice) {
<< "using namespace ::apache::thrift;" << endl
<< "using namespace ::apache::thrift::protocol;" << endl
<< "using namespace ::apache::thrift::transport;" << endl
<< "using namespace ::apache::thrift::async;" << endl << endl
<< "using boost::shared_ptr;" << endl << endl;
<< "using namespace ::apache::thrift::async;" << endl << endl;
// the following code would not compile:
// using namespace ;
@@ -2128,7 +2127,7 @@ void t_cpp_generator::generate_service_multiface(t_service* tservice) {
extends_multiface = ", public " + extends + "Multiface";
}
string list_type = string("std::vector<boost::shared_ptr<") + service_name_ + "If> >";
string list_type = string("std::vector<apache::thrift::stdcxx::shared_ptr<") + service_name_ + "If> >";
// Generate the header portion
f_header_ << "class " << service_name_ << "Multiface : "
@@ -2139,7 +2138,7 @@ void t_cpp_generator::generate_service_multiface(t_service* tservice) {
<< "& ifaces) : ifaces_(ifaces) {" << endl;
if (!extends.empty()) {
f_header_ << indent()
<< " std::vector<boost::shared_ptr<" + service_name_ + "If> >::iterator iter;"
<< " std::vector<apache::thrift::stdcxx::shared_ptr<" + service_name_ + "If> >::iterator iter;"
<< endl << indent() << " for (iter = ifaces.begin(); iter != ifaces.end(); ++iter) {"
<< endl << indent() << " " << extends << "Multiface::add(*iter);" << endl
<< indent() << " }" << endl;
@@ -2152,7 +2151,7 @@ void t_cpp_generator::generate_service_multiface(t_service* tservice) {
f_header_ << " protected:" << endl;
indent_up();
f_header_ << indent() << list_type << " ifaces_;" << endl << indent() << service_name_
<< "Multiface() {}" << endl << indent() << "void add(boost::shared_ptr<"
<< "Multiface() {}" << endl << indent() << "void add(::apache::thrift::stdcxx::shared_ptr<"
<< service_name_ << "If> iface) {" << endl;
if (!extends.empty()) {
f_header_ << indent() << " " << extends << "Multiface::add(iface);" << endl;
@@ -2234,7 +2233,7 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
} else {
protocol_type = "::apache::thrift::protocol::TProtocol";
}
string prot_ptr = "boost::shared_ptr< " + protocol_type + ">";
string prot_ptr = "apache::thrift::stdcxx::shared_ptr< " + protocol_type + ">";
string client_suffix = "Client" + template_suffix;
string if_suffix = "If";
if (style == "Cob") {
@@ -2311,18 +2310,18 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
// Note that these are not currently templated for simplicity.
// TODO(simpkins): should they be templated?
f_header_ << indent()
<< "boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {"
<< "apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {"
<< endl << indent() << " return " << _this << "piprot_;" << endl << indent() << "}"
<< endl;
f_header_ << indent()
<< "boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {"
<< "apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {"
<< endl << indent() << " return " << _this << "poprot_;" << endl << indent() << "}"
<< endl;
} else /* if (style == "Cob") */ {
f_header_ << indent() << service_name_ << style << "Client" << short_suffix << "("
<< "boost::shared_ptr< ::apache::thrift::async::TAsyncChannel> channel, "
<< "apache::thrift::stdcxx::shared_ptr< ::apache::thrift::async::TAsyncChannel> channel, "
<< "::apache::thrift::protocol::TProtocolFactory* protocolFactory) :" << endl;
if (extends.empty()) {
f_header_ << indent() << " channel_(channel)," << endl << indent()
@@ -2332,9 +2331,9 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
if (gen_templates_) {
// TProtocolFactory classes return generic TProtocol pointers.
// We have to dynamic cast to the Protocol_ type we are expecting.
f_header_ << indent() << " piprot_(boost::dynamic_pointer_cast<Protocol_>("
f_header_ << indent() << " piprot_(::apache::thrift::stdcxx::dynamic_pointer_cast<Protocol_>("
<< "protocolFactory->getProtocol(itrans_)))," << endl << indent()
<< " poprot_(boost::dynamic_pointer_cast<Protocol_>("
<< " poprot_(::apache::thrift::stdcxx::dynamic_pointer_cast<Protocol_>("
<< "protocolFactory->getProtocol(otrans_))) {" << endl;
// Throw a TException if either dynamic cast failed.
f_header_ << indent() << " if (!piprot_ || !poprot_) {" << endl << indent()
@@ -2356,7 +2355,7 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
if (style == "Cob") {
f_header_ << indent()
<< "boost::shared_ptr< ::apache::thrift::async::TAsyncChannel> getChannel() {" << endl
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::async::TAsyncChannel> getChannel() {" << endl
<< indent() << " return " << _this << "channel_;" << endl << indent() << "}" << endl;
if (!gen_no_client_completion_) {
f_header_ << indent() << "virtual void completed__(bool /* success */) {}" << endl;
@@ -2408,11 +2407,11 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
if (style == "Cob") {
f_header_ << indent()
<< "boost::shared_ptr< ::apache::thrift::async::TAsyncChannel> channel_;" << endl
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::async::TAsyncChannel> channel_;" << endl
<< indent()
<< "boost::shared_ptr< ::apache::thrift::transport::TMemoryBuffer> itrans_;" << endl
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::transport::TMemoryBuffer> itrans_;" << endl
<< indent()
<< "boost::shared_ptr< ::apache::thrift::transport::TMemoryBuffer> otrans_;"
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::transport::TMemoryBuffer> otrans_;"
<< endl;
}
f_header_ <<
@@ -2494,11 +2493,11 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
} else {
if (!(*f_iter)->is_oneway()) {
out << indent() << _this << "channel_->sendAndRecvMessage("
<< "tcxx::bind(cob, this), " << _this << "otrans_.get(), " << _this << "itrans_.get());"
<< "::apache::thrift::stdcxx::bind(cob, this), " << _this << "otrans_.get(), " << _this << "itrans_.get());"
<< endl;
} else {
out << indent() << _this << "channel_->sendMessage("
<< "tcxx::bind(cob, this), " << _this << "otrans_.get());" << endl;
<< "::apache::thrift::stdcxx::bind(cob, this), " << _this << "otrans_.get());" << endl;
}
}
scope_down(out);
@@ -2849,8 +2848,8 @@ ProcessorGenerator::ProcessorGenerator(t_cpp_generator* generator,
class_name_ = service_name_ + pstyle_ + "Processor";
if_name_ = service_name_ + "CobSvIf";
finish_cob_ = "tcxx::function<void(bool ok)> cob, ";
finish_cob_decl_ = "tcxx::function<void(bool ok)>, ";
finish_cob_ = "::apache::thrift::stdcxx::function<void(bool ok)> cob, ";
finish_cob_decl_ = "::apache::thrift::stdcxx::function<void(bool ok)>, ";
cob_arg_ = "cob, ";
ret_type_ = "void ";
} else {
@@ -2911,7 +2910,7 @@ void ProcessorGenerator::generate_class_definition() {
// Protected data members
f_header_ << " protected:" << endl;
indent_up();
f_header_ << indent() << "boost::shared_ptr<" << if_name_ << "> iface_;" << endl;
f_header_ << indent() << "::apache::thrift::stdcxx::shared_ptr<" << if_name_ << "> iface_;" << endl;
f_header_ << indent() << "virtual " << ret_type_ << "dispatchCall(" << finish_cob_
<< "::apache::thrift::protocol::TProtocol* iprot, "
<< "::apache::thrift::protocol::TProtocol* oprot, "
@@ -2967,29 +2966,29 @@ void ProcessorGenerator::generate_class_definition() {
? ""
: ", const " + type_name((*f_iter)->get_returntype()) + "& _return");
f_header_ << indent() << "void return_" << (*f_iter)->get_name()
<< "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "::apache::thrift::protocol::TProtocol* oprot, "
<< "void* ctx" << ret_arg << ");" << endl;
if (generator_->gen_templates_) {
f_header_ << indent() << "void return_" << (*f_iter)->get_name()
<< "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "Protocol_* oprot, void* ctx" << ret_arg << ");" << endl;
}
// XXX Don't declare throw if it doesn't exist
f_header_ << indent() << "void throw_" << (*f_iter)->get_name()
<< "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "::apache::thrift::protocol::TProtocol* oprot, void* ctx, "
<< "::apache::thrift::TDelayedException* _throw);" << endl;
if (generator_->gen_templates_) {
f_header_ << indent() << "void throw_" << (*f_iter)->get_name()
<< "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "Protocol_* oprot, void* ctx, "
<< "::apache::thrift::TDelayedException* _throw);" << endl;
}
}
}
f_header_ << " public:" << endl << indent() << class_name_ << "(boost::shared_ptr<" << if_name_
f_header_ << " public:" << endl << indent() << class_name_ << "(::apache::thrift::stdcxx::shared_ptr<" << if_name_
<< "> iface) :" << endl;
if (!extends_.empty()) {
f_header_ << indent() << " " << extends_ << "(iface)," << endl;
@@ -3127,14 +3126,14 @@ void ProcessorGenerator::generate_factory() {
<< endl << " public:" << endl;
indent_up();
f_header_ << indent() << factory_class_name_ << "(const ::boost::shared_ptr< " << if_factory_name
f_header_ << indent() << factory_class_name_ << "(const ::apache::thrift::stdcxx::shared_ptr< " << if_factory_name
<< " >& handlerFactory) :" << endl << indent()
<< " handlerFactory_(handlerFactory) {}" << endl << endl << indent()
<< "::boost::shared_ptr< ::apache::thrift::"
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::"
<< (style_ == "Cob" ? "async::TAsyncProcessor" : "TProcessor") << " > "
<< "getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);" << endl;
f_header_ << endl << " protected:" << endl << indent() << "::boost::shared_ptr< "
f_header_ << endl << " protected:" << endl << indent() << "::apache::thrift::stdcxx::shared_ptr< "
<< if_factory_name << " > handlerFactory_;" << endl;
indent_down();
@@ -3149,17 +3148,17 @@ void ProcessorGenerator::generate_factory() {
}
// Generate the getProcessor() method
f_out_ << template_header_ << indent() << "::boost::shared_ptr< ::apache::thrift::"
f_out_ << template_header_ << indent() << "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::"
<< (style_ == "Cob" ? "async::TAsyncProcessor" : "TProcessor") << " > "
<< factory_class_name_ << template_suffix_ << "::getProcessor("
<< "const ::apache::thrift::TConnectionInfo& connInfo) {" << endl;
indent_up();
f_out_ << indent() << "::apache::thrift::ReleaseHandler< " << if_factory_name
<< " > cleanup(handlerFactory_);" << endl << indent() << "::boost::shared_ptr< "
<< " > cleanup(handlerFactory_);" << endl << indent() << "::apache::thrift::stdcxx::shared_ptr< "
<< if_name_ << " > handler("
<< "handlerFactory_->getHandler(connInfo), cleanup);" << endl << indent()
<< "::boost::shared_ptr< ::apache::thrift::"
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::"
<< (style_ == "Cob" ? "async::TAsyncProcessor" : "TProcessor") << " > "
<< "processor(new " << class_name_ << template_suffix_ << "(handler));" << endl << indent()
<< "return processor;" << endl;
@@ -3394,7 +3393,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
out << indent() << "template <class Protocol_>" << endl;
}
out << "void " << tservice->get_name() << "AsyncProcessor" << class_suffix << "::process_"
<< tfunction->get_name() << "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< tfunction->get_name() << "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< prot_type << "* iprot, " << prot_type << "* oprot)" << endl;
scope_up(out);
@@ -3451,28 +3450,28 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
// No return. Just hand off our cob.
// TODO(dreiss): Call the cob immediately?
out << indent() << "iface_->" << tfunction->get_name() << "("
<< "tcxx::bind(cob, true)" << endl;
<< "::apache::thrift::stdcxx::bind(cob, true)" << endl;
indent_up();
indent_up();
} else {
string ret_arg, ret_placeholder;
if (!tfunction->get_returntype()->is_void()) {
ret_arg = ", const " + type_name(tfunction->get_returntype()) + "& _return";
ret_placeholder = ", tcxx::placeholders::_1";
ret_placeholder = ", ::apache::thrift::stdcxx::placeholders::_1";
}
// When gen_templates_ is true, the return_ and throw_ functions are
// overloaded. We have to declare pointers to them so that the compiler
// can resolve the correct overloaded version.
out << indent() << "void (" << tservice->get_name() << "AsyncProcessor" << class_suffix
<< "::*return_fn)(tcxx::function<void(bool ok)> "
<< "::*return_fn)(::apache::thrift::stdcxx::function<void(bool ok)> "
<< "cob, int32_t seqid, " << prot_type << "* oprot, void* ctx" << ret_arg
<< ") =" << endl;
out << indent() << " &" << tservice->get_name() << "AsyncProcessor" << class_suffix
<< "::return_" << tfunction->get_name() << ";" << endl;
if (!xceptions.empty()) {
out << indent() << "void (" << tservice->get_name() << "AsyncProcessor" << class_suffix
<< "::*throw_fn)(tcxx::function<void(bool ok)> "
<< "::*throw_fn)(::apache::thrift::stdcxx::function<void(bool ok)> "
<< "cob, int32_t seqid, " << prot_type << "* oprot, void* ctx, "
<< "::apache::thrift::TDelayedException* _throw) =" << endl;
out << indent() << " &" << tservice->get_name() << "AsyncProcessor" << class_suffix
@@ -3482,11 +3481,11 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
out << indent() << "iface_->" << tfunction->get_name() << "(" << endl;
indent_up();
indent_up();
out << indent() << "tcxx::bind(return_fn, this, cob, seqid, oprot, ctx" << ret_placeholder
out << indent() << "::apache::thrift::stdcxx::bind(return_fn, this, cob, seqid, oprot, ctx" << ret_placeholder
<< ")";
if (!xceptions.empty()) {
out << ',' << endl << indent() << "tcxx::bind(throw_fn, this, cob, seqid, oprot, "
<< "ctx, tcxx::placeholders::_1)";
out << ',' << endl << indent() << "::apache::thrift::stdcxx::bind(throw_fn, this, cob, seqid, oprot, "
<< "ctx, ::apache::thrift::stdcxx::placeholders::_1)";
}
}
@@ -3511,7 +3510,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
out << indent() << "template <class Protocol_>" << endl;
}
out << "void " << tservice->get_name() << "AsyncProcessor" << class_suffix << "::return_"
<< tfunction->get_name() << "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< tfunction->get_name() << "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< prot_type << "* oprot, void* ctx" << ret_arg_decl << ')' << endl;
scope_up(out);
@@ -3559,7 +3558,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
out << indent() << "template <class Protocol_>" << endl;
}
out << "void " << tservice->get_name() << "AsyncProcessor" << class_suffix << "::throw_"
<< tfunction->get_name() << "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< tfunction->get_name() << "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< prot_type << "* oprot, void* ctx, "
<< "::apache::thrift::TDelayedException* _throw)" << endl;
scope_up(out);
@@ -3659,8 +3658,7 @@ void t_cpp_generator::generate_service_skeleton(t_service* tservice) {
<< "using namespace ::apache::thrift;" << endl
<< "using namespace ::apache::thrift::protocol;" << endl
<< "using namespace ::apache::thrift::transport;" << endl
<< "using namespace ::apache::thrift::server;" << endl << endl
<< "using boost::shared_ptr;" << endl << endl;
<< "using namespace ::apache::thrift::server;" << endl << endl;
// the following code would not compile:
// using namespace ;
@@ -3690,13 +3688,13 @@ void t_cpp_generator::generate_service_skeleton(t_service* tservice) {
f_skeleton << indent() << "int main(int argc, char **argv) {" << endl;
indent_up();
f_skeleton
<< indent() << "int port = 9090;" << endl << indent() << "shared_ptr<" << svcname
<< indent() << "int port = 9090;" << endl << indent() << "::apache::thrift::stdcxx::shared_ptr<" << svcname
<< "Handler> handler(new " << svcname << "Handler());" << endl << indent()
<< "shared_ptr<TProcessor> processor(new " << svcname << "Processor(handler));" << endl
<< indent() << "shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));"
<< "::apache::thrift::stdcxx::shared_ptr<TProcessor> processor(new " << svcname << "Processor(handler));" << endl
<< indent() << "::apache::thrift::stdcxx::shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));"
<< endl << indent()
<< "shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());" << endl
<< indent() << "shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());"
<< "::apache::thrift::stdcxx::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());" << endl
<< indent() << "::apache::thrift::stdcxx::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());"
<< endl << endl << indent()
<< "TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);"
<< endl << indent() << "server.serve();" << endl << indent() << "return 0;" << endl;
@@ -3785,7 +3783,7 @@ void t_cpp_generator::generate_deserialize_struct(ofstream& out,
bool pointer) {
if (pointer) {
indent(out) << "if (!" << prefix << ") { " << endl;
indent(out) << " " << prefix << " = boost::shared_ptr<" << type_name(tstruct) << ">(new "
indent(out) << " " << prefix << " = ::apache::thrift::stdcxx::shared_ptr<" << type_name(tstruct) << ">(new "
<< type_name(tstruct) << ");" << endl;
indent(out) << "}" << endl;
indent(out) << "xfer += " << prefix << "->read(iprot);" << endl;
@@ -4277,7 +4275,7 @@ string t_cpp_generator::declare_field(t_field* tfield,
}
result += type_name(tfield->get_type());
if (is_reference(tfield)) {
result = "boost::shared_ptr<" + result + ">";
result = "::apache::thrift::stdcxx::shared_ptr<" + result + ">";
}
if (pointer) {
result += "*";
@@ -4356,13 +4354,13 @@ string t_cpp_generator::function_signature(t_function* tfunction,
cob_type = (ttype->is_void() ? "()" : ("(" + type_name(ttype) + " const& _return)"));
if (has_xceptions) {
exn_cob
= ", tcxx::function<void(::apache::thrift::TDelayedException* _throw)> /* exn_cob */";
= ", ::apache::thrift::stdcxx::function<void(::apache::thrift::TDelayedException* _throw)> /* exn_cob */";
}
} else {
throw "UNKNOWN STYLE";
}
return "void " + prefix + tfunction->get_name() + "(tcxx::function<void" + cob_type + "> cob"
return "void " + prefix + tfunction->get_name() + "(::apache::thrift::stdcxx::function<void" + cob_type + "> cob"
+ exn_cob + argument_list(arglist, name_params, true) + ")";
} else {
throw "UNKNOWN STYLE";

View File

@@ -266,8 +266,8 @@ void t_erl_generator::init_generator() {
<< "-module(" << program_module_name << "_types)." << endl
<< erl_imports() << endl;
f_types_file_ << "-include(\"" << f_types_hrl_name << "\")." << endl
<< endl;
f_types_file_ << "-include(\"" << program_module_name << "_types.hrl\")." << endl
<< endl;
f_types_hrl_file_ << render_includes() << endl;
@@ -281,11 +281,11 @@ void t_erl_generator::init_generator() {
f_consts_file_ << erl_autogen_comment() << endl
<< "-module(" << program_module_name << "_constants)." << endl
<< erl_imports() << endl
<< "-include(\"" << f_types_hrl_name << "\")." << endl
<< "-include(\"" << program_module_name << "_types.hrl\")." << endl
<< endl;
f_consts_hrl_file_ << erl_autogen_comment() << endl << erl_imports() << endl
<< "-include(\"" << f_types_hrl_name << "\")." << endl << endl;
<< "-include(\"" << program_module_name << "_types.hrl\")." << endl << endl;
}
/**

View File

@@ -1483,11 +1483,20 @@ void t_js_generator::generate_service_client(t_service* tservice) {
<< "', " << messageType << ", this.seqid);" << endl;
}
f_service_ << indent() << "var args = new " << argsname << "();" << endl;
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
f_service_ << indent() << "args." << (*fld_iter)->get_name() << " = "
<< (*fld_iter)->get_name() << ";" << endl;
if (fields.size() > 0){
f_service_ << indent() << "var params = {" << endl;
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
f_service_ << indent() << indent() << (*fld_iter)->get_name() << ": " << (*fld_iter)->get_name();
if (fld_iter != fields.end()-1) {
f_service_ << "," << endl;
} else {
f_service_ << endl;
}
}
f_service_ << indent() << "};" << endl;
f_service_ << indent() << "var args = new " << argsname << "(params);" << endl;
} else {
f_service_ << indent() << "var args = new " << argsname << "();" << endl;
}
// Write to the stream

View File

@@ -27,17 +27,15 @@
#include <cassert>
#include <iostream>
#include <boost/bind.hpp>
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/for_each.hpp>
#include <boost/smart_ptr.hpp>
#include "thrift/generate/t_generator.h"
#include "thrift/plugin/type_util.h"
#include "thrift/protocol/TBinaryProtocol.h"
#include "thrift/transport/TBufferTransports.h"
#include "thrift/transport/TFDTransport.h"
#include "thrift/stdcxx.h"
#include "thrift/plugin/plugin_types.h"
namespace apache {
@@ -121,7 +119,7 @@ struct TypeCache {
void compileAll() {
boost::for_each(*source | boost::adaptors::map_keys,
boost::bind(&TypeCache::compile, this, _1));
stdcxx::bind(&TypeCache::compile, this, stdcxx::placeholders::_1));
}
std::map<int64_t, S> const* source;
@@ -218,7 +216,7 @@ THRIFT_CONVERSION(t_enum, g_program_cache[from.metadata.program_id]) {
assert(to);
THRIFT_ASSIGN_METADATA();
boost::for_each(from.constants | boost::adaptors::transformed(convert<t_enum_value>),
boost::bind(&::t_enum::append, to, _1));
stdcxx::bind(&::t_enum::append, to, stdcxx::placeholders::_1));
}
THRIFT_CONVERSION(t_list, resolve_type< ::t_type>(from.elem_type)) {
assert(to);
@@ -255,7 +253,7 @@ THRIFT_CONVERSION(t_const_value, ) {
} else if (from.__isset.list_val) {
to->set_list();
boost::for_each(from.list_val | boost::adaptors::transformed(&convert<t_const_value>),
boost::bind(&::t_const_value::add_list, to, _1));
stdcxx::bind(&::t_const_value::add_list, to, stdcxx::placeholders::_1));
} else
T_CONST_VALUE_CASE(string);
else T_CONST_VALUE_CASE(integer);
@@ -282,7 +280,7 @@ THRIFT_CONVERSION(t_struct, g_program_cache[from.metadata.program_id]) {
to->set_union(from.is_union);
to->set_xception(from.is_xception);
boost::for_each(from.members | boost::adaptors::transformed(convert<t_field>),
boost::bind(&::t_struct::append, to, _1));
stdcxx::bind(&::t_struct::append, to, stdcxx::placeholders::_1));
}
THRIFT_CONVERSION(t_const,
resolve_type< ::t_type>(from.type),
@@ -309,7 +307,7 @@ THRIFT_CONVERSION(t_service, g_program_cache[from.metadata.program_id]) {
THRIFT_ASSIGN_METADATA();
boost::for_each(from.functions | boost::adaptors::transformed(convert<t_function>),
boost::bind(&::t_service::add_function, to, _1));
stdcxx::bind(&::t_service::add_function, to, stdcxx::placeholders::_1));
if (from.__isset.extends_)
to->set_extends(resolve_service(from.extends_));
@@ -390,9 +388,9 @@ THRIFT_CONVERT_COMPLETE(t_program) {
to->set_out_path(from.out_path, from.out_path_is_absolute);
boost::for_each(from.typedefs | boost::adaptors::transformed(&resolve_type< ::t_typedef>),
boost::bind(&::t_program::add_typedef, to, _1));
stdcxx::bind(&::t_program::add_typedef, to, stdcxx::placeholders::_1));
boost::for_each(from.enums | boost::adaptors::transformed(&resolve_type< ::t_enum>),
boost::bind(&::t_program::add_enum, to, _1));
stdcxx::bind(&::t_program::add_enum, to, stdcxx::placeholders::_1));
for (std::vector<int64_t>::const_iterator it = from.objects.begin(); it != from.objects.end();
it++) {
::t_struct* t2 = resolve_type< ::t_struct>(*it);
@@ -403,18 +401,18 @@ THRIFT_CONVERT_COMPLETE(t_program) {
}
}
boost::for_each(from.consts | boost::adaptors::transformed(&resolve_const),
boost::bind(&::t_program::add_const, to, _1));
stdcxx::bind(&::t_program::add_const, to, stdcxx::placeholders::_1));
boost::for_each(from.services | boost::adaptors::transformed(&resolve_service),
boost::bind(&::t_program::add_service, to, _1));
stdcxx::bind(&::t_program::add_service, to, stdcxx::placeholders::_1));
for (std::vector<t_program>::const_iterator it = from.includes.begin(); it != from.includes.end();
it++) {
convert(*it, g_program_cache[it->program_id]);
}
std::for_each(from.c_includes.begin(), from.c_includes.end(),
boost::bind(&::t_program::add_c_include, to, _1));
stdcxx::bind(&::t_program::add_c_include, to, stdcxx::placeholders::_1));
std::for_each(from.cpp_includes.begin(), from.cpp_includes.end(),
boost::bind(&::t_program::add_cpp_include, to, _1));
stdcxx::bind(&::t_program::add_cpp_include, to, stdcxx::placeholders::_1));
for (std::map<std::string, std::string>::const_iterator it = from.namespaces.begin();
it != from.namespaces.end(); it++) {
to->set_namespace(it->first, it->second);
@@ -428,8 +426,8 @@ int GeneratorPlugin::exec(int, char* []) {
#ifdef _WIN32
_setmode(fileno(stdin), _O_BINARY);
#endif
boost::shared_ptr<TFramedTransport> transport(
new TFramedTransport(boost::make_shared<TFDTransport>(fileno(stdin))));
stdcxx::shared_ptr<TFramedTransport> transport(
new TFramedTransport(stdcxx::make_shared<TFDTransport>(fileno(stdin))));
TBinaryProtocol proto(transport);
GeneratorInput input;
try {

View File

@@ -34,12 +34,12 @@
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/algorithm/transform.hpp>
#include <boost/smart_ptr.hpp>
#include "thrift/generate/t_generator.h"
#include "thrift/plugin/plugin.h"
#include "thrift/plugin/type_util.h"
#include "thrift/protocol/TBinaryProtocol.h"
#include "thrift/stdcxx.h"
#include "thrift/transport/TBufferTransports.h"
#include "thrift/transport/TFDTransport.h"
@@ -55,6 +55,8 @@ typename apache::thrift::plugin::ToType<From>::type convert(From* from) {
}
using apache::thrift::protocol::TBinaryProtocol;
using apache::thrift::stdcxx::make_shared;
using apache::thrift::stdcxx::shared_ptr;
using apache::thrift::transport::TFDTransport;
using apache::thrift::transport::TFramedTransport;
@@ -377,8 +379,8 @@ PluginDelegateResult delegateToPlugin(t_program* program, const std::string& opt
#ifdef _WIN32
_setmode(fileno(fd), _O_BINARY);
#endif
boost::shared_ptr<TFramedTransport> transport(
new TFramedTransport(boost::make_shared<TFDTransport>(fileno(fd))));
shared_ptr<TFramedTransport> transport(
new TFramedTransport(make_shared<TFDTransport>(fileno(fd))));
TBinaryProtocol proto(transport);
plugin::GeneratorInput input;