* Add formattedMessage to Exception

* Add missing IStreamWriter::fill implementations in FileWriter
This commit is contained in:
Phillip Stephens 2015-04-30 21:16:18 -07:00
parent 77c58243b0
commit 8386fa54a0
3 changed files with 20 additions and 0 deletions

View File

@ -71,6 +71,11 @@ public:
{
return m_line;
}
inline std::string formattedMessage() const
{
return Athena::utility::sprintf("%s : %s (%i) %s", m_file.c_str(), m_function.c_str(), m_line, m_message.c_str());
}
protected:
std::string m_message; //!< The error message string
std::string m_file;

View File

@ -59,6 +59,8 @@ public:
void writeBool (bool val);
void writeString(const std::string& val);
void writeUnicode(const std::string& str);
void fill(atInt8 byte, atUint64 len);
void fill(atUint8 byte, atUint64 len);
private:
std::string m_filename;
FILE* m_fileHandle;

View File

@ -306,5 +306,18 @@ void FileWriter::writeUnicode(const std::string& str)
writeInt16(chr);
}
}
void FileWriter::fill(atInt8 byte, atUint64 len)
{
if (!isOpen())
THROW_INVALID_OPERATION_EXCEPTION("File not open for writing");
fwrite(&byte, 1, len, m_fileHandle);
}
void FileWriter::fill(atUint8 byte, atUint64 len)
{
fill((atInt8)byte, len);
}
}
} // Athena