* 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:
Antidote
2013-01-27 08:49:48 -08:00
parent 3c8b493014
commit f644c7d1a3
7 changed files with 82 additions and 124 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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;
};