Add a namespace to OpenFStream

For consistency with the other functions in FileUtil.h.
This commit is contained in:
JosJuice
2017-01-15 22:46:43 +01:00
parent f09ceaa735
commit cf94ce6305
15 changed files with 24 additions and 24 deletions

View File

@ -162,8 +162,6 @@ std::string& GetExeDirectory();
bool WriteStringToFile(const std::string& str, const std::string& filename);
bool ReadFileToString(const std::string& filename, std::string& str);
} // namespace
// To deal with Windows being dumb at unicode:
template <typename T>
void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode)
@ -174,3 +172,5 @@ void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmod
fstream.open(filename.c_str(), openmode);
#endif
}
} // namespace

View File

@ -401,7 +401,7 @@ bool IniFile::Load(const std::string& filename, bool keep_current_data)
// Open file
std::ifstream in;
OpenFStream(in, filename, std::ios::in);
File::OpenFStream(in, filename, std::ios::in);
if (in.fail())
return false;
@ -474,7 +474,7 @@ bool IniFile::Save(const std::string& filename)
{
std::ofstream out;
std::string temp = File::GetTempFilenameForAtomicWrite(filename);
OpenFStream(out, temp, std::ios::out);
File::OpenFStream(out, temp, std::ios::out);
if (out.fail())
{

View File

@ -70,7 +70,7 @@ public:
m_num_entries = 0;
// try opening for reading/writing
OpenFStream(m_file, filename, ios_base::in | ios_base::out | ios_base::binary);
File::OpenFStream(m_file, filename, ios_base::in | ios_base::out | ios_base::binary);
m_file.seekg(0, std::ios::end);
std::fstream::pos_type end_pos = m_file.tellg();

View File

@ -170,7 +170,7 @@ LogContainer::LogContainer(const std::string& shortName, const std::string& full
FileLogListener::FileLogListener(const std::string& filename)
{
OpenFStream(m_logfile, filename, std::ios::app);
File::OpenFStream(m_logfile, filename, std::ios::app);
SetEnable(true);
}