8000 GitHub - xhawk18/xtd: Free open-source modern C++17 / C++20 framework to create console, forms (GUI like WinForms) and unit test applications on Microsoft Windows, Apple macOS and Linux.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ xtd Public
forked from gammasoft71/xtd

Free open-source modern C++17 / C++20 framework to create console, forms (GUI like WinForms) and unit test applications on Microsoft Windows, Apple macOS and Linux.

License

Notifications You must be signed in to change notification settings

xhawk18/xtd

 
 

Repository files navigation

xtd

Modern C++17/20 framework to create console (CLI), forms (GUI like WinForms) and tunit (unit tests like Microsoft Unit Testing Framework) applications on Windows, macOS, Linux, iOS and android (*).

logo

(*) See portability for more information.

License Language Reference Guide wiki web discord Download xtd

Contents

Continuous Integration build status

At each commit, a build and unit tests are performed for the following configurations :

Operating system Debug Release
Windows (x64) Windows (x64) Debug Windows (x64) Release
Windows (win32) Windows (win32) Debug Windows (win32) Release
macOS macOS Debug macOS Release
Ubuntu Ubuntu Debug Ubuntu Release
iOS (**) Coming soon... Coming soon...
Android (**) Coming soon... Coming soon...

(**) xtd.core and xtd.tunit only.

Features

  • Free and open-source (MIT License);
  • a collection of native C++ classes libraries, to complete std;
  • API close to the .net API with a modern C++ approach and full integration with the std standard;
  • written in efficient, modern C++17 / C++20 with RAII programming idiom;
  • and highly portable and available on many different platforms;

Links

For more information about xtd see :

Examples

The classic first application 'Hello World'.

Console (CLI)

hello_world_console.cpp

#include <xtd/xtd>

using namespace xtd;

int main() {
  console::background_color(console_color::blue);
  console::foreground_color(console_color::white);
  console::write_line("Hello, World!");
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.3)

project(hello_world_console)
find_package(xtd REQUIRED)
add_sources(hello_world_console.cpp)
target_type(CONSOLE_APPLICATION)

Build and run

Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:

xtdc run

Output

Hello, World!

Forms (GUI like WinForms)

hello_world_forms.cpp

#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;
};

int main() {
  application::run(main_form());
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.3)

project(hello_world_forms)
find_package(xtd REQUIRED)
add_sources(hello_world_forms.cpp)
target_type(GUI_APPLICATION)

Build and run

Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:

xtdc run

Output

Windows

Screenshot

Screenshot

macOS

Screenshot

Screenshot

Linux Gnome

Screenshot

Screenshot

tunit (Unit tests like Microsoft Unit Testing Framework)

hello_world_test.cpp

#include <xtd/xtd>
#include <string>

using namespace std;
using namespace xtd::tunit;

namespace unit_tests {
  class test_class_(hello_world_test) {
  public:
    void test_method_(create_string_from_literal) {
      string s = "Hello, World!";
      valid::are_equal(13, s.size());
      assert::are_equal("Hello, World!", s);
    }
    
    void test_method_(create_string_from_chars) {
      string s = {'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);
    }
  };
}

int main() {
  return console_unit_test().run();
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.3)

project(hello_world_test)
find_package(xtd REQUIRED)
add_sources(hello_world_test.cpp)
target_type(TEST_APPLICATION)

Build and run

Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:

xtdc run

Output

Start 2 tests from 1 test case
Run tests:
  SUCCEED hello_world_test.create_string_from_literal (0 ms total)
  SUCCEED hello_world_test.create_string_from_chars (0 ms total)

Test results:
  SUCCEED 2 tests.
End 2 tests from 1 test case ran. (0 ms total)

Getting Started

  • Installation provides download and install documentation.
  • Guides provides xtd guides and tutorials.
  • Examples provides some examples.

Development status

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.

Contributing

The authors file lists contributors together with contact information. If you make a contribution, please add yourself to the list.

Your contributions are welcome.

  • First read Code of conduct and the design guidelines to make sure your contribution follows the rules.
  • Fork the project and use a pull request for adding your contribution.
  • If you face any problems feel free to open an issue at the issues tracker, If you feel like there is a missing feature, please raise a ticket on Github. Pull request are also welcome.

Your feedback is important for the evolution of the project.

Gallery

minesweeper

minesweeper (on Windows)


game_of_life

game_of_life (on macOS)


calculator

calculator (on Ubuntu)


stopwatch

stopwatch (on Windows)


xtdc-gui

xtdc-gui - Create a new project (on macOS)


painting

painting (on Ubuntu)

About

Free open-source modern C++17 / C++20 framework to create console, forms (GUI like WinForms) and unit test applications on Microsoft Windows, Apple macOS and Linux.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 97.6%
  • CMake 1.7%
  • CSS 0.2%
  • C 0.2%
  • Objective-C++ 0.2%
  • Shell 0.1%
0