summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-03-02 07:15:12 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-03-02 07:15:12 +0100
commit7321d56a6f3667899ac6d624d08750e656517bde (patch)
treeb8e75fbbb065c314b3f2dbbdb2b64113f9251305
parentab1d943b11c1f25fbb730e100e1891853108a8c1 (diff)
wip: TextProcessing Example using Qt.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--example/text_processor_example/Jamfile.v214
-rw-r--r--example/text_processor_example/example.cpp19
-rw-r--r--example/text_processor_example/qt_widget.hpp50
3 files changed, 83 insertions, 0 deletions
diff --git a/example/text_processor_example/Jamfile.v2 b/example/text_processor_example/Jamfile.v2
new file mode 100644
index 0000000..4bfc827
--- /dev/null
+++ b/example/text_processor_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
+ : <cxxstd>20 ;
+
diff --git a/example/text_processor_example/example.cpp b/example/text_processor_example/example.cpp
new file mode 100644
index 0000000..03b634e
--- /dev/null
+++ b/example/text_processor_example/example.cpp
@@ -0,0 +1,19 @@
+/*
+ * 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 <ocl/tproc/rope.hpp>
+#include <iostream>
+#include <memory>
+
+#include "qt_widget.hpp"
+
+int main(int argc, char** argv)
+{
+ QApplication app(argc, argv);
+
+ return app.exec();
+}
diff --git a/example/text_processor_example/qt_widget.hpp b/example/text_processor_example/qt_widget.hpp
new file mode 100644
index 0000000..60777e6
--- /dev/null
+++ b/example/text_processor_example/qt_widget.hpp
@@ -0,0 +1,50 @@
+/*
+ * 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 <ocl/tproc/rope.hpp>
+
+#include <iostream>
+#include <string>
+#include <string_view>
+#include <QWidget>
+#include <QApplication>
+
+#ifndef STANDALONE
+
+using namespace ocl;
+using namespace boost;
+
+#else
+
+using namespace boost;
+
+#endif
+
+class TTextEditorWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ using rope_type = tproc::crope;
+ using size_type = rope_type::size_type;
+ using string_view = std::string_view;
+
+ TTextEditorWidget(string_view text = {})
+ : buffer_(text)
+ {
+ }
+
+ virtual ~TTextEditorWidget() = default;
+
+private:
+ rope_type buffer_;
+};
+
+#endif