first commit

This commit is contained in:
2024-12-06 04:58:55 -06:00
commit 856373b396
61 changed files with 5920 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#pragma once
#include "TextReader.hpp"
#include "../Streams/Stream.hpp"
namespace Tesses::Framework::TextStreams
{
class StreamReader : public TextReader
{
private:
Tesses::Framework::Streams::Stream* strm;
bool owns;
public:
Tesses::Framework::Streams::Stream& GetStream();
StreamReader(Tesses::Framework::Streams::Stream& strm);
StreamReader(Tesses::Framework::Streams::Stream* strm, bool owns);
StreamReader(std::filesystem::path filename);
bool ReadBlock(std::string& str,size_t sz);
~StreamReader();
};
}

View File

@ -0,0 +1,19 @@
#pragma once
#include "../Streams/Stream.hpp"
#include "TextWriter.hpp"
namespace Tesses::Framework::TextStreams
{
class StreamWriter : public TextWriter {
private:
Tesses::Framework::Streams::Stream* strm;
bool owns;
public:
Tesses::Framework::Streams::Stream& GetStream();
StreamWriter(Tesses::Framework::Streams::Stream& strm);
StreamWriter(Tesses::Framework::Streams::Stream* strm, bool owns);
StreamWriter(std::filesystem::path filename, bool append=false);
void WriteData(const char* text, size_t len);
~StreamWriter();
};
}

View File

@ -0,0 +1,18 @@
#pragma once
#include "../Common.hpp"
#include "TextWriter.hpp"
namespace Tesses::Framework::TextStreams
{
class TextReader
{
public:
virtual bool ReadBlock(std::string& str,size_t sz)=0;
int32_t ReadChar();
std::string ReadLine();
bool ReadLine(std::string& str);
std::string ReadToEnd();
void ReadToEnd(std::string& str);
void CopyTo(TextWriter& writer, size_t bufSz=1024);
virtual ~TextReader();
};
}

View File

@ -0,0 +1,16 @@
#pragma once
#include "../Common.hpp"
namespace Tesses::Framework::TextStreams
{
class TextWriter {
public:
TextWriter();
std::string newline;
virtual void WriteData(const char* text, size_t len)=0;
void Write(std::string txt);
void WriteLine(std::string txt);
void WriteLine();
virtual ~TextWriter();
};
}