summaryrefslogtreecommitdiff
path: root/modules/database/db_flatfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/database/db_flatfile.cpp')
-rw-r--r--modules/database/db_flatfile.cpp40
1 files changed, 18 insertions, 22 deletions
diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp
index 005e4906c..21cb7cc22 100644
--- a/modules/database/db_flatfile.cpp
+++ b/modules/database/db_flatfile.cpp
@@ -19,11 +19,9 @@ class SaveData : public Serialize::Data
{
public:
Anope::string last;
- std::fstream *fs;
+ std::fstream *fs = nullptr;
- SaveData() : fs(NULL) { }
-
- std::iostream& operator[](const Anope::string &key) anope_override
+ std::iostream& operator[](const Anope::string &key) override
{
if (key != last)
{
@@ -38,15 +36,13 @@ class SaveData : public Serialize::Data
class LoadData : public Serialize::Data
{
public:
- std::fstream *fs;
- unsigned int id;
+ std::fstream *fs = nullptr;
+ unsigned int id = 0;
std::map<Anope::string, Anope::string> data;
std::stringstream ss;
- bool read;
-
- LoadData() : fs(NULL), id(0), read(false) { }
+ bool read = false;
- std::iostream& operator[](const Anope::string &key) anope_override
+ std::iostream& operator[](const Anope::string &key) override
{
if (!read)
{
@@ -78,7 +74,7 @@ class LoadData : public Serialize::Data
return this->ss;
}
- std::set<Anope::string> KeySet() const anope_override
+ std::set<Anope::string> KeySet() const override
{
std::set<Anope::string> keys;
for (std::map<Anope::string, Anope::string>::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
@@ -86,7 +82,7 @@ class LoadData : public Serialize::Data
return keys;
}
- size_t Hash() const anope_override
+ size_t Hash() const override
{
size_t hash = 0;
for (std::map<Anope::string, Anope::string>::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
@@ -106,12 +102,12 @@ class LoadData : public Serialize::Data
class DBFlatFile : public Module, public Pipe
{
/* Day the last backup was on */
- int last_day;
+ int last_day = 0;
/* Backup file names */
std::map<Anope::string, std::list<Anope::string> > backups;
- bool loaded;
+ bool loaded = false;
- int child_pid;
+ int child_pid = -1;
void BackupDatabase()
{
@@ -172,18 +168,18 @@ class DBFlatFile : public Module, public Pipe
}
public:
- DBFlatFile(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), last_day(0), loaded(false), child_pid(-1)
+ DBFlatFile(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR)
{
}
#ifndef _WIN32
- void OnRestart() anope_override
+ void OnRestart() override
{
OnShutdown();
}
- void OnShutdown() anope_override
+ void OnShutdown() override
{
if (child_pid > -1)
{
@@ -197,7 +193,7 @@ class DBFlatFile : public Module, public Pipe
}
#endif
- void OnNotify() anope_override
+ void OnNotify() override
{
char buf[512];
int i = this->Read(buf, sizeof(buf) - 1);
@@ -219,7 +215,7 @@ class DBFlatFile : public Module, public Pipe
Anope::Quitting = true;
}
- EventReturn OnLoadDatabase() anope_override
+ EventReturn OnLoadDatabase() override
{
const std::vector<Anope::string> &type_order = Serialize::Type::GetTypeOrder();
std::set<Anope::string> tried_dbs;
@@ -269,7 +265,7 @@ class DBFlatFile : public Module, public Pipe
}
- void OnSaveDatabase() anope_override
+ void OnSaveDatabase() override
{
if (child_pid > -1)
{
@@ -376,7 +372,7 @@ class DBFlatFile : public Module, public Pipe
}
/* Load just one type. Done if a module is reloaded during runtime */
- void OnSerializeTypeCreate(Serialize::Type *stype) anope_override
+ void OnSerializeTypeCreate(Serialize::Type *stype) override
{
if (!loaded)
return;