1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

More logging for #520

This commit is contained in:
Michał W. Urbańczyk
2010-07-14 02:53:21 +00:00
parent 9febb357ff
commit d69ae9aa4c
5 changed files with 75 additions and 31 deletions

View File

@ -208,6 +208,16 @@ bool CConnection::isOpen() const
return socket && connected;
}
void CConnection::reportState(CLogger &out)
{
out << "CConnection\n";
if(socket && socket->is_open())
{
out << "\tWe have an open and valid socket\n";
out << "\t" << socket->available() <<" bytes awaiting\n";
}
}
CSaveFile::CSaveFile( const std::string &fname )
:sfile(NULL)
{
@ -234,6 +244,7 @@ void CSaveFile::close()
void CSaveFile::openNextFile(const std::string &fname)
{
fName = fname;
close();
sfile = new std::ofstream(fname.c_str(),std::ios::binary);
if(!(*sfile))
@ -248,6 +259,15 @@ void CSaveFile::openNextFile(const std::string &fname)
}
}
void CSaveFile::reportState(CLogger &out)
{
out << "CSaveFile" << std::endl;
if(sfile && *sfile)
{
out << "\tOpened " << fName << "\n\tPosition: " << sfile->tellp() << std::endl;
}
}
CLoadFile::CLoadFile( const std::string &fname, bool requireLatest )
:sfile(NULL)
{
@ -274,6 +294,7 @@ void CLoadFile::close()
void CLoadFile::openNextFile(const std::string &fname, bool requireLatest)
{
fName = fname;
sfile = new std::ifstream(fname.c_str(),std::ios::binary);
if(!(*sfile))
{
@ -303,6 +324,15 @@ void CLoadFile::openNextFile(const std::string &fname, bool requireLatest)
}
}
void CLoadFile::reportState(CLogger &out)
{
out << "CLoadFile" << std::endl;
if(sfile && *sfile)
{
out << "\tOpened " << fName << "\n\tPosition: " << sfile->tellg() << std::endl;
}
}
CTypeList::CTypeList()
{
registerTypes(*this);