From 346193aad98304e58679a37f12e570f0c02aae89 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 15 Mar 2026 14:42:47 +0000 Subject: [PATCH] meta: add c++ wrapper for ds module --- CMakeLists.txt | 2 +- ds-mm/CMakeLists.txt | 5 +++ ds-mm/include/blue/core.hpp | 0 ds-mm/include/blue/ds.hpp | 0 ds-mm/include/blue/ds/string.hpp | 63 ++++++++++++++++++++++++++++++++ ds-mm/string.cpp | 0 6 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 ds-mm/CMakeLists.txt create mode 100644 ds-mm/include/blue/core.hpp create mode 100644 ds-mm/include/blue/ds.hpp create mode 100644 ds-mm/include/blue/ds/string.hpp create mode 100644 ds-mm/string.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index c71bfa7..1c748eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(b_modules core ds serial term cmd io compress - core-mm) + core-mm ds-mm) set(b_system_name ${CMAKE_SYSTEM_NAME}) string(TOLOWER ${b_system_name} b_system_name) diff --git a/ds-mm/CMakeLists.txt b/ds-mm/CMakeLists.txt new file mode 100644 index 0000000..ff2eb60 --- /dev/null +++ b/ds-mm/CMakeLists.txt @@ -0,0 +1,5 @@ +include(../cmake/Templates.cmake) + +add_bluelib_mm_module( + NAME ds + DEPENDENCIES core-mm ds) diff --git a/ds-mm/include/blue/core.hpp b/ds-mm/include/blue/core.hpp new file mode 100644 index 0000000..e69de29 diff --git a/ds-mm/include/blue/ds.hpp b/ds-mm/include/blue/ds.hpp new file mode 100644 index 0000000..e69de29 diff --git a/ds-mm/include/blue/ds/string.hpp b/ds-mm/include/blue/ds/string.hpp new file mode 100644 index 0000000..37fd16d --- /dev/null +++ b/ds-mm/include/blue/ds/string.hpp @@ -0,0 +1,63 @@ +#ifndef BLUE_DS_STRING_HPP_ +#define BLUE_DS_STRING_HPP_ + +#include +#include +#include +#include +#include + +namespace blue::ds +{ +class string : public core::object +{ + public: + core::type get_type(void); + + string(); + string(const char *s); + string(const core::wchar *s); + string(char c, std::size_t count); + + char *steal(void); + status reserve(size_t capacity); + status replace(size_t start, size_t len, const char *new_data); + status replace(const char *new_data); + status replace(const core::stringstream &new_data); + status remove(size_t start, size_t len); + status transform(int (*transformer)(int)); + status trim(void); + status toupper(void) + { + return transform(::toupper); + } + + status tolower(void) + { + return transform(::tolower); + } + + status append(char c); + status append(core::wchar c); + status append(const string &s); + status append(const core::wchar *s); + status append(const char *format, ...); + + status prepend(char c); + status prepend(core::wchar c); + status prepend(const char *s); + status prepend(const core::wchar *s); + status prepend(const char *format, ...); + + status insert(char c, std::size_t at); + status insert(core::wchar c, std::size_t at); + status insert(const string &s, std::size_t at); + status insert(const char *s, std::size_t at); + status insert(const core::wchar *s, std::size_t at); + status insert(std::size_t at, const char *format, ...); + + void clear(void); +}; +} + +#endif diff --git a/ds-mm/string.cpp b/ds-mm/string.cpp new file mode 100644 index 0000000..e69de29