[Tablegen] Implement a basic table generator

This commit is contained in:
TennesseeTrash 2025-06-14 19:54:03 +02:00
parent 133c3d1a01
commit 35ce1d8e19
6 changed files with 353 additions and 0 deletions

View file

@ -0,0 +1,58 @@
#ifndef TABLEGEN_SETTINGS_HPP
#define TABLEGEN_SETTINGS_HPP
#include <Common/RGB.hpp>
#include <string>
#include <vector>
namespace Tablegen
{
using Common::RGB;
enum class Flag {
Enable, Disable,
};
enum class FontSizeUnits {
Px, Em,
};
std::string ToString(FontSizeUnits units);
struct CharacterInfo
{
std::string Label;
std::string ImagePath;
std::string AnimationPath;
};
struct Settings
{
Flag FullDocument;
Flag OverrideIndentLevel;
std::size_t IndentLevel;
double TableWidth;
double TableMargin;
double TableItemWidth;
double TableItemPadding;
RGB TableItemColour;
double LabelFontSize;
FontSizeUnits LabelFontUnits;
RGB ButtonColour;
RGB ButtonHoverColour;
double ButtonAnimationLength;
std::size_t CharactersPerRow;
std::string ImageFormat;
std::string AnimationFormat;
std::vector<CharacterInfo> Characters;
static Settings Default();
};
}
#endif // TABLEGEN_SETTINGS_HPP

View file

@ -0,0 +1,23 @@
#ifndef TABLEGEN_TABLEGEN_HPP
#define TABLEGEN_TABLEGEN_HPP
#include "Settings.hpp"
#ifdef TABLEGEN_EXPOSE_XML
#include <pugixml.hpp>
#endif
#include <string>
namespace Tablegen
{
std::string GeneratePage(const Settings& settings = Settings::Default());
void GeneratePage(const std::string& path, const Settings& settings = Settings::Default());
# ifdef TABLEGEN_EXPOSE_XML
pugi::xml_document GenerateDocument(const Settings& settings = Settings::Default());
# endif
}
#endif // TABLEGEN_TABLEGEN_HPP