Git Product home page Git Product logo

fikarzlf / xtd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gammasoft71/xtd

0.0 0.0 0.0 444.44 MB

Modern c++17 / c++20 framework to create console, forms (GUI like WinForms) and unit test applications on Microsoft Windows, Apple macOS and Linux.

Home Page: https://gammasoft71.wixsite.com/xtdpro

License: MIT License

CMake 1.54% C++ 97.79% Batchfile 0.03% Shell 0.15% Objective-C++ 0.22% C 0.25% CSS 0.01%

xtd's Introduction

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

Continuous Integration build status

Operating system Status
Windows Appveyor
macOS TravisCI
Linux CircleCI

Features

  • a collection of native C++ classes libraries, to complete std
  • written in efficient, modern C++17 / C++20
  • and highly portable and available on many different platforms (Windows, macOS, Linux, iOS and Android)
  • API close to the .net API with a modern C++ approach and full integration with the std standard.

For more information 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.
  • Portability provides information about C++, libraries dependency, Operating System suported, Compilators and Devepment Environment tools.
  • Examples provides some examples.

xtd's People

Contributors

baderouaich avatar bigplayszn avatar gammasoft71 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.