From 24767406a9a1ee0bd53c20175ed7a7d2fe166d29 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 7 Mar 2026 06:59:38 +0100 Subject: [CHORE] Introduce replacement of text_processor example, text_editor. Signed-off-by: Amlal El Mahrouss --- example/text_editor_example/Jamfile.v2 | 14 ++++++++ example/text_editor_example/example.cpp | 18 ++++++++++ example/text_editor_example/texteditor.hpp | 54 ++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 example/text_editor_example/Jamfile.v2 create mode 100644 example/text_editor_example/example.cpp create mode 100644 example/text_editor_example/texteditor.hpp (limited to 'example/text_editor_example') diff --git a/example/text_editor_example/Jamfile.v2 b/example/text_editor_example/Jamfile.v2 new file mode 100644 index 0000000..4bfc827 --- /dev/null +++ b/example/text_editor_example/Jamfile.v2 @@ -0,0 +1,14 @@ +# +# File: Jamfile.v2 +# Author: Amlal El Mahrouss, +# Copyright 2026, Amlal El Mahrouss, Licensed under the Boost Software License +# + +project tests +: default-build debug +; + +exe example.o + : example.cpp + : 20 ; + diff --git a/example/text_editor_example/example.cpp b/example/text_editor_example/example.cpp new file mode 100644 index 0000000..bc2bffd --- /dev/null +++ b/example/text_editor_example/example.cpp @@ -0,0 +1,18 @@ +/* + * File: example.cpp + * Purpose: Rope example. + * Author: Amlal El Mahrouss (amlal@nekernel.org) + * Copyright 2026, Amlal El Mahrouss, licensed under the Boost Software License. + */ + +#include "texteditor.hpp" + +int main(int argc, char** argv) +{ + QApplication app(argc, argv); + TTextEditor win; + + win.show(); + + return app.exec(); +} diff --git a/example/text_editor_example/texteditor.hpp b/example/text_editor_example/texteditor.hpp new file mode 100644 index 0000000..e83cf85 --- /dev/null +++ b/example/text_editor_example/texteditor.hpp @@ -0,0 +1,54 @@ +/* + * File: qt_widget.hpp + * Purpose: Minimal text editor widget example using tproc rope. + * Author: Amlal El Mahrouss (amlal@nekernel.org) + * Copyright 2026, Amlal El Mahrouss, licensed under the Boost Software License. + */ + +#ifndef TPROC_EXAMPLE_QT_WIDGET_HPP +#define TPROC_EXAMPLE_QT_WIDGET_HPP + +#include + +#include +#include +#include +#include +#include + +#ifndef STANDALONE + +using namespace ocl; +using namespace boost; + +#else + +using namespace boost; + +#endif + +class TTextEditor; + +class TTextEditor : public QMainWindow +{ + Q_OBJECT + +public: + using rope_type = tproc::crope; + using size_type = rope_type::size_type; + using string_view = std::string_view; + + TTextEditorWidget() = delete; + + TTextEditor(string_view text, TTextEditorDelegate* del) + : buffer_(text), delegate_(del) + { + } + + virtual ~TTextEditor() = default; + +private: + rope_type buffer_; +}; + +#endif -- cgit v1.2.3