diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-26 17:05:18 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-26 17:18:21 +0200 |
commit | 43e99491a76bb85faf60c004e84b6c2b14cf41e7 (patch) | |
tree | 4aba689b76138118b4da043425fb3e8576db418c /src/utils | |
parent | e726c34606f85347e70a0deb6b180db03b6d0c25 (diff) | |
download | manaserv-43e99491a76bb85faf60c004e84b6c2b14cf41e7.tar.gz manaserv-43e99491a76bb85faf60c004e84b6c2b14cf41e7.tar.xz manaserv-43e99491a76bb85faf60c004e84b6c2b14cf41e7.zip |
Standardize on the position of the const keyword
Same as for the client.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/logger.cpp | 16 | ||||
-rw-r--r-- | src/utils/logger.h | 7 | ||||
-rw-r--r-- | src/utils/tokencollector.cpp | 4 | ||||
-rw-r--r-- | src/utils/tokencollector.hpp | 8 | ||||
-rw-r--r-- | src/utils/xml.cpp | 8 | ||||
-rw-r--r-- | src/utils/xml.hpp | 10 |
6 files changed, 30 insertions, 23 deletions
diff --git a/src/utils/logger.cpp b/src/utils/logger.cpp index eab8c39..e3b48c3 100644 --- a/src/utils/logger.cpp +++ b/src/utils/logger.cpp @@ -65,7 +65,7 @@ static std::string getCurrentTime() return os.str(); } -void Logger::output(std::ostream &os, std::string const &msg, char const *prefix) +void Logger::output(std::ostream &os, const std::string &msg, const char *prefix) { if (mHasTimestamp) { @@ -80,7 +80,7 @@ void Logger::output(std::ostream &os, std::string const &msg, char const *prefix os << msg << std::endl; } -void Logger::setLogFile(std::string const &logFile) +void Logger::setLogFile(const std::string &logFile) { // Close the current log file. if (mLogFile.is_open()) @@ -103,10 +103,16 @@ void Logger::setLogFile(std::string const &logFile) } } -void Logger::output(std::string const& msg, Level atVerbosity) +void Logger::output(const std::string &msg, Level atVerbosity) { - static char const *prefixes[] = - { "[FTL]", "[ERR]", "[WRN]", "[INF]", "[DBG]" }; + static const char *prefixes[] = + { + "[FTL]", + "[ERR]", + "[WRN]", + "[INF]", + "[DBG]" + }; if (mVerbosity >= atVerbosity) { diff --git a/src/utils/logger.h b/src/utils/logger.h index 026696a..e23fdce 100644 --- a/src/utils/logger.h +++ b/src/utils/logger.h @@ -91,7 +91,7 @@ class Logger * * @exception std::ios::failure if the log file could not be opened. */ - static void setLogFile(std::string const &logFile); + static void setLogFile(const std::string &logFile); /** * Add/removes the timestamp. @@ -129,7 +129,7 @@ class Logger * * @exception std::ios::failure. */ - static void output(std::string const &msg, Level atVerbosity); + static void output(const std::string &msg, Level atVerbosity); static Level mVerbosity; /**< Verbosity level. */ private: @@ -145,7 +145,8 @@ class Logger * * @exception std::ios::failure. */ - static void output(std::ostream &os, std::string const &msg, char const *prefix); + static void output(std::ostream &os, const std::string &msg, + const char *prefix); }; diff --git a/src/utils/tokencollector.cpp b/src/utils/tokencollector.cpp index 0719b44..df21e63 100644 --- a/src/utils/tokencollector.cpp +++ b/src/utils/tokencollector.cpp @@ -27,7 +27,7 @@ failure, especially a timeout. So we search the lists forward when removing data, in order to start from the older ones. */ -void TokenCollectorBase::insertClient(std::string const &token, intptr_t data) +void TokenCollectorBase::insertClient(const std::string &token, intptr_t data) { for (std::list<Item>::reverse_iterator it = mPendingConnects.rbegin(), it_end = mPendingConnects.rend(); it != it_end; ++it) @@ -51,7 +51,7 @@ void TokenCollectorBase::insertClient(std::string const &token, intptr_t data) removeOutdated(current); } -void TokenCollectorBase::insertConnect(std::string const &token, intptr_t data) +void TokenCollectorBase::insertConnect(const std::string &token, intptr_t data) { for (std::list<Item>::reverse_iterator it = mPendingClients.rbegin(), it_end = mPendingClients.rend(); it != it_end; ++it) diff --git a/src/utils/tokencollector.hpp b/src/utils/tokencollector.hpp index c240388..332bd1a 100644 --- a/src/utils/tokencollector.hpp +++ b/src/utils/tokencollector.hpp @@ -61,9 +61,9 @@ class TokenCollectorBase virtual void foundMatch(intptr_t client, intptr_t connect) = 0; TokenCollectorBase(); virtual ~TokenCollectorBase(); - void insertClient(std::string const &, intptr_t); + void insertClient(const std::string &, intptr_t); void removeClient(intptr_t); - void insertConnect(std::string const &, intptr_t); + void insertConnect(const std::string &, intptr_t); void removeOutdated(time_t); }; @@ -104,14 +104,14 @@ class TokenCollector: private TokenCollectorBase * Checks if the server expected this client token. If so, calls * Handler::tokenMatched. Otherwise marks the client as pending. */ - void addPendingClient(std::string const &token, Client data) + void addPendingClient(const std::string &token, Client data) { insertClient(token, (intptr_t)data); } /** * Checks if a client already registered this token. If so, calls * Handler::tokenMatched. Otherwise marks the data as pending. */ - void addPendingConnect(std::string const &token, ServerData data) + void addPendingConnect(const std::string &token, ServerData data) { insertConnect(token, (intptr_t)data); } /** diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 9527658..5538027 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -26,7 +26,7 @@ namespace XML { -int getProperty(xmlNodePtr node, char const *name, int def) +int getProperty(xmlNodePtr node, const char *name, int def) { if (xmlChar *prop = xmlGetProp(node, BAD_CAST name)) { @@ -37,8 +37,7 @@ int getProperty(xmlNodePtr node, char const *name, int def) return def; } -double -getFloatProperty(xmlNodePtr node, const char* name, double def) +double getFloatProperty(xmlNodePtr node, const char* name, double def) { double &ret = def; @@ -51,7 +50,8 @@ getFloatProperty(xmlNodePtr node, const char* name, double def) return ret; } -std::string getProperty(xmlNodePtr node, char const *name, std::string const &def) +std::string getProperty(xmlNodePtr node, const char *name, + const std::string &def) { if (xmlChar *prop = xmlGetProp(node, BAD_CAST name)) { diff --git a/src/utils/xml.hpp b/src/utils/xml.hpp index 652d1e8..44d0e7c 100644 --- a/src/utils/xml.hpp +++ b/src/utils/xml.hpp @@ -26,25 +26,25 @@ #include <libxml/tree.h> #include "defines.h" -#include "../game-server/item.hpp" +#include "game-server/item.hpp" namespace XML { /** * Gets an integer property from an xmlNodePtr. */ - int getProperty(xmlNodePtr node, char const *name, int def); + int getProperty(xmlNodePtr node, const char *name, int def); /** * Gets a string property from an xmlNodePtr. */ - std::string getProperty(xmlNodePtr node, char const *name, std::string const &def); + std::string getProperty(xmlNodePtr node, const char *name, + const std::string &def); /** * Gets an floating point property from an xmlNodePtr. */ - double - getFloatProperty(xmlNodePtr node, const char *name, double def); + double getFloatProperty(xmlNodePtr node, const char *name, double def); } #define for_each_xml_child_node(var, parent) \ |