Get rid of all the using namespace and using boost:: declarations in Thrift header files
Summary: To remove upstream dependencies. Still keeping some specific using directives around.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665047 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/transport/TFileTransport.cpp b/lib/cpp/src/transport/TFileTransport.cpp
index 86c7df2..56009b7 100644
--- a/lib/cpp/src/transport/TFileTransport.cpp
+++ b/lib/cpp/src/transport/TFileTransport.cpp
@@ -8,17 +8,20 @@
#include "TTransportUtils.h"
#include <pthread.h>
- #include <sys/time.h>
+#include <sys/time.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <iostream>
#include <sys/stat.h>
-using namespace std;
-
namespace facebook { namespace thrift { namespace transport {
+using boost::shared_ptr;
+using namespace std;
+using namespace facebook::thrift::protocol;
+
+
TFileTransport::TFileTransport(string path)
: readState_()
, readBuff_(NULL)
diff --git a/lib/cpp/src/transport/TFileTransport.h b/lib/cpp/src/transport/TFileTransport.h
index 635c883..235a2fe 100644
--- a/lib/cpp/src/transport/TFileTransport.h
+++ b/lib/cpp/src/transport/TFileTransport.h
@@ -18,8 +18,8 @@
namespace facebook { namespace thrift { namespace transport {
-using namespace boost;
-using std::string;
+using facebook::thrift::TProcessor;
+using facebook::thrift::protocol::TProtocolFactory;
// Data pertaining to a single event
typedef struct eventInfo {
@@ -129,7 +129,7 @@
*/
class TFileTransport : public TTransport {
public:
- TFileTransport(string path);
+ TFileTransport(std::string path);
~TFileTransport();
// TODO: what is the correct behaviour for this?
@@ -154,7 +154,7 @@
uint32_t getCurChunk();
// for changing the output file
- void resetOutputFile(int fd, string filename, long long offset);
+ void resetOutputFile(int fd, std::string filename, long long offset);
// Setter/Getter functions for user-controllable options
void setReadBuffSize(uint32_t readBuffSize) {
@@ -324,7 +324,7 @@
pthread_mutex_t mutex_;
// File information
- string filename_;
+ std::string filename_;
int fd_;
// Whether the writer thread and buffers have been initialized
@@ -339,10 +339,10 @@
};
// Exception thrown when EOF is hit
-class TEOFException : public facebook::thrift::TTransportException {
+ class TEOFException : TTransportException {
public:
TEOFException():
- facebook::thrift::TTransportException(TTransportException::END_OF_FILE) {};
+ TTransportException(TTransportException::END_OF_FILE) {};
};
@@ -356,14 +356,14 @@
* @param protocolFactory protocol factory
* @param inputTransport file transport
*/
- TFileProcessor(shared_ptr<TProcessor> processor,
- shared_ptr<TProtocolFactory> protocolFactory,
- shared_ptr<TFileTransport> inputTransport);
+ TFileProcessor(boost::shared_ptr<TProcessor> processor,
+ boost::shared_ptr<TProtocolFactory> protocolFactory,
+ boost::shared_ptr<TFileTransport> inputTransport);
- TFileProcessor(shared_ptr<TProcessor> processor,
- shared_ptr<TProtocolFactory> inputProtocolFactory,
- shared_ptr<TProtocolFactory> outputProtocolFactory,
- shared_ptr<TFileTransport> inputTransport);
+ TFileProcessor(boost::shared_ptr<TProcessor> processor,
+ boost::shared_ptr<TProtocolFactory> inputProtocolFactory,
+ boost::shared_ptr<TProtocolFactory> outputProtocolFactory,
+ boost::shared_ptr<TFileTransport> inputTransport);
/**
* Constructor
@@ -373,10 +373,10 @@
* @param inputTransport input file transport
* @param output output transport
*/
- TFileProcessor(shared_ptr<TProcessor> processor,
- shared_ptr<TProtocolFactory> protocolFactory,
- shared_ptr<TFileTransport> inputTransport,
- shared_ptr<TTransport> outputTransport);
+ TFileProcessor(boost::shared_ptr<TProcessor> processor,
+ boost::shared_ptr<TProtocolFactory> protocolFactory,
+ boost::shared_ptr<TFileTransport> inputTransport,
+ boost::shared_ptr<TTransport> outputTransport);
/**
* processes events from the file
@@ -393,11 +393,11 @@
void processChunk();
private:
- shared_ptr<TProcessor> processor_;
- shared_ptr<TProtocolFactory> inputProtocolFactory_;
- shared_ptr<TProtocolFactory> outputProtocolFactory_;
- shared_ptr<TFileTransport> inputTransport_;
- shared_ptr<TTransport> outputTransport_;
+ boost::shared_ptr<TProcessor> processor_;
+ boost::shared_ptr<TProtocolFactory> inputProtocolFactory_;
+ boost::shared_ptr<TProtocolFactory> outputProtocolFactory_;
+ boost::shared_ptr<TFileTransport> inputTransport_;
+ boost::shared_ptr<TTransport> outputTransport_;
};
diff --git a/lib/cpp/src/transport/TServerSocket.h b/lib/cpp/src/transport/TServerSocket.h
index b482e02..969c00b 100644
--- a/lib/cpp/src/transport/TServerSocket.h
+++ b/lib/cpp/src/transport/TServerSocket.h
@@ -38,7 +38,7 @@
}
protected:
- shared_ptr<TTransport> acceptImpl();
+ boost::shared_ptr<TTransport> acceptImpl();
private:
int port_;
diff --git a/lib/cpp/src/transport/TServerTransport.h b/lib/cpp/src/transport/TServerTransport.h
index bb47756..9512372 100644
--- a/lib/cpp/src/transport/TServerTransport.h
+++ b/lib/cpp/src/transport/TServerTransport.h
@@ -13,8 +13,6 @@
namespace facebook { namespace thrift { namespace transport {
-using namespace boost;
-
/**
* Server transport framework. A server needs to have some facility for
* creating base transports to read/write from.
@@ -43,8 +41,8 @@
* @return A new TTransport object
* @throws TTransportException if there is an error
*/
- shared_ptr<TTransport> accept() {
- shared_ptr<TTransport> result = acceptImpl();
+ boost::shared_ptr<TTransport> accept() {
+ boost::shared_ptr<TTransport> result = acceptImpl();
if (result == NULL) {
throw TTransportException("accept() may not return NULL");
}
@@ -73,7 +71,7 @@
* @return A newly allocated TTransport object
* @throw TTransportException If an error occurs
*/
- virtual shared_ptr<TTransport> acceptImpl() = 0;
+ virtual boost::shared_ptr<TTransport> acceptImpl() = 0;
};