mirror of
https://git.tesses.org/tesses50/tessesframework.git
synced 2026-06-01 18:15:31 +00:00
Fix win32 printing, fix my stupid json vulnerability
This commit is contained in:
@@ -20,60 +20,61 @@
|
||||
#include <cstdio>
|
||||
|
||||
namespace Tesses::Framework {
|
||||
enum class ConsoleColor {
|
||||
CC_BLACK,
|
||||
CC_RED,
|
||||
CC_GREEN,
|
||||
CC_YELLOW,
|
||||
CC_BLUE,
|
||||
CC_MAGENTA,
|
||||
CC_CYAN,
|
||||
CC_WHITE
|
||||
};
|
||||
enum class ClearBehaviour {
|
||||
CB_CURSORANDBELOW,
|
||||
CB_CURSORANDABOVE,
|
||||
CB_ENTIRESCREEN
|
||||
};
|
||||
struct Console {
|
||||
static bool IsTTY();
|
||||
static std::pair<int,int> GetSize();
|
||||
static void ProgressBar(double);
|
||||
static void ProgressBar(int);
|
||||
static void Write(std::string text);
|
||||
static void WriteLine(std::string text);
|
||||
static void WriteView(std::string_view text);
|
||||
static void WriteLineView(std::string_view text);
|
||||
static void Error(std::string text);
|
||||
static void ErrorLine(std::string text);
|
||||
static void ErrorView(std::string_view text);
|
||||
static void ErrorLineView(std::string_view text);
|
||||
static int Read();
|
||||
static std::string ReadLine();
|
||||
enum class ConsoleColor {
|
||||
CC_BLACK,
|
||||
CC_RED,
|
||||
CC_GREEN,
|
||||
CC_YELLOW,
|
||||
CC_BLUE,
|
||||
CC_MAGENTA,
|
||||
CC_CYAN,
|
||||
CC_WHITE
|
||||
};
|
||||
enum class ClearBehaviour {
|
||||
CB_CURSORANDBELOW,
|
||||
CB_CURSORANDABOVE,
|
||||
CB_ENTIRESCREEN
|
||||
};
|
||||
struct Console {
|
||||
static bool IsTTY();
|
||||
static std::pair<int, int> GetSize();
|
||||
static void ProgressBar(double);
|
||||
static void ProgressBar(int);
|
||||
static void Write(std::string text);
|
||||
static void WriteLine(std::string text);
|
||||
static void WriteView(std::string_view text);
|
||||
static void WriteLineView(std::string_view text);
|
||||
static void Error(std::string text);
|
||||
static void ErrorLine(std::string text);
|
||||
static void ErrorView(std::string_view text);
|
||||
static void ErrorLineView(std::string_view text);
|
||||
static int Read();
|
||||
static std::string ReadLine();
|
||||
|
||||
static bool GetEcho();
|
||||
static bool SetEcho(bool echo);
|
||||
static bool GetCanonical();
|
||||
static bool SetCanonical(bool can);
|
||||
static bool GetSignals();
|
||||
static bool SetSignals(bool sig);
|
||||
static bool GetEcho();
|
||||
static bool SetEcho(bool echo);
|
||||
static bool GetCanonical();
|
||||
static bool SetCanonical(bool can);
|
||||
static bool GetSignals();
|
||||
static bool SetSignals(bool sig);
|
||||
|
||||
static void SetPosition(int x, int y);
|
||||
static void SetPosition(int x, int y);
|
||||
|
||||
static void SetBackgroundColor(ConsoleColor c, bool alt);
|
||||
static void SetForegroundColor(ConsoleColor c, bool alt);
|
||||
static void Clear();
|
||||
static void MoveToHome();
|
||||
static void ClearRetainPosition(ClearBehaviour clearBehaviour);
|
||||
static void Flush();
|
||||
static void SetBackgroundColor(ConsoleColor c, bool alt);
|
||||
static void SetForegroundColor(ConsoleColor c, bool alt);
|
||||
static void Clear();
|
||||
static void MoveToHome();
|
||||
static void ClearRetainPosition(ClearBehaviour clearBehaviour);
|
||||
static void Reset();
|
||||
static void SetInvertedColors(bool inverted);
|
||||
static void Flush();
|
||||
|
||||
//returns std::string::npos if no tty
|
||||
static size_t List(std::vector<std::string>& strs);
|
||||
// returns std::string::npos if no tty
|
||||
static size_t List(std::vector<std::string> &strs);
|
||||
|
||||
static std::string ReadPassword();
|
||||
|
||||
static std::string ReadPassword();
|
||||
|
||||
private:
|
||||
static void WriteToStream(std::string_view text, bool isStderr);
|
||||
};
|
||||
}
|
||||
private:
|
||||
static void WriteToStream(std::string_view text, bool isStderr);
|
||||
};
|
||||
} // namespace Tesses::Framework
|
||||
@@ -68,4 +68,6 @@ class Process {
|
||||
|
||||
~Process();
|
||||
};
|
||||
|
||||
void ShellFileOrUrl(std::string fileOrUrl);
|
||||
} // namespace Tesses::Framework::Platform
|
||||
Reference in New Issue
Block a user