summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/ocl/tproc.hpp8
-rw-r--r--include/ocl/tproc/detail/config.hpp2
-rw-r--r--include/ocl/tproc/detail/rope_fwd.hpp (renamed from include/ocl/tproc/rope_fwd.hpp)31
-rw-r--r--include/ocl/tproc/rope.hpp11
-rw-r--r--src/tproc/rope_impl.cpp6
-rw-r--r--test/rope_test/Jamfile.v214
-rw-r--r--test/rope_test/crope.test.cpp10
7 files changed, 62 insertions, 20 deletions
diff --git a/include/ocl/tproc.hpp b/include/ocl/tproc.hpp
index 514eb47..a23b91c 100644
--- a/include/ocl/tproc.hpp
+++ b/include/ocl/tproc.hpp
@@ -3,10 +3,10 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Official repository: https://github.com/ocl-org/tproc
-#ifndef OCL_TPROC_HPP
-#define OCL_TPROC_HPP
+#ifndef __OCL_TPROC_HPP
+#define __OCL_TPROC_HPP
#include <ocl/tproc/detail/config.hpp>
-#include <ocl/tproc/rope_fwd.hpp>
+#include <ocl/tproc/rope.hpp>
-#endif // OCL_TPROC_HPP
+#endif // __OCL_TPROC_HPP
diff --git a/include/ocl/tproc/detail/config.hpp b/include/ocl/tproc/detail/config.hpp
index 9b1d265..47bd0b2 100644
--- a/include/ocl/tproc/detail/config.hpp
+++ b/include/ocl/tproc/detail/config.hpp
@@ -14,7 +14,9 @@
#include <ocl/smart_ptr.hpp>
namespace ocl {
+
namespace pmr {}
+
} // namespace ocl
#endif // ifndef __OCL_TPROC_CONFIG
diff --git a/include/ocl/tproc/rope_fwd.hpp b/include/ocl/tproc/detail/rope_fwd.hpp
index 6532d47..e7dbebb 100644
--- a/include/ocl/tproc/rope_fwd.hpp
+++ b/include/ocl/tproc/detail/rope_fwd.hpp
@@ -7,18 +7,19 @@
#define OCL_TPROC_ROPE_FWD_HPP
#include <memory>
-#include <string>
+#include <boost/utility/string_view.hpp>
/// \file rope_fwd.hpp
/// \brief Basic forward definitions of the `rope` type.
namespace ocl {
+
/// \brief This class implements a rope type for any **CharT** type.
/// \note Specializations are available as `crope` and `wrope`.
/// \author Amlal El Mahrouss
template <class CharT, class Traits = std::char_traits<CharT>,
class Allocator = std::allocator<CharT>>
-class basic_rope {
+class basic_rope final {
public:
using traits_type = Traits;
using value_type = CharT;
@@ -29,23 +30,20 @@ public:
using pointer = std::allocator_traits<Allocator>::pointer;
using const_pointer = std::allocator_traits<Allocator>::pointer;
- [[nodiscard]]
- CharT *begin() {
- return nullptr;
- }
+ CharT *begin();
+
+ CharT *end();
- [[nodiscard]]
- CharT *end() {
- return nullptr;
- }
+ size_type size();
- [[nodiscard]]
- size_type size() {
- return 0UL;
- }
+ bool empty() const;
- basic_rope() = default;
- virtual ~basic_rope() = default;
+ ~basic_rope() = default;
+ basic_rope(const boost::string_view& in = {});
+
+private:
+ struct impl;
+ std::unique_ptr<impl> impl_;
};
#if __cplusplus >= 201811L
@@ -56,6 +54,7 @@ using u8rope = basic_rope<char8_t>;
using crope = basic_rope<char>;
using wrope = basic_rope<wchar_t>;
+
} // namespace ocl
#endif
diff --git a/include/ocl/tproc/rope.hpp b/include/ocl/tproc/rope.hpp
new file mode 100644
index 0000000..86f1c5e
--- /dev/null
+++ b/include/ocl/tproc/rope.hpp
@@ -0,0 +1,11 @@
+// Copyright 2025, Amlal El Mahrouss (amlal@nekernel.org)
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// Official repository: https://github.com/ocl-org/tproc
+
+#ifndef __OCL_TPROC_ROPE_HPP
+#define __OCL_TPROC_ROPE_HPP
+
+#include <ocl/tproc/detail/rope_fwd.hpp>
+
+#endif // __OCL_TPROC_ROPE_HPP \ No newline at end of file
diff --git a/src/tproc/rope_impl.cpp b/src/tproc/rope_impl.cpp
new file mode 100644
index 0000000..4081a61
--- /dev/null
+++ b/src/tproc/rope_impl.cpp
@@ -0,0 +1,6 @@
+// Copyright 2025, Amlal El Mahrouss (amlal@nekernel.org)
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// Official repository: https://github.com/ocl-org/tproc
+
+#include <ocl/tproc/rope.hpp>
diff --git a/test/rope_test/Jamfile.v2 b/test/rope_test/Jamfile.v2
new file mode 100644
index 0000000..85c867f
--- /dev/null
+++ b/test/rope_test/Jamfile.v2
@@ -0,0 +1,14 @@
+#
+# File: Jamfile.v2
+# Author: Amlal El Mahrouss,
+# Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License
+#
+
+project tests
+: default-build debug
+;
+
+exe crope.test.o
+ : crope.test.cpp
+ : <cxxstd>20 ;
+
diff --git a/test/rope_test/crope.test.cpp b/test/rope_test/crope.test.cpp
index 869331f..e1885f4 100644
--- a/test/rope_test/crope.test.cpp
+++ b/test/rope_test/crope.test.cpp
@@ -5,3 +5,13 @@
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
+#include <ocl/tproc/rope.hpp>
+
+#define BOOST_TEST_MODULE crope
+#include <boost/test/included/unit_test.hpp>
+
+BOOST_AUTO_TEST_CASE( allocator_should_succeed )
+{
+ auto rope = ocl::crope("foo");
+ BOOST_TEST( rope.empty() == false );
+}