{"id":15735647,"url":"https://github.com/vahancho/textable","last_synced_at":"2025-08-04T12:35:01.496Z","repository":{"id":68764059,"uuid":"275134155","full_name":"vahancho/textable","owner":"vahancho","description":"A C++ plain text tables generator.","archived":false,"fork":false,"pushed_at":"2023-12-04T16:15:02.000Z","size":64,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T07:40:29.792Z","etag":null,"topics":["ascii","ascii-table","ascii-tables","c-plus-plus","cpp","cpp11","cpp17","plaintext","table","text-table","texttable"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vahancho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-26T10:53:27.000Z","updated_at":"2024-12-10T08:11:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9169928-a650-4339-8b64-63543527e40a","html_url":"https://github.com/vahancho/textable","commit_stats":{"total_commits":79,"total_committers":1,"mean_commits":79.0,"dds":0.0,"last_synced_commit":"4cc43ce1bbc88c26fecefbc412f64a12c96b5d58"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/vahancho/textable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Ftextable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Ftextable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Ftextable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Ftextable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vahancho","download_url":"https://codeload.github.com/vahancho/textable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Ftextable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268696923,"owners_count":24292384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ascii","ascii-table","ascii-tables","c-plus-plus","cpp","cpp11","cpp17","plaintext","table","text-table","texttable"],"created_at":"2024-10-04T01:14:16.188Z","updated_at":"2025-08-04T12:35:01.366Z","avatar_url":"https://github.com/vahancho.png","language":"C++","readme":"# A plain text tables generator\n\n[![Latest release](https://img.shields.io/github/v/release/vahancho/textable?include_prereleases)](https://github.com/vahancho/textable/releases)\n[![Build and test (CMake)](https://github.com/vahancho/textable/actions/workflows/cmake.yml/badge.svg)](https://github.com/vahancho/textable/actions/workflows/cmake.yml)\n[![Build status](https://ci.appveyor.com/api/projects/status/dey9nhcsubmtaq0g?svg=true)](https://ci.appveyor.com/project/vahancho/textable)\n[![codecov](https://codecov.io/gh/vahancho/textable/branch/master/graph/badge.svg)](https://codecov.io/gh/vahancho/textable)\n\nA C++ implementation of a plain text tables generator. The name *Textable* originates\nfrom the combination of two words *Text* and *Table*: `Text + Table = Textable`.\n\n```\n+---------+---------+---------+\n| Column0 | Column1 | Column2 |\n+---------+---------+---------+\n|0        |1        |2        |\n+---------+---------+---------+\n|        0|        1|        2|\n+---------+---------+---------+\n|    0    |    1    |    2    |\n+---------+---------+---------+\n```\n\n## Overview\n\nThe process of the text table generation is simple and intuitive (see examples below).\nYou create an instance of the `Textable` class and populate it with your data.\nYou may add data in any order you want - `Textable` will handle it.\nThe cell content should be specified along with the alignment. A table can be output\nto a character stream or converted to a string with `Textable::toString()` function.\n\n## Features\n\n- An intuitive API to build tables and manage their data\n- Ability to add not only string cell values, but values of any type (convertible to string),\n- Optimized table cell values storage\n- Text alignment support: `Left`, `Right` and `Center`\n- Supports Unicode strings\n- *C++11* support\n\n## Installation\n\nBasically there is installation required - just compile */src/textable.h(.cpp)* in\nyour project and use `Textable` class. Otherwise create and use a CMake generated\ninstallation package.\n\n### Integration with CMake projects\n\nHowever, if you use `CMake` and want to integrate the library into your project you\nmight want to install it first by invoking a `CMake` command from the build directory:\n\n```\ncmake --install . --prefix=\u003cinstall_path\u003e\n```\n\nOnce the library is installed you can use it from in your project by adjusting the\ncorresponding `CMake` script. For example:\n\n```\n[..]\nfind_package(textable REQUIRED)\n\nadd_executable(example main.cpp)\ntarget_link_libraries(example textable)\n[..]\n```\n\n## Prerequisites\n\nNo special requirements except *C++11* compliant compiler. The class is tested latest\nUbuntu and Windows versions. For more details see the CI badges (*AppVeyor CI and GitHub actions*).\n\n### Unicode Strings\n\nIn order to properly handle Unicode content all input strings must be UTF-8 encoded.\nThe client should set a proper locale too. For example: `std::setlocale(LC_ALL, \"en_US.utf8\");`.\n\n## Generated Table Examples\n\n```\n+-------------+----------------+----------------+------+\n|      1      |      1.2       |   Cell text    |  0   |\n+-------------+----------------+----------------+------+\n|      0      |       1        |       2        | 1.1  |\n+-------------+----------------+----------------+------+\n|    first    |     second     |     third      | 2.2  |\n+-------------+----------------+----------------+------+\n|    Fünf     | Двадцать пять  |    Հայաստան    |      |\n+-------------+----------------+----------------+------+\n|             | A Single Value |                |      |\n+-------------+----------------+----------------+------+\n|    true     |     false      |                |      |\n+-------------+----------------+----------------+------+\n| height: 1.8 |  price: 1.234  | length: 5.4321 |      |\n+-------------+----------------+----------------+------+\n|Left         |           Right|      Center    | four |\n+-------------+----------------+----------------+------+\n```\n\n## API Usage Examples:\n\nTo add a single row with three cells:\n```cpp\nTextable textable;\ntextable.setCell(0, 0, Textable::Align::Left, 1);\ntextable.setCell(0, 1, Textable::Align::Right, 1.2);\ntextable.setCell(0, 2, Textable::Align::Center, \"Cell text\");\n```\n\nTo add a single rows in one go:\n```cpp\nTextable textable;\ntextable.setRow(0, Textable::Align::Center, std::vector\u003cint\u003e{ 0, 1, 2 });\ntextable.setRow(1, Textable::Align::Center, std::vector\u003cstd::string\u003e{ \"first\", \"second\", \"third\" });\ntextable.setRow(2, Textable::Align::Center, 1, 2.2f, 3.3, \"Five days\");\n```\n\nTo set a column values in one go\n```cpp\nTextable textable;\ntextable.setColumn(3, Textable::Align::Left, std::vector\u003cdouble\u003e{ 0.0, 1.1, 2.2 });\ntextable.setColumn(4, Textable::Align::Left, std::vector\u003cbool\u003e{ true, false });\ntextable.setColumn(5, Textable::Align::Left, 11, 2.22, 3.0f, \"Apple\");\n```\n\nUsage of a custom type as a cell data\n```cpp\nstruct TableObject\n{\n    float m_price;\n    std::string m_title;\n\n    friend std::ostream \u0026operator\u003c\u003c(std::ostream \u0026os, const TableObject \u0026table);\n};\n\nstd::ostream \u0026operator\u003c\u003c(std::ostream \u0026os, const TableObject \u0026table)\n{\n    os \u003c\u003c table.m_title \u003c\u003c table.m_price;\n    return os;\n}\n\n[..]\n\nTextable textable;\ntextable.setRow(0, Textable::Align::Center,\n                std::vector\u003cTableObject\u003e{ {1.80f, \"height: \"}, {1.234f, \"price: \"}, {5.4321f, \"length: \"} });\n```\n\nExport a table\n```cpp\nTextable textable;\ntextable.setCell(0, 0, Textable::Align::Center, 1);\ntextable.setCell(0, 1, Textable::Align::Center, 1.2);\ntextable.setCell(0, 2, Textable::Align::Center, \"Cell text\");\n\nstd::cout \u003c\u003c textable;\n```\n\n## Building and testing\n\nThere are unit tests provided for the `Textable` class. You can find them in the *test/* directory.\nTo run them you have to build and run the test application (`ENABLE_TESTING` CMake flag set to `True`).\nPlease note that unit tests depend from `GTest`. Therefore it should be also present.\n\nTo build things you should invoke the following commands from the terminal,\nassuming that the compiler and the environment are already configured and you are in the source directory:\n\n### Linux (gcc + `CMake`)\n\n```\nmkdir build \u0026\u0026 cd build\ncmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=True -DTARGET_ARCH=x64\ncmake --build . --config Release\nctest\n```\nIn order to build a debug version use `-DCMAKE_BUILD_TYPE=Debug` parameter.\nTo build library for 32-bit architecture use `TARGET_ARCH=x86` option instead.\n\n### Windows\n\n```\nmkdir build \u0026\u0026 cd build\ncmake .. -DCMAKE_PREFIX_PATH=C:\\build\\googletest\\build -DENABLE_TESTING=True -A x64\ncmake --build . --config Release\nctest -C Release\n```\n\nTo build library for 32-bit architecture use `-A Win32` option instead.\n\n\nBy default the script is configured to build a shared library. In order to build a static one use\n`BUILD_SHARED_LIBS` flag set to `False`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahancho%2Ftextable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvahancho%2Ftextable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahancho%2Ftextable/lists"}