Add modules support (#1015)

Add experimental C++20 module suppport.
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
Miko
2025-06-04 09:02:20 -04:00
committed by GitHub
parent fe86d06595
commit b65bbce9bb
51 changed files with 1239 additions and 56 deletions

18
src/ftxui/screen/box.cppm Normal file
View File

@@ -0,0 +1,18 @@
/**
* @file box.cppm
* @brief Module file for the Box struct of the Screen module
*/
module;
#include <ftxui/screen/box.hpp>
export module ftxui.screen.box;
/**
* @namespace ftxui
* @brief The FTXUI ftxui:: namespace
*/
export namespace ftxui {
using ftxui::Box;
}

View File

@@ -0,0 +1,22 @@
/**
* @file color.cppm
* @brief Module file for the Color class of the Screen module
*/
module;
#include <ftxui/screen/color.hpp>
export module ftxui.screen.color;
/**
* @namespace ftxui
* @brief The FTXUI ftxui:: namespace
*/
export namespace ftxui {
using ftxui::Color;
inline namespace literals {
using ftxui::literals::operator""_rgb;
}
}

View File

@@ -0,0 +1,20 @@
/**
* @file color_info.cppm
* @brief Module file for the ColorInfo struct of the Screen module
*/
module;
#include <ftxui/screen/color_info.hpp>
export module ftxui.screen.color_info;
/**
* @namespace ftxui
* @brief The FTXUI ftxui:: namespace
*/
export namespace ftxui {
using ftxui::ColorInfo;
using ftxui::GetColorInfo;
}

View File

@@ -0,0 +1,19 @@
/**
* @file box.cppm
* @brief Module file for the deprecated parts of the Screen module
*/
module;
#include <ftxui/screen/deprecated.hpp>
export module ftxui.screen.deprecated;
/**
* @namespace ftxui
* @brief The FTXUI ftxui:: namespace
*/
export namespace ftxui {
using ftxui::wchar_width;
using ftxui::wstring_width;
}

View File

@@ -0,0 +1,18 @@
/**
* @file image.cppm
* @brief Module file for the Image class of the Screen module
*/
module;
#include <ftxui/screen/image.hpp>
export module ftxui.screen.image;
/**
* @namespace ftxui
* @brief The FTXUI ftxui:: namespace
*/
export namespace ftxui {
using ftxui::Image;
}

View File

@@ -0,0 +1,18 @@
/**
* @file pixel.cppm
* @brief Module file for the Pixel struct of the Screen module
*/
module;
#include <ftxui/screen/pixel.hpp>
export module ftxui.screen.pixel;
/**
* @namespace ftxui
* @brief The FTXUI ftxui:: namespace
*/
export namespace ftxui {
using ftxui::Pixel;
}

View File

@@ -0,0 +1,24 @@
/**
* @file screen.cppm
* @brief Module file for the Screen class of the Screen module
*/
module;
#include <ftxui/screen/screen.hpp>
export module ftxui.screen.screen;
/**
* @namespace ftxui
* @brief The FTXUI ftxui:: namespace
*/
export namespace ftxui {
namespace Dimension {
using ftxui::Dimension::Fixed;
using ftxui::Dimension::Full;
}
using ftxui::Image;
using ftxui::Screen;
}

View File

@@ -0,0 +1,22 @@
/**
* @file string.cppm
* @brief Module file for string functions of the Screen module
*/
module;
#include <ftxui/screen/string.hpp>
export module ftxui.screen.string;
/**
* @namespace ftxui
* @brief The FTXUI ftxui:: namespace
*/
export namespace ftxui {
using ftxui::to_string;
using ftxui::to_wstring;
using ftxui::string_width;
using ftxui::Utf8ToGlyphs;
using ftxui::CellToGlyphIndex;
}

View File

@@ -0,0 +1,26 @@
/**
* @file terminal.cppm
* @brief Module file for the Terminal namespace of the Screen module
*/
module;
#include <ftxui/screen/terminal.hpp>
export module ftxui.screen.terminal;
/**
* @namespace ftxui
* @brief The FTXUI ftxui:: namespace
*/
export namespace ftxui {
using ftxui::Dimensions;
namespace Terminal {
using ftxui::Terminal::Size;
using ftxui::Terminal::SetFallbackSize;
using ftxui::Terminal::Color;
using ftxui::Terminal::ColorSupport;
using ftxui::Terminal::SetColorSupport;
}
}