From 84f9dd2d7a80f345a6cfd42fa60fbaca91e7ae20 Mon Sep 17 00:00:00 2001 From: badaix Date: Thu, 12 Nov 2015 09:35:12 +0100 Subject: [PATCH] removed depency to boost lexical cast and boost algorithm --- client/clientConnection.cpp | 2 +- common/log.h | 1 - common/utils.h | 21 +++++++++++++++++++++ message/sampleFormat.cpp | 6 +++--- server/controlServer.cpp | 1 - server/encoder/oggEncoder.cpp | 2 +- server/json/jsonrpcException.h | 1 - 7 files changed, 26 insertions(+), 8 deletions(-) diff --git a/client/clientConnection.cpp b/client/clientConnection.cpp index c5c8fb55..887c6b1c 100644 --- a/client/clientConnection.cpp +++ b/client/clientConnection.cpp @@ -18,11 +18,11 @@ #include #include -#include "common/log.h" #include "clientConnection.h" #include "common/utils.h" #include "common/snapException.h" #include "message/hello.h" +#include "common/log.h" using namespace std; diff --git a/common/log.h b/common/log.h index 8be0ae86..eaa15f6c 100644 --- a/common/log.h +++ b/common/log.h @@ -24,7 +24,6 @@ #include #include #include -#include #define logD std::clog << kDbg #define logO std::clog << kOut diff --git a/common/utils.h b/common/utils.h index 46de6eb1..e8e36265 100644 --- a/common/utils.h +++ b/common/utils.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -79,6 +80,26 @@ static inline std::string trim_copy(const std::string &s) } +static std::vector &split(const std::string &s, char delim, std::vector &elems) +{ + std::stringstream ss(s); + std::string item; + while (std::getline(ss, item, delim)) + { + elems.push_back(item); + } + return elems; +} + + +static std::vector split(const std::string &s, char delim) +{ + std::vector elems; + split(s, delim, elems); + return elems; +} + + static std::string getHostName() { char hostname[1024]; diff --git a/message/sampleFormat.cpp b/message/sampleFormat.cpp index f098e0e9..2a124919 100644 --- a/message/sampleFormat.cpp +++ b/message/sampleFormat.cpp @@ -17,12 +17,12 @@ ***/ #include -#include #include +#include #include "sampleFormat.h" +#include "common/utils.h" #include "common/log.h" -#include using namespace std; @@ -58,7 +58,7 @@ string SampleFormat::getFormat() const void SampleFormat::setFormat(const std::string& format) { std::vector strs; - boost::split(strs, format, boost::is_any_of(":")); + strs = split(format, ':'); if (strs.size() == 3) setFormat( std::stoul(strs[0]), diff --git a/server/controlServer.cpp b/server/controlServer.cpp index 22460bf6..7c9c67da 100644 --- a/server/controlServer.cpp +++ b/server/controlServer.cpp @@ -16,7 +16,6 @@ along with this program. If not, see . ***/ -#include "boost/lexical_cast.hpp" #include "controlServer.h" #include "message/time.h" #include "message/ack.h" diff --git a/server/encoder/oggEncoder.cpp b/server/encoder/oggEncoder.cpp index 69cbe6c1..2caa5da1 100644 --- a/server/encoder/oggEncoder.cpp +++ b/server/encoder/oggEncoder.cpp @@ -20,9 +20,9 @@ #include #include "oggEncoder.h" -#include "common/log.h" #include "common/snapException.h" #include "common/utils.h" +#include "common/log.h" using namespace std; diff --git a/server/json/jsonrpcException.h b/server/json/jsonrpcException.h index 3b8687b9..85c73531 100644 --- a/server/json/jsonrpcException.h +++ b/server/json/jsonrpcException.h @@ -20,7 +20,6 @@ #define JSON_RPC_EXCEPTION_H #include -#include #include "json.hpp" #include "common/snapException.h"