From 5d69778988ed44f62edbaaa4f95cf8dcdb0e8b45 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 24 Dec 2025 11:41:44 +0100 Subject: feat! final API design for basic_rope. Signed-off-by: Amlal El Mahrouss --- include/ocl/tproc/detail/rope_fwd.hpp | 19 +++++++------------ include/ocl/tproc/detail/rope_fwd.inl | 20 ++++++++++++++++++++ src/tproc/rope_impl.cpp | 7 ------- test/rope_test/crope.test.cpp | 7 +++---- 4 files changed, 30 insertions(+), 23 deletions(-) create mode 100644 include/ocl/tproc/detail/rope_fwd.inl delete mode 100644 src/tproc/rope_impl.cpp diff --git a/include/ocl/tproc/detail/rope_fwd.hpp b/include/ocl/tproc/detail/rope_fwd.hpp index f46d0f4..c9c3567 100644 --- a/include/ocl/tproc/detail/rope_fwd.hpp +++ b/include/ocl/tproc/detail/rope_fwd.hpp @@ -6,8 +6,8 @@ #ifndef OCL_TPROC_ROPE_FWD_HPP #define OCL_TPROC_ROPE_FWD_HPP -#include #include +#include /// \file rope_fwd.hpp /// \brief Basic forward definitions of the `rope` type. @@ -31,23 +31,16 @@ public: using const_pointer = std::allocator_traits::pointer; CharT *begin(); - CharT *end(); - size_type size(); - bool empty() const; - ~basic_rope() = default; - basic_rope(const boost::string_view& in = {}); + ~basic_rope(); + basic_rope(const boost::basic_string_view &in = {}); private: - struct impl; - std::unique_ptr impl_; - -#if !defined(OCL_ROPE_IMPL) - struct impl {}; -#endif + struct tree_impl; + std::unique_ptr impl_; }; #if __cplusplus >= 201811L @@ -59,4 +52,6 @@ using wrope = basic_rope; } // namespace ocl +#include "rope_fwd.inl" + #endif diff --git a/include/ocl/tproc/detail/rope_fwd.inl b/include/ocl/tproc/detail/rope_fwd.inl new file mode 100644 index 0000000..5ca6bf4 --- /dev/null +++ b/include/ocl/tproc/detail/rope_fwd.inl @@ -0,0 +1,20 @@ +// 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_FWD_INL +#define OCL_TPROC_ROPE_FWD_INL + +namespace ocl { + +template struct basic_rope::tree_impl {}; + +template basic_rope::~basic_rope() = default; + +template +basic_rope::basic_rope(const boost::basic_string_view &in) {} + +} // namespace ocl + +#endif \ No newline at end of file diff --git a/src/tproc/rope_impl.cpp b/src/tproc/rope_impl.cpp deleted file mode 100644 index 2e5cdf2..0000000 --- a/src/tproc/rope_impl.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// 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 - -#define OCL_ROPE_IMPL 1 -#include diff --git a/test/rope_test/crope.test.cpp b/test/rope_test/crope.test.cpp index e1885f4..f454e12 100644 --- a/test/rope_test/crope.test.cpp +++ b/test/rope_test/crope.test.cpp @@ -10,8 +10,7 @@ #define BOOST_TEST_MODULE crope #include -BOOST_AUTO_TEST_CASE( allocator_should_succeed ) -{ - auto rope = ocl::crope("foo"); - BOOST_TEST( rope.empty() == false ); +BOOST_AUTO_TEST_CASE(allocator_should_succeed) { + auto rope = ocl::crope("foo"); + BOOST_TEST(rope.empty() == false); } -- cgit v1.2.3