xtd (pronounced "extend") is a modern C++17/20 framework to create console, GUI (forms like WinForms) and unit test applications on Microsoft Windows, Apple macOS, Linux, iOS and android (*).
(*) See portability for more information.
xtd is composed of several libraries.
The xtd.core library is modern C++17/20 libraries of classes, interfaces, and value types that provide access to system functionality. It is the foundation on which c++ applications, components, and controls are built.
The xtd.drawing library contains types that support basic GDI+ graphics functionality. Child namespaces support advanced two-dimensional and vector graphics functionality, advanced imaging functionality, and print-related and typographical services. A child namespace also contains types that extend design-time user-interface logic and drawing.
The xtd.forms library contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows, Apple macOS and linux base operating system.
The xtd.tunit library is a unit-testing framework for modern C++17/20, inspired by Microsoft.VisualStudio.TestTools.Cpp.
This project is an open source project. The developers who participate do so on their own time. It is therefore difficult to fix realese dates.
But you can follow the evolution of the development. We keep the status up to date.
At each commit, a build and unit tests are performed for the following configurations :
Operating system | Debug | Release |
---|---|---|
Windows (x64) | ||
Windows (x86) | ||
macOS | ||
Ubuntu | ||
iOS (**) | ||
Android (**) |
(**) xtd.core and xtd.tunit only.
Deploy to GitHub Pages | status |
---|---|
Deployment of the website | |
Deployment of the latest reference guide |
As xtd is managed by a Kanban project, the number of open issues can be quite large. The table below gives a clearer view on the number of open bugs/questions and enhancements.
Issues | Open | Closed |
---|---|---|
Bugs / Questions from users | ||
xtd 0.1.0 - Enhancements / Developments (*) | ||
xtd 0.1.1 - Enhancements / Developments | ||
xtd 0.2.0 - Enhancements / Developments | ||
xtd 0.3.0 - Enhancements / Developments | ||
xtd 0.4.0 - Enhancements / Developments | ||
xtd 1.0.0 - Enhancements / Developments |
(*) There is only one enhancement for xtd 0.1.0, as project management was not yet available.
The classic first application 'Hello World'.
#include <xtd/xtd>
using namespace xtd;
auto main() -> int {
console::background_color(console_color::blue);
console::foreground_color(console_color::white);
console::write_line("Hello, World!");
}
or simply
#include <xtd/xtd>
using namespace xtd;
auto main() -> int {
console::out << background_color(console_color::blue) << foreground_color(console_color::white) << "Hello, World!" << environment::new_line;
}
cmake_minimum_required(VERSION 3.20)
project(hello_world_console)
find_package(xtd REQUIRED)
add_sources(hello_world_console.cpp)
target_type(CONSOLE_APPLICATION)
Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:
xtdc run
#include <xtd/xtd>
using namespace xtd::forms;
class main_form : public form {
public:
main_form() {
text("Hello world (message_box)");
button1.location({10, 10});
button1.parent(*this);
button1.text("&Click me");
button1.click += [] {
message_box::show("Hello, World!");
};
}
private:
button button1;
};
auto main() -> int {
application::run(main_form {});
}
or simply
#include <xtd/xtd>
auto main() -> int {
auto main_form = xtd::forms::form::create("Hello world (message_box)");
auto button1 = xtd::forms::button::create(main_form, "&Click me", {10, 10});
button1.click += [] {xtd::forms::message_box::show("Hello, World!");};
xtd::forms::application::run(main_form);
}
cmake_minimum_required(VERSION 3.20)
project(hello_world_forms)
find_package(xtd REQUIRED)
add_sources(hello_world_forms.cpp)
target_type(GUI_APPLICATION)
Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:
xtdc run
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::tunit;
namespace unit_tests {
class test_class_(hello_world_test) {
void test_method_(create_string_from_literal) {
auto s = string {"Hello, World!"};
valid::are_equal(13, s.size());
assert::are_equal("Hello, World!", s);
}
void test_method_(create_string_from_chars) {
auto s = string {'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!'};
valid::are_equal(13, s.size());
string_assert::starts_with("Hello,", s);
string_assert::ends_with(" World!", s);
}
};
}
auto main() -> int {
return console_unit_test().run();
}
or without helpers
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::tunit;
namespace unit_tests {
class hello_world_test;
auto hello_world_test_class_attr = test_class_attribute {"unit_tests::hello_world_test"};
class hello_world_test : public test_class {
test_method_attribute create_string_from_literal_attr {"create_string_from_literal", *this, &hello_world_test::create_string_from_literal};
void create_string_from_literal() {
auto s = string {"Hello, World!"};
valid::are_equal(13, s.size());
assert::are_equal("Hello, World!", s);
}
test_method_attribute create_string_from_chars_attr {"create_string_from_chars", *this, &hello_world_test::create_string_from_chars};
void create_string_from_chars() {
auto s = string {'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!'};
valid::are_equal(13, s.size());
string_assert::starts_with("Hello,", s);
string_assert::ends_with(" World!", s);
}
};
}
auto main() -> int {
return console_unit_test().run();
}
cmake_minimum_required(VERSION 3.20)
project(hello_world_test)
find_package(xtd REQUIRED)
add_sources(hello_world_test.cpp)
target_type(TEST_APPLICATION)
Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:
xtdc run
minesweeper (on Windows)
game_of_life (on macOS)
xtdc-gui - Create a new project (on macOS)
calculator (on Ubuntu)
stopwatch (on Windows)
painting (on Ubuntu)
The authors file lists contributors together with contact information. If you make a contribution, please add yourself to the list.
Your contributions are welcome.
Your feedback is important for the evolution of the project.
The following project aims to simplify and guide the way beginners make their first contribution. If you are looking to make your first contribution, check out the project below.
First Contributions
Now you are ready to make your first contribution to xtd.
© 2024 Gammasoft.