Abstract data model library for FTXUI.
This library provides a generic data model abstraction to simplify the management, filtering, and presentation of tabular or structured data within FTXUI terminal applications. It aims to decouple data handling from the UI layer, making it easier to build robust and reactive terminal user interfaces.
- Core Architecture: Models and Indices: An overview of how
AbstractItemModelandModelIndexwork together to power the Model-View system. - Core Architecture: Views, Selection, and Delegates: An overview of the presentation layer, explaining how Views render data, track selection, and apply visual styles using Delegates.
- Generic Data Models: Define flexible data structures using standard C++ types (e.g.,
std::any,std::vector,std::string). - Data Filtering: Built-in mechanisms to filter rows based on generic criteria.
- Type Conversion: Utilities like
AnyToStringTranslatorto seamlessly convert arbitrarystd::anydata into viewable strings for the UI. - Thread Safety: Most of the UI and model components are not designed for thread safety. Any updates must be performed on the thread which owns the object.
We maintain a collection of compiled binary showcases in the examples/ directory.
👉 Click here to see the Live Visual Gallery Dashboard to inspect terminal animations of our binary workflows running in real-time.
You can easily add ftxmodel to your CMake project using CPM.cmake.
-
Add CPM.cmake to your project. You can download
CPM.cmakeand include it in your project'scmakedirectory. -
Add the ftxmodel package. In your
CMakeLists.txt, add the following:CPMAddPackage( NAME ftxmodel GIT_REPOSITORY https://github.com/jplcz/ftxmodel.git GIT_TAG master # Or a specific release tag/commit )
-
Link the library to your target. After defining your executable or library, link
ftxmodelto it:target_link_libraries(your_target_name PRIVATE ftxmodel)
The library provides optional components that integrate with external libraries. If you choose to use these components, you must ensure that the respective external libraries are linked in your project.
To use ftxmodel::SqliteQueryModel, your application target must link against the SQLite3 library.
# Example linking requirement
target_link_libraries(your_target_name PRIVATE sqlite3)To use ftxmodel::JsonPropertyTreeModel, your application target must link against the nlohmann_json library.
# Example linking requirement
target_link_libraries(your_target_name PRIVATE nlohmann_json::nlohmann_json)