Overhaul cmake configuration, add console api, fix http code that caused issues with cgi-bin

This commit is contained in:
2026-05-27 03:02:16 -05:00
parent 266ef5f830
commit 8413c67ec6
177 changed files with 20088 additions and 17948 deletions

View File

@@ -1,13 +1,32 @@
/*
TessesFramework a library to make C++ easier for me, used in CrossLang:
https://git.tesses.org/tesses50/crosslang Copyright (C) 2026 Mike Nolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "TextReader.hpp"
namespace Tesses::Framework::TextStreams {
class ConsoleReader : public TextReader {
public:
ConsoleReader();
bool ReadBlock(std::string &str, size_t sz);
};
namespace Tesses::Framework::TextStreams
{
class ConsoleReader : public TextReader {
public:
ConsoleReader();
bool ReadBlock(std::string& str,size_t sz);
};
ConsoleReader StdIn();
ConsoleReader StdIn();
}
} // namespace Tesses::Framework::TextStreams

View File

@@ -1,15 +1,32 @@
/*
TessesFramework a library to make C++ easier for me, used in CrossLang:
https://git.tesses.org/tesses50/crosslang Copyright (C) 2026 Mike Nolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "TextWriter.hpp"
namespace Tesses::Framework::TextStreams {
class ConsoleWriter : public TextWriter {
bool isError;
namespace Tesses::Framework::TextStreams
{
class ConsoleWriter : public TextWriter {
bool isError;
public:
ConsoleWriter(bool isError=false);
void WriteData(const char* text, size_t len);
};
public:
ConsoleWriter(bool isError = false);
void WriteData(const char *text, size_t len);
};
ConsoleWriter StdOut();
ConsoleWriter StdErr();
}
ConsoleWriter StdOut();
ConsoleWriter StdErr();
} // namespace Tesses::Framework::TextStreams

View File

@@ -1,19 +1,36 @@
/*
TessesFramework a library to make C++ easier for me, used in CrossLang:
https://git.tesses.org/tesses50/crosslang Copyright (C) 2026 Mike Nolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "TextReader.hpp"
#include "../Streams/Stream.hpp"
namespace Tesses::Framework::TextStreams
{
class StreamReader : public TextReader
{
private:
std::shared_ptr<Tesses::Framework::Streams::Stream> strm;
bool owns;
public:
std::shared_ptr<Tesses::Framework::Streams::Stream> GetStream();
StreamReader(std::shared_ptr<Tesses::Framework::Streams::Stream> strm);
StreamReader(std::filesystem::path filename);
bool ReadBlock(std::string& str,size_t sz);
bool Rewind();
~StreamReader();
};
}
#include "TextReader.hpp"
namespace Tesses::Framework::TextStreams {
class StreamReader : public TextReader {
private:
std::shared_ptr<Tesses::Framework::Streams::Stream> strm;
bool owns;
public:
std::shared_ptr<Tesses::Framework::Streams::Stream> GetStream();
StreamReader(std::shared_ptr<Tesses::Framework::Streams::Stream> strm);
StreamReader(std::filesystem::path filename);
bool ReadBlock(std::string &str, size_t sz);
bool Rewind();
~StreamReader();
};
} // namespace Tesses::Framework::TextStreams

View File

@@ -1,17 +1,35 @@
/*
TessesFramework a library to make C++ easier for me, used in CrossLang:
https://git.tesses.org/tesses50/crosslang Copyright (C) 2026 Mike Nolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "../Streams/Stream.hpp"
#include "TextWriter.hpp"
namespace Tesses::Framework::TextStreams
{
class StreamWriter : public TextWriter {
private:
std::shared_ptr<Tesses::Framework::Streams::Stream> strm;
public:
std::shared_ptr<Tesses::Framework::Streams::Stream> GetStream();
StreamWriter(std::shared_ptr<Tesses::Framework::Streams::Stream> strm);
StreamWriter(std::filesystem::path filename, bool append=false);
void WriteData(const char* text, size_t len);
~StreamWriter();
};
}
namespace Tesses::Framework::TextStreams {
class StreamWriter : public TextWriter {
private:
std::shared_ptr<Tesses::Framework::Streams::Stream> strm;
public:
std::shared_ptr<Tesses::Framework::Streams::Stream> GetStream();
StreamWriter(std::shared_ptr<Tesses::Framework::Streams::Stream> strm);
StreamWriter(std::filesystem::path filename, bool append = false);
void WriteData(const char *text, size_t len);
~StreamWriter();
};
} // namespace Tesses::Framework::TextStreams

View File

@@ -1,15 +1,34 @@
/*
TessesFramework a library to make C++ easier for me, used in CrossLang:
https://git.tesses.org/tesses50/crosslang Copyright (C) 2026 Mike Nolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "TextReader.hpp"
namespace Tesses::Framework::TextStreams {
class StringReader : public TextReader {
std::string str;
size_t offset;
public:
StringReader();
StringReader(std::string str);
size_t& GetOffset();
std::string& GetString();
bool Rewind();
bool ReadBlock(std::string& str,size_t sz);
};
}
class StringReader : public TextReader {
std::string str;
size_t offset;
public:
StringReader();
StringReader(std::string str);
size_t &GetOffset();
std::string &GetString();
bool Rewind();
bool ReadBlock(std::string &str, size_t sz);
};
} // namespace Tesses::Framework::TextStreams

View File

@@ -1,15 +1,33 @@
/*
TessesFramework a library to make C++ easier for me, used in CrossLang:
https://git.tesses.org/tesses50/crosslang Copyright (C) 2026 Mike Nolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "TextWriter.hpp"
namespace Tesses::Framework::TextStreams
{
class StringWriter : public TextWriter {
private:
std::string text;
public:
std::string& GetString();
StringWriter();
StringWriter(std::string str);
void WriteData(const char* text, size_t len);
};
}
namespace Tesses::Framework::TextStreams {
class StringWriter : public TextWriter {
private:
std::string text;
public:
std::string &GetString();
StringWriter();
StringWriter(std::string str);
void WriteData(const char *text, size_t len);
};
} // namespace Tesses::Framework::TextStreams

View File

@@ -1,22 +1,39 @@
/*
TessesFramework a library to make C++ easier for me, used in CrossLang:
https://git.tesses.org/tesses50/crosslang Copyright (C) 2026 Mike Nolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "../Common.hpp"
#include "TextWriter.hpp"
namespace Tesses::Framework::TextStreams
{
class TextReader
{
bool eof=false;
public:
virtual bool Rewind();
virtual bool ReadBlock(std::string& str,size_t sz)=0;
int32_t ReadChar();
std::string ReadLine();
bool ReadLine(std::string& str);
bool ReadLineHttp(std::string& str);
void ReadAllLines(std::vector<std::string>& lines);
std::string ReadToEnd();
void ReadToEnd(std::string& str);
void CopyTo(TextWriter& writer, size_t bufSz=1024);
virtual ~TextReader();
};
}
namespace Tesses::Framework::TextStreams {
class TextReader {
bool eof = false;
public:
virtual bool Rewind();
virtual bool ReadBlock(std::string &str, size_t sz) = 0;
int32_t ReadChar();
std::string ReadLine();
bool ReadLine(std::string &str);
bool ReadLineHttp(std::string &str);
void ReadAllLines(std::vector<std::string> &lines);
std::string ReadToEnd();
void ReadToEnd(std::string &str);
void CopyTo(TextWriter &writer, size_t bufSz = 1024);
virtual ~TextReader();
};
} // namespace Tesses::Framework::TextStreams

View File

@@ -1,75 +1,83 @@
/*
TessesFramework a library to make C++ easier for me, used in CrossLang:
https://git.tesses.org/tesses50/crosslang Copyright (C) 2026 Mike Nolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "../Common.hpp"
namespace Tesses::Framework::TextStreams
{
class NewLine {}; //dummy class
class TextWriter {
public:
TextWriter();
std::string newline;
virtual void WriteData(const char* text, size_t len)=0;
void Write(int64_t n);
void Write(uint64_t n);
void Write(const void* ptr);
void Write(const char* ptr);
void Write(char c);
void Write(double d);
void Write(std::string text);
inline TextWriter& operator<<(int64_t n)
{
Write(n);
return *this;
}
inline TextWriter& operator<<(uint64_t n)
{
Write(n);
return *this;
}
inline TextWriter& operator<<(const void* n)
{
Write(n);
return *this;
}
inline TextWriter& operator<<(const char* n)
{
Write(n);
return *this;
}
inline TextWriter& operator<<(char n)
{
Write(n);
return *this;
}
inline TextWriter& operator<<(double n)
{
Write(n);
return *this;
}
inline TextWriter& operator<<(std::string n)
{
Write(n);
return *this;
}
inline TextWriter& operator<<(NewLine nl)
{
WriteLine();
return *this;
}
void WriteLine(std::string txt);
void WriteLine(int64_t n);
void WriteLine(uint64_t n);
void WriteLine(const void* ptr);
void WriteLine(const char* ptr);
void WriteLine(char c);
void WriteLine(double d);
void WriteLine();
virtual ~TextWriter();
};
namespace Tesses::Framework::TextStreams {
class NewLine {}; // dummy class
class TextWriter {
public:
TextWriter();
std::string newline;
virtual void WriteData(const char *text, size_t len) = 0;
void Write(int64_t n);
void Write(uint64_t n);
void Write(const void *ptr);
void Write(const char *ptr);
void Write(char c);
void Write(double d);
void Write(std::string text);
inline TextWriter &operator<<(int64_t n) {
Write(n);
return *this;
}
inline TextWriter &operator<<(uint64_t n) {
Write(n);
return *this;
}
inline TextWriter &operator<<(const void *n) {
Write(n);
return *this;
}
inline TextWriter &operator<<(const char *n) {
Write(n);
return *this;
}
inline TextWriter &operator<<(char n) {
Write(n);
return *this;
}
inline TextWriter &operator<<(double n) {
Write(n);
return *this;
}
inline TextWriter &operator<<(std::string n) {
Write(n);
return *this;
}
}
inline TextWriter &operator<<(NewLine nl) {
WriteLine();
return *this;
}
void WriteLine(std::string txt);
void WriteLine(int64_t n);
void WriteLine(uint64_t n);
void WriteLine(const void *ptr);
void WriteLine(const char *ptr);
void WriteLine(char c);
void WriteLine(double d);
void WriteLine();
virtual ~TextWriter();
};
} // namespace Tesses::Framework::TextStreams