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