summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/account-server/dalstorage.cpp61
-rw-r--r--src/account-server/dalstorage.hpp73
-rw-r--r--src/chat-server/post.cpp21
-rw-r--r--src/chat-server/post.hpp12
-rw-r--r--src/dal/dalexcept.h47
-rw-r--r--src/dal/dataprovider.cpp12
-rw-r--r--src/dal/dataprovider.h37
-rw-r--r--src/dal/dataproviderfactory.cpp9
-rw-r--r--src/dal/dataproviderfactory.h14
-rw-r--r--src/dal/mysqldataprovider.cpp34
-rw-r--r--src/dal/mysqldataprovider.h32
-rw-r--r--src/dal/pqdataprovider.cpp23
-rw-r--r--src/dal/pqdataprovider.h30
-rw-r--r--src/dal/recordset.cpp44
-rw-r--r--src/dal/recordset.h41
-rw-r--r--src/dal/sqlitedataprovider.cpp47
-rw-r--r--src/dal/sqlitedataprovider.h35
-rw-r--r--src/game-server/accountconnection.cpp4
-rw-r--r--src/game-server/accountconnection.hpp2
-rw-r--r--src/game-server/itemmanager.cpp2
-rw-r--r--src/game-server/itemmanager.hpp2
-rw-r--r--src/game-server/trade.hpp8
-rw-r--r--src/utils/logger.h2
-rw-r--r--src/utils/singleton.h28
24 files changed, 214 insertions, 406 deletions
diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp
index 5ae557ab..4d20f618 100644
--- a/src/account-server/dalstorage.cpp
+++ b/src/account-server/dalstorage.cpp
@@ -94,7 +94,7 @@ void DALStorage::open()
}
// synchronize base data from xml files
- SyncDatabase();
+ syncDatabase();
// clean list of online users, this should be empty after restart
std::ostringstream sql;
@@ -739,8 +739,7 @@ bool DALStorage::updateCharacter(Character *character,
* Save changes of a skill to the database permanently.
* @deprecated Use DALStorage::updateExperience instead!!!
*/
-void DALStorage::flushSkill(const Character* const character,
- const int skill_id )
+void DALStorage::flushSkill(const Character * character, int skill_id)
{
updateExperience(character->getDatabaseID(), skill_id,
character->getExperience(skill_id));
@@ -960,15 +959,16 @@ void DALStorage::updateLastLogin(const Account *account)
mDb->execSql(sql.str());
}
-void DALStorage::updateCharacterPoints(const int CharId, const int CharPoints,
- const int CorrPoints, const int AttribId, const int AttribValue )
+void DALStorage::updateCharacterPoints(int charId,
+ int charPoints, int corrPoints,
+ int attribId, int attribValue)
{
std::ostringstream sql;
sql << "UPDATE " << CHARACTERS_TBL_NAME
- << " SET char_pts = " << CharPoints << ", "
- << " correct_pts = " << CorrPoints << ", ";
+ << " SET char_pts = " << charPoints << ", "
+ << " correct_pts = " << corrPoints << ", ";
- switch (AttribId)
+ switch (attribId)
{
case CHAR_ATTR_STRENGTH: sql << "str = "; break;
case CHAR_ATTR_AGILITY: sql << "agi = "; break;
@@ -977,25 +977,24 @@ void DALStorage::updateCharacterPoints(const int CharId, const int CharPoints,
case CHAR_ATTR_INTELLIGENCE: sql << "int = "; break;
case CHAR_ATTR_WILLPOWER: sql << "will = "; break;
}
- sql << AttribValue
- << " WHERE id = " << CharId;
+ sql << attribValue
+ << " WHERE id = " << charId;
mDb->execSql(sql.str());
}
-void DALStorage::updateExperience(const int CharId, const int SkillId,
- const int SkillValue)
+void DALStorage::updateExperience(int charId, int skillId, int skillValue)
{
try
{
// if experience has decreased to 0 we don't store it anymore,
// its the default
- if (SkillValue == 0)
+ if (skillValue == 0)
{
std::ostringstream sql;
sql << "DELETE FROM " << CHAR_SKILLS_TBL_NAME
- << " WHERE char_id = " << CharId
- << " AND skill_id = " << SkillId;
+ << " WHERE char_id = " << charId
+ << " AND skill_id = " << skillId;
mDb->execSql(sql.str());
return;
}
@@ -1003,9 +1002,9 @@ void DALStorage::updateExperience(const int CharId, const int SkillId,
// try to update the skill
std::ostringstream sql;
sql << "UPDATE " << CHAR_SKILLS_TBL_NAME
- << " SET skill_exp = " << SkillValue
- << " WHERE char_id = " << CharId
- << " AND skill_id = " << SkillId;
+ << " SET skill_exp = " << skillValue
+ << " WHERE char_id = " << charId
+ << " AND skill_id = " << skillId;
mDb->execSql(sql.str());
// check if the update has modified a row
@@ -1018,9 +1017,9 @@ void DALStorage::updateExperience(const int CharId, const int SkillId,
sql.str("");
sql << "INSERT INTO " << CHAR_SKILLS_TBL_NAME << " "
<< "(char_id, skill_id, skill_exp) VALUES ( "
- << CharId << ", "
- << SkillId << ", "
- << SkillValue << ")";
+ << charId << ", "
+ << skillId << ", "
+ << skillValue << ")";
mDb->execSql(sql.str());
}
catch (const dal::DbSqlQueryExecFailure &e)
@@ -1030,7 +1029,7 @@ void DALStorage::updateExperience(const int CharId, const int SkillId,
}
}
-void DALStorage::insertStatusEffect(const int charId, const int statusId, const int time)
+void DALStorage::insertStatusEffect(int charId, int statusId, int time)
{
try
{
@@ -1054,7 +1053,7 @@ void DALStorage::insertStatusEffect(const int charId, const int statusId, const
/**
* Add a guild
*/
-void DALStorage::addGuild(Guild* guild)
+void DALStorage::addGuild(Guild *guild)
{
std::ostringstream insertSql;
insertSql << "insert into " << GUILDS_TBL_NAME
@@ -1085,7 +1084,7 @@ void DALStorage::addGuild(Guild* guild)
/**
* Remove guild
*/
-void DALStorage::removeGuild(Guild* guild)
+void DALStorage::removeGuild(Guild *guild)
{
std::ostringstream sql;
sql << "delete from " << GUILDS_TBL_NAME
@@ -1094,9 +1093,6 @@ void DALStorage::removeGuild(Guild* guild)
mDb->execSql(sql.str());
}
-/**
- * add a member to a guild
- */
void DALStorage::addGuildMember(int guildId, int memberId)
{
std::ostringstream sql;
@@ -1117,9 +1113,6 @@ void DALStorage::addGuildMember(int guildId, int memberId)
}
}
-/**
-* remove a member from a guild
- */
void DALStorage::removeGuildMember(int guildId, int memberId)
{
std::ostringstream sql;
@@ -1586,9 +1579,9 @@ void DALStorage::storeLetter(Letter *letter)
}
}
-Post* DALStorage::getStoredPost(int playerId)
+Post *DALStorage::getStoredPost(int playerId)
{
- Post* p = new Post();
+ Post *p = new Post();
// specialize the string_to functor to convert
// a string to an unsigned int.
string_to< unsigned > toUint;
@@ -1626,7 +1619,7 @@ Post* DALStorage::getStoredPost(int playerId)
return p;
}
-void DALStorage::deletePost(Letter* letter)
+void DALStorage::deletePost(Letter *letter)
{
mDb->beginTransaction();
@@ -1657,7 +1650,7 @@ void DALStorage::deletePost(Letter* letter)
}
}
-void DALStorage::SyncDatabase(void)
+void DALStorage::syncDatabase()
{
xmlDocPtr doc = xmlReadFile(DEFAULT_ITEM_FILE, NULL, 0);
if (!doc)
diff --git a/src/account-server/dalstorage.hpp b/src/account-server/dalstorage.hpp
index 36bb1e39..3054edc4 100644
--- a/src/account-server/dalstorage.hpp
+++ b/src/account-server/dalstorage.hpp
@@ -47,25 +47,21 @@ class DALStorage
*/
DALStorage();
-
/**
* Destructor.
*/
~DALStorage();
-
/**
* Connect to the database and initialize it if necessary.
*/
void open();
-
/**
* Disconnect from the database.
*/
void close();
-
/**
* Get an account by user name.
*
@@ -108,8 +104,7 @@ class DALStorage
*
* @param account the new account.
*/
- void
- addAccount(Account *account);
+ void addAccount(Account *account);
/**
* Delete an account.
@@ -134,8 +129,9 @@ class DALStorage
* @param AttribId ID of the modified attribute
* @param AttribValue New value of the modified attribute
*/
- void updateCharacterPoints(const int CharId, const int CharPoints,
- const int CorrPoints, const int AttribId, const int AttribValue );
+ void updateCharacterPoints(int charId,
+ int charPoints, int corrPoints,
+ int attribId, int attribValue);
/**
* Write a modification message about character skills to the database.
@@ -143,8 +139,7 @@ class DALStorage
* @param SkillId ID of the skill
* @param SkillValue new skill points
*/
- void updateExperience(const int CharId, const int SkillId,
- const int SkillValue);
+ void updateExperience(int charId, int skillId, int skillValue);
/**
* Inserts a record about a status effect into the database
@@ -152,7 +147,7 @@ class DALStorage
* @param statusId ID of the status effect
* @param time Time left on the status effect
*/
- void insertStatusEffect(const int charId, const int statusId, const int time);
+ void insertStatusEffect(int charId, int statusId, int time);
/**
* Sets a ban on an account (hence on all its characters).
@@ -215,9 +210,8 @@ class DALStorage
* nested transaction.
* @return true on success
*/
- bool
- updateCharacter(Character *ptr,
- bool startTransaction = true);
+ bool updateCharacter(Character *ptr,
+ bool startTransaction = true);
/**
* Save changes of a skill to the database permanently.
@@ -227,49 +221,38 @@ class DALStorage
*
* @exception dbl::DbSqlQueryExecFailure.
*/
- void
- flushSkill(const Character* const character, const int skill_id );
+ void flushSkill(const Character *character, int skill_id);
/**
- * Add a new guild
- *
+ * Add a new guild.
*/
- void
- addGuild(Guild* guild);
+ void addGuild(Guild *guild);
/**
- * Delete a guild
- *
+ * Delete a guild.
*/
- void
- removeGuild(Guild* guild);
+ void removeGuild(Guild *guild);
/**
- * Add member to guild
- *
+ * Add member to guild.
*/
- void
- addGuildMember(int guild_id, int memberId);
+ void addGuildMember(int guild_id, int memberId);
/**
- * Remove member from guild
+ * Remove member from guild.
*/
- void
- removeGuildMember(int guildId, int memberId);
+ void removeGuildMember(int guildId, int memberId);
/**
- * Save guild member rights
+ * Save guild member rights.
*/
- void
- setMemberRights(int guildId, int memberId, int rights);
+ void setMemberRights(int guildId, int memberId, int rights);
/**
- * Get guild list
- *@return a list of guilds
- *
+ * Get guild list.
+ * @return a list of guilds
*/
- std::list<Guild*>
- getGuildList();
+ std::list<Guild*> getGuildList();
/**
* Save changes to the database permanently.
@@ -343,7 +326,7 @@ class DALStorage
*
* @param playerId The id of the character requesting his post
*/
- Post* getStoredPost(int playerId);
+ Post *getStoredPost(int playerId);
/**
* Delete a letter from the database.
@@ -365,7 +348,7 @@ class DALStorage
*
* @return Version of the item database.
*/
- unsigned int getItemDatabaseVersion(void) const
+ unsigned int getItemDatabaseVersion() const
{ return mItemDbVersion; }
/**
@@ -393,14 +376,13 @@ class DALStorage
/**
* Copy constructor.
*/
- DALStorage(const DALStorage& rhs);
+ DALStorage(const DALStorage &rhs);
/**
* Assignment operator.
*/
- DALStorage&
- operator=(const DALStorage& rhs);
+ DALStorage &operator=(const DALStorage &rhs);
/**
* Gets an account from a prepared SQL statement
@@ -409,7 +391,6 @@ class DALStorage
*/
Account *getAccountBySQL();
-
/**
* Gets a character from a prepared SQL statement
*
@@ -427,7 +408,7 @@ class DALStorage
* reload of the xml files to load new items or monsters without server
* restart.
*/
- void SyncDatabase(void);
+ void syncDatabase();
dal::DataProvider *mDb; /**< the data provider */
unsigned int mItemDbVersion; /**< Version of the item database. */
diff --git a/src/chat-server/post.cpp b/src/chat-server/post.cpp
index ba829c02..5460c916 100644
--- a/src/chat-server/post.cpp
+++ b/src/chat-server/post.cpp
@@ -37,7 +37,6 @@ Letter::~Letter()
if (mReceiver)
delete mReceiver;
-
}
void Letter::setExpiry(unsigned long expiry)
@@ -55,7 +54,7 @@ void Letter::addText(const std::string &text)
mContents = text;
}
-std::string Letter::getContents()
+std::string Letter::getContents() const
{
return mContents;
}
@@ -73,17 +72,17 @@ bool Letter::addAttachment(InventoryItem item)
return true;
}
-Character* Letter::getReceiver()
+Character *Letter::getReceiver() const
{
return mReceiver;
}
-Character* Letter::getSender()
+Character *Letter::getSender() const
{
return mSender;
}
-std::vector<InventoryItem> Letter::getAttachments()
+std::vector<InventoryItem> Letter::getAttachments() const
{
return mAttachments;
}
@@ -146,16 +145,10 @@ void PostManager::addLetter(Letter *letter)
}
}
-Post* PostManager::getPost(Character *player)
+Post *PostManager::getPost(Character *player) const
{
- std::map<Character*, Post*>::iterator itr =
- mPostBox.find(player);
- if (itr == mPostBox.end())
- {
- return NULL;
- }
-
- return itr->second;
+ std::map<Character*, Post*>::const_iterator itr = mPostBox.find(player);
+ return (itr == mPostBox.end()) ? NULL : itr->second;
}
void PostManager::clearPost(Character *player)
diff --git a/src/chat-server/post.hpp b/src/chat-server/post.hpp
index 26c60918..2934db4d 100644
--- a/src/chat-server/post.hpp
+++ b/src/chat-server/post.hpp
@@ -66,7 +66,7 @@ public:
/**
* Gets the type of the letter. (unused)
*/
- unsigned int getType(void) const
+ unsigned int getType() const
{ return mType; }
/**
@@ -90,7 +90,7 @@ public:
* Get the text contents of letter
* @return String containing the text
*/
- std::string getContents();
+ std::string getContents() const;
/**
* Add an attachment
@@ -103,18 +103,18 @@ public:
* Get the character receiving the letter
* @return Returns the Character who will receive the letter
*/
- Character* getReceiver();
+ Character *getReceiver() const;
/**
* Get the character who sent the letter
* @return Returns the Character who sent the letter
*/
- Character* getSender();
+ Character *getSender() const;
/**
* Get the attachments
*/
- std::vector<InventoryItem> getAttachments();
+ std::vector<InventoryItem> getAttachments() const;
private:
unsigned int mId;
@@ -170,7 +170,7 @@ public:
* @param player Character that is getting post
* @return Returns the post for that character
*/
- Post* getPost(Character *player);
+ Post *getPost(Character *player) const;
/**
* Remove the post for character
diff --git a/src/dal/dalexcept.h b/src/dal/dalexcept.h
index 75022ec5..fe0423f9 100644
--- a/src/dal/dalexcept.h
+++ b/src/dal/dalexcept.h
@@ -42,28 +42,21 @@ class DbException: public std::exception
DbException(const std::string& msg)
throw()
: mMsg(msg)
- {
- // NOOP
- }
-
+ {}
/**
* Destructor.
*/
- ~DbException(void)
+ ~DbException()
throw()
- {
- // NOOP
- }
-
+ {}
/**
* Get the error message.
*
* @return the error message.
*/
- virtual const char*
- what(void) const
+ virtual const char *what() const
throw()
{
return mMsg.c_str();
@@ -84,12 +77,10 @@ class DbConnectionFailure: public DbException
/**
* Default constructor.
*/
- DbConnectionFailure(void)
+ DbConnectionFailure()
throw()
: DbException("")
- {
- // NOOP
- }
+ {}
/**
@@ -100,9 +91,7 @@ class DbConnectionFailure: public DbException
DbConnectionFailure(const std::string& msg)
throw()
: DbException(msg)
- {
- // NOOP
- }
+ {}
};
@@ -115,13 +104,10 @@ class DbDisconnectionFailure: public DbException
/**
* Default constructor.
*/
- DbDisconnectionFailure(void)
+ DbDisconnectionFailure()
throw()
: DbException("")
- {
- // NOOP
- }
-
+ {}
/**
* Constructor.
@@ -131,9 +117,7 @@ class DbDisconnectionFailure: public DbException
DbDisconnectionFailure(const std::string& msg)
throw()
: DbException(msg)
- {
- // NOOP
- }
+ {}
};
@@ -146,13 +130,10 @@ class DbSqlQueryExecFailure: public DbException
/**
* Default constructor.
*/
- DbSqlQueryExecFailure(void)
+ DbSqlQueryExecFailure()
throw()
: DbException("")
- {
- // NOOP
- }
-
+ {}
/**
* Constructor.
@@ -162,9 +143,7 @@ class DbSqlQueryExecFailure: public DbException
DbSqlQueryExecFailure(const std::string& msg)
throw()
: DbException(msg)
- {
- // NOOP
- }
+ {}
};
diff --git a/src/dal/dataprovider.cpp b/src/dal/dataprovider.cpp
index 8fd8fe0f..1b819ed9 100644
--- a/src/dal/dataprovider.cpp
+++ b/src/dal/dataprovider.cpp
@@ -28,30 +28,27 @@ namespace dal
/**
* Constructor.
*/
-DataProvider::DataProvider(void)
+DataProvider::DataProvider()
throw()
: mIsConnected(false),
mRecordSet()
{
- // NOOP
}
/**
* Destructor.
*/
-DataProvider::~DataProvider(void)
+DataProvider::~DataProvider()
throw()
{
- // NOOP
}
/**
* Get the connection status.
*/
-bool
-DataProvider::isConnected(void) const
+bool DataProvider::isConnected() const
throw()
{
return mIsConnected;
@@ -60,8 +57,7 @@ DataProvider::isConnected(void) const
/**
* Get the DataBase Name
*/
-std::string
-DataProvider::getDbName(void)
+std::string DataProvider::getDbName() const
{
if (!isConnected())
{
diff --git a/src/dal/dataprovider.h b/src/dal/dataprovider.h
index 90169ee8..1a111761 100644
--- a/src/dal/dataprovider.h
+++ b/src/dal/dataprovider.h
@@ -59,38 +59,32 @@ class DataProvider
/**
* Constructor.
*/
- DataProvider(void)
+ DataProvider()
throw();
-
/**
* Destructor.
*/
virtual
- ~DataProvider(void)
+ ~DataProvider()
throw();
-
/**
* Get the connection status.
*
* @return true if connected.
*/
- bool
- isConnected(void) const
+ bool isConnected() const
throw();
-
/**
* Get the name of the database backend.
*
* @return the database backend name.
*/
- virtual DbBackends
- getDbBackend(void) const
+ virtual DbBackends getDbBackend() const
throw() = 0;
-
/**
* Create a connection to the database.
*
@@ -99,7 +93,7 @@ class DataProvider
*
* @exception DbConnectionFailure if unsuccessful connection.
*/
- virtual void connect(void) = 0;
+ virtual void connect() = 0;
/**
@@ -123,22 +117,19 @@ class DataProvider
*
* @exception DbDisconnectionFailure if unsuccessful disconnection.
*/
- virtual void
- disconnect(void) = 0;
+ virtual void disconnect() = 0;
/**
* Get the Database Name.
*/
- std::string
- getDbName(void);
+ std::string getDbName() const;
/**
* Starts a transaction.
*
* @exception std::runtime_error if a transaction is still open
*/
- virtual void
- beginTransaction(void)
+ virtual void beginTransaction()
throw (std::runtime_error) = 0;
/**
@@ -146,8 +137,7 @@ class DataProvider
*
* @exception std::runtime_error if no connection is currently open.
*/
- virtual void
- commitTransaction(void)
+ virtual void commitTransaction()
throw (std::runtime_error) = 0;
/**
@@ -155,8 +145,7 @@ class DataProvider
*
* @exception std::runtime_error if no connection is currently open.
*/
- virtual void
- rollbackTransaction(void)
+ virtual void rollbackTransaction()
throw (std::runtime_error) = 0;
/**
@@ -165,8 +154,7 @@ class DataProvider
*
* @return Number of rows that have changed.
*/
- virtual const unsigned int
- getModifiedRows(void) const = 0;
+ virtual unsigned getModifiedRows() const = 0;
/**
* Returns the last inserted value of an autoincrement column after an
@@ -174,8 +162,7 @@ class DataProvider
*
* @return last autoincrement value.
*/
- virtual const unsigned int
- getLastId(void) const = 0;
+ virtual unsigned getLastId() const = 0;
/**
* Prepare SQL statement
diff --git a/src/dal/dataproviderfactory.cpp b/src/dal/dataproviderfactory.cpp
index fd0c858e..48d99522 100644
--- a/src/dal/dataproviderfactory.cpp
+++ b/src/dal/dataproviderfactory.cpp
@@ -41,28 +41,25 @@ namespace dal
/**
* Default constructor.
*/
-DataProviderFactory::DataProviderFactory(void)
+DataProviderFactory::DataProviderFactory()
throw()
{
- // NOOP
}
/**
* Destructor.
*/
-DataProviderFactory::~DataProviderFactory(void)
+DataProviderFactory::~DataProviderFactory()
throw()
{
- // NOOP
}
/**
* Create a data provider.
*/
-DataProvider*
-DataProviderFactory::createDataProvider(void)
+DataProvider *DataProviderFactory::createDataProvider()
{
#if defined (MYSQL_SUPPORT)
MySqlDataProvider* provider = new MySqlDataProvider;
diff --git a/src/dal/dataproviderfactory.h b/src/dal/dataproviderfactory.h
index aee96fc6..ed0f7e11 100644
--- a/src/dal/dataproviderfactory.h
+++ b/src/dal/dataproviderfactory.h
@@ -40,36 +40,32 @@ class DataProviderFactory
/**
* Create a new data provider.
*/
- static DataProvider*
- createDataProvider(void);
-
+ static DataProvider *createDataProvider();
private:
/**
* Default constructor.
*/
- DataProviderFactory(void)
+ DataProviderFactory()
throw();
-
/**
* Destructor.
*/
- ~DataProviderFactory(void)
+ ~DataProviderFactory()
throw();
-
/**
* Copy constructor.
*/
- DataProviderFactory(const DataProviderFactory& rhs);
+ DataProviderFactory(const DataProviderFactory &rhs);
/**
* Assignment operator.
*/
DataProviderFactory&
- operator=(const DataProviderFactory& rhs);
+ operator=(const DataProviderFactory &rhs);
};
diff --git a/src/dal/mysqldataprovider.cpp b/src/dal/mysqldataprovider.cpp
index 13a30023..1024047c 100644
--- a/src/dal/mysqldataprovider.cpp
+++ b/src/dal/mysqldataprovider.cpp
@@ -25,7 +25,6 @@
namespace dal
{
-
const std::string MySqlDataProvider::CFGPARAM_MYSQL_HOST ="mysql_hostname";
const std::string MySqlDataProvider::CFGPARAM_MYSQL_PORT ="mysql_port";
const std::string MySqlDataProvider::CFGPARAM_MYSQL_DB ="mysql_database";
@@ -41,18 +40,17 @@ const std::string MySqlDataProvider::CFGPARAM_MYSQL_PWD_DEF = "mana";
/**
* Constructor.
*/
-MySqlDataProvider::MySqlDataProvider(void)
+MySqlDataProvider::MySqlDataProvider()
throw()
: mDb(0)
{
- // NOOP
}
/**
* Destructor.
*/
-MySqlDataProvider::~MySqlDataProvider(void)
+MySqlDataProvider::~MySqlDataProvider()
throw()
{
// we are using the MySQL C API, there are no exceptions to catch.
@@ -69,8 +67,7 @@ MySqlDataProvider::~MySqlDataProvider(void)
/**
* Get the database backend name.
*/
-DbBackends
-MySqlDataProvider::getDbBackend(void) const
+DbBackends MySqlDataProvider::getDbBackend() const
throw()
{
return DB_BKEND_MYSQL;
@@ -80,8 +77,7 @@ MySqlDataProvider::getDbBackend(void) const
/**
* Create a connection to the database.
*/
-void
-MySqlDataProvider::connect()
+void MySqlDataProvider::connect()
{
if (mIsConnected) {
return;
@@ -201,8 +197,7 @@ MySqlDataProvider::execSql(const std::string& sql,
/**
* Close the connection to the database.
*/
-void
-MySqlDataProvider::disconnect(void)
+void MySqlDataProvider::disconnect()
{
if (!mIsConnected) {
return;
@@ -219,8 +214,7 @@ MySqlDataProvider::disconnect(void)
mIsConnected = false;
}
-void
-MySqlDataProvider::beginTransaction(void)
+void MySqlDataProvider::beginTransaction()
throw (std::runtime_error)
{
if (!mIsConnected)
@@ -236,8 +230,7 @@ MySqlDataProvider::beginTransaction(void)
LOG_DEBUG("SQL: started transaction");
}
-void
-MySqlDataProvider::commitTransaction(void)
+void MySqlDataProvider::commitTransaction()
throw (std::runtime_error)
{
if (!mIsConnected)
@@ -257,8 +250,7 @@ MySqlDataProvider::commitTransaction(void)
LOG_DEBUG("SQL: commited transaction");
}
-void
-MySqlDataProvider::rollbackTransaction(void)
+void MySqlDataProvider::rollbackTransaction()
throw (std::runtime_error)
{
if (!mIsConnected)
@@ -278,8 +270,7 @@ MySqlDataProvider::rollbackTransaction(void)
LOG_DEBUG("SQL: transaction rolled back");
}
-const unsigned int
-MySqlDataProvider::getModifiedRows(void) const
+unsigned MySqlDataProvider::getModifiedRows() const
{
if (!mIsConnected)
{
@@ -301,11 +292,10 @@ MySqlDataProvider::getModifiedRows(void) const
throw DbSqlQueryExecFailure(mysql_error(mDb));
}
- return (unsigned int)affected;
+ return (unsigned) affected;
}
-const unsigned int
-MySqlDataProvider::getLastId(void) const
+unsigned MySqlDataProvider::getLastId() const
{
if (!mIsConnected)
{
@@ -319,7 +309,7 @@ MySqlDataProvider::getLastId(void) const
if (lastId > UINT_MAX)
throw std::runtime_error("MySqlDataProvider::getLastId exceeded INT_MAX");
- return (unsigned int)lastId;
+ return (unsigned) lastId;
}
diff --git a/src/dal/mysqldataprovider.h b/src/dal/mysqldataprovider.h
index ef0f4cfc..c3ad1cec 100644
--- a/src/dal/mysqldataprovider.h
+++ b/src/dal/mysqldataprovider.h
@@ -37,14 +37,12 @@
namespace dal
{
-
/**
* A MySQL Data Provider.
*/
class MySqlDataProvider: public DataProvider
{
public:
-
/**
* Replacement for mysql my_bool datatype used in mysql_autocommit()
* function.
@@ -57,24 +55,21 @@ class MySqlDataProvider: public DataProvider
/**
* Constructor.
*/
- MySqlDataProvider(void)
+ MySqlDataProvider()
throw();
-
/**
* Destructor.
*/
- ~MySqlDataProvider(void)
+ ~MySqlDataProvider()
throw();
-
/**
* Get the name of the database backend.
*
* @return the database backend name.
*/
- DbBackends
- getDbBackend(void) const
+ DbBackends getDbBackend() const
throw();
@@ -107,16 +102,14 @@ class MySqlDataProvider: public DataProvider
*
* @exception DbDisconnectionFailure if unsuccessful disconnection.
*/
- void
- disconnect(void);
+ void disconnect();
/**
* Starts a transaction.
*
* @exception std::runtime_error if a transaction is still open
*/
- void
- beginTransaction(void)
+ void beginTransaction()
throw (std::runtime_error);
/**
@@ -124,8 +117,7 @@ class MySqlDataProvider: public DataProvider
*
* @exception std::runtime_error if no connection is currently open.
*/
- void
- commitTransaction(void)
+ void commitTransaction()
throw (std::runtime_error);
/**
@@ -133,8 +125,7 @@ class MySqlDataProvider: public DataProvider
*
* @exception std::runtime_error if no connection is currently open.
*/
- void
- rollbackTransaction(void)
+ void rollbackTransaction()
throw (std::runtime_error);
/**
@@ -143,8 +134,7 @@ class MySqlDataProvider: public DataProvider
*
* @return Number of rows that have changed.
*/
- const unsigned int
- getModifiedRows(void) const;
+ unsigned getModifiedRows() const;
/**
* Returns the last inserted value of an autoincrement column after an
@@ -152,11 +142,9 @@ class MySqlDataProvider: public DataProvider
*
* @return last autoincrement value.
*/
- const unsigned int
- getLastId(void) const;
+ unsigned getLastId() const;
private:
-
/** defines the name of the hostname config parameter */
static const std::string CFGPARAM_MYSQL_HOST;
/** defines the name of the server port config parameter */
@@ -180,7 +168,7 @@ class MySqlDataProvider: public DataProvider
static const std::string CFGPARAM_MYSQL_PWD_DEF;
- MYSQL* mDb; /**< the handle to the database connection */
+ MYSQL *mDb; /**< the handle to the database connection */
};
diff --git a/src/dal/pqdataprovider.cpp b/src/dal/pqdataprovider.cpp
index 67e12e80..3c40cf17 100644
--- a/src/dal/pqdataprovider.cpp
+++ b/src/dal/pqdataprovider.cpp
@@ -28,18 +28,17 @@ namespace dal
/**
* Constructor
*/
-PqDataProvider::PqDataProvider(void)
+PqDataProvider::PqDataProvider()
throw()
: mDb(0)
{
- // NOOP
}
/**
* Destructor
*/
-PqDataProvider::~PqDataProvider(void)
+PqDataProvider::~PqDataProvider()
throw()
{
if (mIsConnected) {
@@ -51,8 +50,7 @@ PqDataProvider::~PqDataProvider(void)
/**
* Get the database backend name.
*/
-DbBackends
-PqDataProvider::getDbBackend(void) const
+DbBackends PqDataProvider::getDbBackend() const
throw()
{
return DB_BKEND_POSTGRESQL;
@@ -62,10 +60,9 @@ PqDataProvider::getDbBackend(void) const
/**
* Create a connection to the database.
*/
-void
-PqDataProvider::connect(const std::string& dbName,
- const std::string& userName,
- const std::string& password)
+void PqDataProvider::connect(const std::string& dbName,
+ const std::string& userName,
+ const std::string& password)
{
// Create string to pass to PQconnectdb
std::string connStr = "dbname = " + dbName + " "; // database name
@@ -94,9 +91,8 @@ PqDataProvider::connect(const std::string& dbName,
/**
* Execute a SQL query.
*/
-const RecordSet&
-PqDataProvider::execSql(const std::string& sql,
- const bool refresh)
+const RecordSet &PqDataProvider::execSql(const std::string& sql,
+ const bool refresh)
{
if (!mIsConnected) {
throw std::runtime_error("not connected to database");
@@ -145,8 +141,7 @@ PqDataProvider::execSql(const std::string& sql,
/**
* Close connection to database.
*/
-void
-PqDataProvider::disconnect(void)
+void PqDataProvider::disconnect()
{
if (!mIsConnected) {
return;
diff --git a/src/dal/pqdataprovider.h b/src/dal/pqdataprovider.h
index f4f8e882..9cbc3cb2 100644
--- a/src/dal/pqdataprovider.h
+++ b/src/dal/pqdataprovider.h
@@ -21,7 +21,6 @@
#ifndef _TMWSERV_PQDATAPROVIDER_H_
#define _TMWSERV_PQDATAPROVIDER_H_
-
#include <iosfwd>
#include <libpq-fe.h>
@@ -30,7 +29,6 @@
namespace dal
{
-
/**
* A PostgreSQL Data Provider.
*/
@@ -40,27 +38,23 @@ class PqDataProvider: public DataProvider
/**
* Constructor
*/
- PqDataProvider(void)
+ PqDataProvider()
throw();
-
/**
* Destructor
*/
- ~PqDataProvider(void)
+ ~PqDataProvider()
throw();
-
/**
* Get name of the database backend
*
* @return the database backend name
*/
- DbBackends
- getDbBackend(void) const
+ DbBackends getDbBackend() const
throw();
-
/**
* Create a connection to the database.
*
@@ -70,11 +64,9 @@ class PqDataProvider: public DataProvider
*
* @exception DbConnectionFailure if unsuccessful connection.
*/
- void
- connect(const std::string& dbName,
- const std::string& userName,
- const std::string& password);
-
+ void connect(const std::string& dbName,
+ const std::string& userName,
+ const std::string& password);
/**
* Execute a SQL query.
@@ -87,19 +79,15 @@ class PqDataProvider: public DataProvider
* @exception DbSqlQueryExecFailure if unsuccessful execution.
* @exception std::runtime_error if trying to query a closed database.
*/
- const RecordSet&
- execSql(const std::string& sql,
- const bool refresh = false);
-
+ const RecordSet &execSql(const std::string& sql,
+ const bool refresh = false);
/**
* Close the connection to the database.
*
* @exception DbDisconnectionFailure if unsuccessful disconnection.
*/
- void
- disconnect(void);
-
+ void disconnect();
private:
PGconn *mDb; /**< Database connection handle */
diff --git a/src/dal/recordset.cpp b/src/dal/recordset.cpp
index 28a58160..516aa5a8 100644
--- a/src/dal/recordset.cpp
+++ b/src/dal/recordset.cpp
@@ -29,45 +29,37 @@
namespace dal
{
-
/**
* Default constructor.
*/
-RecordSet::RecordSet(void)
+RecordSet::RecordSet()
throw()
{
- // NOOP
}
-
/**
* Destructor.
*/
-RecordSet::~RecordSet(void)
+RecordSet::~RecordSet()
throw()
{
- // NOOP
}
-
/**
* Remove all the Records.
*/
-void
-RecordSet::clear(void)
+void RecordSet::clear()
{
mHeaders.clear();
mRows.clear();
}
-
/**
* Check if the RecordSet is empty.
*/
-bool
-RecordSet::isEmpty(void) const
+bool RecordSet::isEmpty() const
{
- return (mRows.size() == 0);
+ return mRows.size() == 0;
}
@@ -76,20 +68,17 @@ RecordSet::isEmpty(void) const
*
* @return the number of rows.
*/
-unsigned int
-RecordSet::rows(void) const
+unsigned int RecordSet::rows() const
{
return mRows.size();
}
-
/**
* Get the number of columns.
*
* @return the number of columns.
*/
-unsigned int
-RecordSet::cols(void) const
+unsigned int RecordSet::cols() const
{
return mHeaders.size();
}
@@ -98,8 +87,7 @@ RecordSet::cols(void) const
/**
* Set the column headers.
*/
-void
-RecordSet::setColumnHeaders(const Row& headers)
+void RecordSet::setColumnHeaders(const Row &headers)
{
if (mHeaders.size() > 0) {
throw AlreadySetException();
@@ -112,8 +100,7 @@ RecordSet::setColumnHeaders(const Row& headers)
/**
* Add a new row.
*/
-void
-RecordSet::add(const Row& row)
+void RecordSet::add(const Row &row)
{
const unsigned int nCols = mHeaders.size();
@@ -136,9 +123,8 @@ RecordSet::add(const Row& row)
/**
* Operator()
*/
-const std::string&
-RecordSet::operator()(const unsigned int row,
- const unsigned int col) const
+const std::string &RecordSet::operator()(const unsigned int row,
+ const unsigned int col) const
{
if ((row >= mRows.size()) || (col >= mHeaders.size())) {
std::ostringstream os;
@@ -156,9 +142,8 @@ RecordSet::operator()(const unsigned int row,
/**
* Operator()
*/
-const std::string&
-RecordSet::operator()(const unsigned int row,
- const std::string& name) const
+const std::string &RecordSet::operator()(const unsigned int row,
+ const std::string& name) const
{
if (row >= mRows.size()) {
std::ostringstream os;
@@ -194,8 +179,7 @@ RecordSet::operator()(const unsigned int row,
/**
* Operator<<
*/
-std::ostream&
-operator<<(std::ostream& out, const RecordSet& rhs)
+std::ostream &operator<<(std::ostream &out, const RecordSet &rhs)
{
// print the field names first.
if (rhs.mHeaders.size() > 0) {
diff --git a/src/dal/recordset.h b/src/dal/recordset.h
index e236b19e..124123d1 100644
--- a/src/dal/recordset.h
+++ b/src/dal/recordset.h
@@ -27,7 +27,6 @@
namespace dal
{
-
/**
* Data type for a row in a RecordSet.
*/
@@ -48,50 +47,40 @@ class RecordSet
/**
* Default constructor.
*/
- RecordSet(void)
+ RecordSet()
throw();
-
/**
* Destructor.
*/
- ~RecordSet(void)
+ ~RecordSet()
throw();
-
/**
* Remove all the records.
*/
- void
- clear(void);
-
+ void clear();
/**
* Check if the RecordSet is empty.
*
* @return true if empty.
*/
- bool
- isEmpty(void) const;
-
+ bool isEmpty() const;
/**
* Get the number of rows.
*
* @return the number of rows.
*/
- unsigned int
- rows(void) const;
-
+ unsigned int rows() const;
/**
* Get the number of columns.
*
* @return the number of columns.
*/
- unsigned int
- cols(void) const;
-
+ unsigned int cols() const;
/**
* Set the column headers.
@@ -101,9 +90,7 @@ class RecordSet
* @exception AlreadySetException if the column headers
* are already set.
*/
- void
- setColumnHeaders(const Row& headers);
-
+ void setColumnHeaders(const Row &headers);
/**
* Add a new row.
@@ -118,9 +105,7 @@ class RecordSet
* @exception std::invalid_argument if the number of columns in the
* new row is not equal to the number of column headers.
*/
- void
- add(const Row& row);
-
+ void add(const Row &row);
/**
* Operator()
@@ -156,7 +141,7 @@ class RecordSet
*/
const std::string&
operator()(const unsigned int row,
- const std::string& name) const;
+ const std::string &name) const;
/**
@@ -169,21 +154,19 @@ class RecordSet
* @return the output stream for chaining.
*/
friend std::ostream&
- operator<<(std::ostream& out, const RecordSet& rhs);
-
+ operator<<(std::ostream& out, const RecordSet &rhs);
private:
/**
* Copy constructor.
*/
- RecordSet(const RecordSet& rhs);
-
+ RecordSet(const RecordSet &rhs);
/**
* Assignment operator.
*/
RecordSet&
- operator=(const RecordSet& rhs);
+ operator=(const RecordSet &rhs);
private:
diff --git a/src/dal/sqlitedataprovider.cpp b/src/dal/sqlitedataprovider.cpp
index 292b6114..84562c75 100644
--- a/src/dal/sqlitedataprovider.cpp
+++ b/src/dal/sqlitedataprovider.cpp
@@ -37,18 +37,17 @@ const std::string SqLiteDataProvider::CFGPARAM_SQLITE_DB_DEF = "mana.db";
/**
* Constructor.
*/
-SqLiteDataProvider::SqLiteDataProvider(void)
+SqLiteDataProvider::SqLiteDataProvider()
throw()
: mDb(0)
{
- // NOOP
}
/**
* Destructor.
*/
-SqLiteDataProvider::~SqLiteDataProvider(void)
+SqLiteDataProvider::~SqLiteDataProvider()
throw()
{
try {
@@ -68,8 +67,7 @@ SqLiteDataProvider::~SqLiteDataProvider(void)
/**
* Get the name of the database backend.
*/
-DbBackends
-SqLiteDataProvider::getDbBackend(void) const
+DbBackends SqLiteDataProvider::getDbBackend() const
throw()
{
return DB_BKEND_SQLITE;
@@ -191,12 +189,10 @@ SqLiteDataProvider::execSql(const std::string& sql,
/**
* Close the connection to the database.
*/
-void
-SqLiteDataProvider::disconnect(void)
+void SqLiteDataProvider::disconnect()
{
- if (!isConnected()) {
+ if (!isConnected())
return;
- }
// sqlite3_close() closes the connection and deallocates the connection
// handle.
@@ -208,8 +204,7 @@ SqLiteDataProvider::disconnect(void)
mIsConnected = false;
}
-void
-SqLiteDataProvider::beginTransaction(void)
+void SqLiteDataProvider::beginTransaction()
throw (std::runtime_error)
{
if (!mIsConnected)
@@ -243,8 +238,7 @@ SqLiteDataProvider::beginTransaction(void)
}
}
-void
-SqLiteDataProvider::commitTransaction(void)
+void SqLiteDataProvider::commitTransaction()
throw (std::runtime_error)
{
if (!mIsConnected)
@@ -278,8 +272,7 @@ SqLiteDataProvider::commitTransaction(void)
}
}
-void
-SqLiteDataProvider::rollbackTransaction(void)
+void SqLiteDataProvider::rollbackTransaction()
throw (std::runtime_error)
{
if (!mIsConnected)
@@ -313,8 +306,7 @@ SqLiteDataProvider::rollbackTransaction(void)
}
}
-const unsigned int
-SqLiteDataProvider::getModifiedRows(void) const
+unsigned SqLiteDataProvider::getModifiedRows() const
{
if (!mIsConnected)
{
@@ -324,11 +316,10 @@ SqLiteDataProvider::getModifiedRows(void) const
throw std::runtime_error(error);
}
- return (unsigned int)sqlite3_changes(mDb);
+ return (unsigned) sqlite3_changes(mDb);
}
-const bool
-SqLiteDataProvider::inTransaction(void) const
+bool SqLiteDataProvider::inTransaction() const
{
if (!mIsConnected)
{
@@ -342,18 +333,10 @@ SqLiteDataProvider::inTransaction(void) const
// Autocommit mode is on by default. Autocommit mode is disabled by a BEGIN
// statement. Autocommit mode is re-enabled by a COMMIT or ROLLBACK.
const int ret = sqlite3_get_autocommit(mDb);
- if (ret == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
+ return ret == 0;
}
-const unsigned int
-SqLiteDataProvider::getLastId(void) const
+unsigned SqLiteDataProvider::getLastId() const
{
if (!mIsConnected)
{
@@ -367,7 +350,7 @@ SqLiteDataProvider::getLastId(void) const
if (lastId > UINT_MAX)
throw std::runtime_error("SqLiteDataProvider::getLastId exceeded INT_MAX");
- return (unsigned int)lastId;
+ return (unsigned) lastId;
}
bool SqLiteDataProvider::prepareSql(const std::string &sql)
@@ -387,7 +370,7 @@ bool SqLiteDataProvider::prepareSql(const std::string &sql)
return true;
}
-const RecordSet& SqLiteDataProvider::processSql()
+const RecordSet &SqLiteDataProvider::processSql()
{
if (!mIsConnected) {
throw std::runtime_error("not connected to database");
diff --git a/src/dal/sqlitedataprovider.h b/src/dal/sqlitedataprovider.h
index e446c9c0..e97fa7c6 100644
--- a/src/dal/sqlitedataprovider.h
+++ b/src/dal/sqlitedataprovider.h
@@ -48,24 +48,21 @@ class SqLiteDataProvider: public DataProvider
/**
* Constructor.
*/
- SqLiteDataProvider(void)
+ SqLiteDataProvider()
throw();
-
/**
* Destructor.
*/
- ~SqLiteDataProvider(void)
+ ~SqLiteDataProvider()
throw();
-
/**
* Get the name of the database backend.
*
* @return the database backend name.
*/
- DbBackends
- getDbBackend(void) const
+ DbBackends getDbBackend() const
throw();
@@ -88,9 +85,8 @@ class SqLiteDataProvider: public DataProvider
* @exception DbSqlQueryExecFailure if unsuccessful execution.
* @exception std::runtime_error if trying to query a closed database.
*/
- const RecordSet&
- execSql(const std::string& sql,
- const bool refresh = false);
+ const RecordSet &execSql(const std::string& sql,
+ const bool refresh = false);
/**
@@ -98,16 +94,14 @@ class SqLiteDataProvider: public DataProvider
*
* @exception DbDisconnectionFailure if unsuccessful disconnection.
*/
- void
- disconnect(void);
+ void disconnect();
/**
* Starts a transaction.
*
* @exception std::runtime_error if a transaction is still open
*/
- void
- beginTransaction(void)
+ void beginTransaction()
throw (std::runtime_error);
/**
@@ -115,8 +109,7 @@ class SqLiteDataProvider: public DataProvider
*
* @exception std::runtime_error if no connection is currently open.
*/
- void
- commitTransaction(void)
+ void commitTransaction()
throw (std::runtime_error);
/**
@@ -124,8 +117,7 @@ class SqLiteDataProvider: public DataProvider
*
* @exception std::runtime_error if no connection is currently open.
*/
- void
- rollbackTransaction(void)
+ void rollbackTransaction()
throw (std::runtime_error);
/**
@@ -134,8 +126,7 @@ class SqLiteDataProvider: public DataProvider
*
* @return Number of rows that have changed.
*/
- const unsigned int
- getModifiedRows(void) const;
+ unsigned getModifiedRows() const;
/**
* Returns the last inserted value of an autoincrement column after an
@@ -143,8 +134,7 @@ class SqLiteDataProvider: public DataProvider
*
* @return last autoincrement value.
*/
- const unsigned int
- getLastId(void) const;
+ unsigned getLastId() const;
/**
* Prepare SQL statement
@@ -185,8 +175,7 @@ class SqLiteDataProvider: public DataProvider
*
* @return true, if a transaction is open.
*/
- const bool
- inTransaction(void) const;
+ bool inTransaction() const;
sqlite3 *mDb; /**< the handle to the database connection */
sqlite3_stmt *mStmt; /**< the prepared statement to process */
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp
index 5f6f28fa..808e0b1d 100644
--- a/src/game-server/accountconnection.cpp
+++ b/src/game-server/accountconnection.cpp
@@ -47,7 +47,7 @@ AccountConnection::~AccountConnection()
delete mSyncBuffer;
}
-bool AccountConnection::start(const int gameServerPort)
+bool AccountConnection::start(int gameServerPort)
{
const std::string accountServerAddress =
Configuration::getValue("net_accountServerAddress", "localhost");
@@ -72,7 +72,7 @@ bool AccountConnection::start(const int gameServerPort)
msg.writeString(gameServerAddress);
msg.writeShort(gameServerPort);
msg.writeString(password);
- msg.writeLong(ItemManager::GetDatabaseVersion());
+ msg.writeLong(ItemManager::getDatabaseVersion());
const MapManager::Maps &m = MapManager::getMaps();
for (MapManager::Maps::const_iterator i = m.begin(), i_end = m.end();
i != i_end; ++i)
diff --git a/src/game-server/accountconnection.hpp b/src/game-server/accountconnection.hpp
index dda78f7e..fc593497 100644
--- a/src/game-server/accountconnection.hpp
+++ b/src/game-server/accountconnection.hpp
@@ -63,7 +63,7 @@ class AccountConnection : public Connection
* Initializes a connection to the account server described in the
* configuration file. Registers the maps known by MapManager.
*/
- bool start(const int gameServerPort);
+ bool start(int gameServerPort);
/**
* Sends data of a given character.
diff --git a/src/game-server/itemmanager.cpp b/src/game-server/itemmanager.cpp
index d86ac665..64f1aeb4 100644
--- a/src/game-server/itemmanager.cpp
+++ b/src/game-server/itemmanager.cpp
@@ -236,7 +236,7 @@ ItemClass *ItemManager::getItem(int itemId)
return i != itemClasses.end() ? i->second : NULL;
}
-unsigned int ItemManager::GetDatabaseVersion(void)
+unsigned ItemManager::getDatabaseVersion()
{
return itemDatabaseVersion;
}
diff --git a/src/game-server/itemmanager.hpp b/src/game-server/itemmanager.hpp
index ec2c5c6d..2737642a 100644
--- a/src/game-server/itemmanager.hpp
+++ b/src/game-server/itemmanager.hpp
@@ -51,7 +51,7 @@ namespace ItemManager
/**
* Gets the version of the loaded item database.
*/
- unsigned int GetDatabaseVersion(void);
+ unsigned getDatabaseVersion();
}
#endif
diff --git a/src/game-server/trade.hpp b/src/game-server/trade.hpp
index f1a9613a..844b6c76 100644
--- a/src/game-server/trade.hpp
+++ b/src/game-server/trade.hpp
@@ -42,7 +42,7 @@ class Trade
* Warns the other character the trade is cancelled.
* Takes care of cleaning afterwards.
*/
- void cancel(void);
+ void cancel();
/**
* Requests a trade to start with given public ID.
@@ -61,7 +61,7 @@ class Trade
* Agree to complete the trade
*/
void agree(Character *c);
-
+
/**
* Adds some items to the trade.
*/
@@ -89,8 +89,8 @@ class Trade
*/
enum TradeState
{
- TRADE_INIT = 0,
- TRADE_RUN,
+ TRADE_INIT = 0,
+ TRADE_RUN,
TRADE_CONFIRM_WAIT,
TRADE_CONFIRMED,
TRADE_AGREE_WAIT
diff --git a/src/utils/logger.h b/src/utils/logger.h
index e23fdceb..bc3b18d8 100644
--- a/src/utils/logger.h
+++ b/src/utils/logger.h
@@ -42,7 +42,7 @@ namespace utils
* <pre>
* \#include "logger.h"
*
- * int main(void)
+ * int main()
* {
* using namespace utils;
*
diff --git a/src/utils/singleton.h b/src/utils/singleton.h
index 1a879235..86b9da7f 100644
--- a/src/utils/singleton.h
+++ b/src/utils/singleton.h
@@ -24,7 +24,6 @@
namespace utils
{
-
/**
* An abstract Meyer's singleton class.
*/
@@ -37,52 +36,39 @@ class Singleton
*
* @return the unique instance of Singleton.
*/
- static T&
- instance(void)
+ static T &instance()
{
static T theInstance;
-
return theInstance;
}
-
protected:
/**
* Default constructor.
*/
- Singleton(void)
+ Singleton()
throw()
- {
- // NOOP
- }
-
+ {}
/**
* Destructor.
*/
- virtual
- ~Singleton(void)
+ virtual ~Singleton()
throw()
- {
- // NOOP
- }
-
+ {}
private:
/**
* Copy constructor.
*/
- Singleton(const Singleton& rhs);
-
+ Singleton(const Singleton &);
/**
* Assignment operator.
*/
- Singleton&
- operator=(const Singleton& rhs);
+ Singleton &operator=(const Singleton &);
};
-
} // namespace utils
#endif // _TMWSERV_SINGLETON_H_