Add a doxygen documentation.

This commit is contained in:
ArthurSonzogni
2020-08-09 14:53:56 +02:00
committed by Arthur Sonzogni
parent 5f15b2881e
commit 20b9a0f0f5
20 changed files with 936 additions and 525 deletions

View File

@@ -10,35 +10,7 @@
namespace ftxui {
// static
Event Event::Character(const std::string& input) {
Event event;
event.input_ = input;
event.is_character_ = true;
event.character_ = to_wstring(input)[0];
return event;
}
// static
Event Event::Character(char c) {
return Character(wchar_t(c));
}
// static
Event Event::Character(wchar_t c) {
Event event;
event.input_ = {(char)c};
event.is_character_ = true;
event.character_ = c;
return event;
}
// static
Event Event::Special(const std::string& input) {
Event event;
event.input_ = std::move(input);
return event;
}
namespace {
void ParseUTF8(Receiver<char>& in, Sender<Event>& out, std::string& input) {
char c;
@@ -131,6 +103,38 @@ void ParseESC(Receiver<char>& in, Sender<Event>& out, std::string& input) {
}
}
} // namespace
// static
Event Event::Character(const std::string& input) {
Event event;
event.input_ = input;
event.is_character_ = true;
event.character_ = to_wstring(input)[0];
return event;
}
// static
Event Event::Character(char c) {
return Character(wchar_t(c));
}
// static
Event Event::Character(wchar_t c) {
Event event;
event.input_ = {(char)c};
event.is_character_ = true;
event.character_ = c;
return event;
}
// static
Event Event::Special(const std::string& input) {
Event event;
event.input_ = std::move(input);
return event;
}
// static
void Event::Convert(Receiver<char>& in, Sender<Event>& out, char c) {
std::string input;

View File

@@ -4,8 +4,6 @@
#include "ftxui/component/screen_interactive.hpp"
#define DEFINE_CONSOLEV2_PROPERTIES
#include <stdio.h>
#include <algorithm>
@@ -20,6 +18,7 @@
#include "ftxui/screen/terminal.hpp"
#if defined(_WIN32)
#define DEFINE_CONSOLEV2_PROPERTIES
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
#define NOMINMAX
@@ -40,6 +39,7 @@
namespace ftxui {
namespace {
// Produce a stream of Event from a stream of char.
void CharToEventStream(Receiver<char> receiver, Sender<Event> sender) {
char c;
@@ -154,6 +154,8 @@ void OnResize(int /* signal */) {
on_resize();
}
} // namespace
ScreenInteractive::ScreenInteractive(int dimx,
int dimy,
Dimension dimension,

View File

@@ -7,6 +7,8 @@
namespace ftxui {
namespace {
using FlexFunction = void (*)(Requirement&);
void function_flex_grow(Requirement& r) {
@@ -59,6 +61,8 @@ void function_not_flex(Requirement& r) {
r.flex_shrink_y = 0;
}
} // namespace
class Flex : public Node {
public:
Flex(FlexFunction f) { f_ = f; }

View File

@@ -7,6 +7,7 @@
#include <codecvt>
#include <locale>
namespace ftxui {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996) // codecvt_utf8_utf16 is deprecated
@@ -24,4 +25,6 @@ std::wstring to_wstring(const std::string& s) {
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
} // namespace ftxui

View File

@@ -67,6 +67,8 @@
#include "ftxui/screen/string.hpp"
namespace ftxui {
namespace {
struct interval {
int first;
@@ -303,3 +305,5 @@ int wstring_width_cjk(const std::wstring& text) {
}
return width;
}
} // namespace ftxui