From b999c6ca53d6b1dfd54688d21718293858f6bcc7 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 29 Apr 2011 21:12:49 -0400 Subject: Expand more on m_alias and changed some std::string usage in sockets.cpp to use Anope::string --- include/anope.h | 11 +++++++++++ include/commands.h | 5 +++++ include/sockets.h | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/anope.h b/include/anope.h index b23b68481..0e25bbb93 100644 --- a/include/anope.h +++ b/include/anope.h @@ -173,6 +173,17 @@ namespace Anope inline iterator erase(const iterator &first, const iterator &last) { return this->_string.erase(first, last); } inline void erase(size_type pos = 0, size_type n = std::string::npos) { this->_string.erase(pos, n); } + /** + * Trim leading and trailing white spaces from the string. + */ + inline void trim() + { + while (!this->_string.empty() && isspace(this->_string[0])) + this->_string.erase(this->_string.begin()); + while (!this->_string.empty() && isspace(this->_string[this->_string.length() - 1])) + this->_string.erase(this->_string.length() - 1); + } + /** * Clears the string. */ diff --git a/include/commands.h b/include/commands.h index 89735211c..e966e9e39 100644 --- a/include/commands.h +++ b/include/commands.h @@ -110,6 +110,11 @@ class CoreExport Command : public Flags, public Base void SetDesc(const Anope::string &d); public: + /** Get the command description + * @return The commands description + */ + const Anope::string &GetDesc() const; + /** Execute this command. * @param source The source * @param params Command parameters diff --git a/include/sockets.h b/include/sockets.h index 68be2c9b7..bc0c831bf 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -234,9 +234,9 @@ class CoreExport BufferedSocket : public Socket { protected: /* Things to be written to the socket */ - std::string WriteBuffer; + Anope::string WriteBuffer; /* Part of a message sent from the server, but not totally received */ - std::string extrabuf; + Anope::string extrabuf; /* How much data was received from this socket */ size_t RecvLen; -- cgit