mirror of
https://github.com/libAthena/athena.git
synced 2025-12-08 21:18:02 +00:00
* Changed how TextStream works; It's now less derpish and doesn't
produce a corrupted buffer everytime you edit a line.
This commit is contained in:
@@ -21,9 +21,7 @@
|
||||
/*! \class FileNotFoundException
|
||||
* \brief An excpeption thrown when a file could not be found at the given path.
|
||||
*
|
||||
* This should only be thrown when the library tries to write to a buffer
|
||||
* e.g when the position is greater than the position and the stream
|
||||
* is not set to autoresize.<br />
|
||||
* This should only be thrown when the Stream is unable to open a file.<br />
|
||||
* <br />
|
||||
* It is <b>NOT</b> appropriate to use <b>throw new</b> so avoid doing so,
|
||||
* keeping things on the stack as much as possible is very important for speed.
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef __FILESTREAM_HPP__
|
||||
#define __FILESTREAM_HPP__
|
||||
|
||||
#include "Stream.hpp"
|
||||
#include <string>
|
||||
|
||||
class FileStream : public Stream
|
||||
{
|
||||
public:
|
||||
enum FileMode { Open, Create, OpenOrCreate = Open|Create, Truncate, Append };
|
||||
enum AccessMode { ReadOnly, WriteOnly, ReadWrite };
|
||||
FileStream(const std::string& filename, FileMode fileMode, AccessMode accessMode);
|
||||
|
||||
|
||||
private:
|
||||
std::string m_filename;
|
||||
FileMode m_filemode;
|
||||
AccessMode m_accessmode;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -25,10 +25,13 @@ public:
|
||||
|
||||
void setCurrentLine(Uint32 line);
|
||||
Uint32 currentLine() const;
|
||||
private:
|
||||
private:
|
||||
void loadLines();
|
||||
std::string m_filename;
|
||||
FileMode m_filemode;
|
||||
AccessMode m_accessmode;
|
||||
|
||||
std::vector<std::string> m_lines;
|
||||
Uint32 m_currentLine;
|
||||
Uint32 m_startLength;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user