// SPDX-License-Identifier: BSL-1.0 // Copyright 2025-2026, 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-foss-org/tproc #ifndef OCL_TPROC_ROPE_FWD_HPP #define OCL_TPROC_ROPE_FWD_HPP #include /// \file rope_fwd.hpp /// \brief Basic forward definitions of the `rope` type. namespace ocl::tproc { /// \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 Allocator = std::allocator> class basic_rope final { public: using traits_type = Traits; using value_type = CharT; using char_type = value_type; using allocator_type = Allocator; using size_type = std::allocator_traits::size_type; using reference = CharT&; using const_reference = const CharT&; using pointer = std::allocator_traits::pointer; using const_pointer = const std::allocator_traits::pointer; using rope_ptr = basic_rope*; rope_ptr rbegin(); rope_ptr rend(); rope_ptr begin(); rope_ptr end(); pointer operator*() const; rope_ptr operator--(); rope_ptr operator--(int); rope_ptr operator++(); rope_ptr operator++(int); const rope_ptr cbegin() const; const rope_ptr cend() const; rope_ptr concat(rope_ptr right); basic_rope& substr(size_type pos, const size_type n = 0); size_type at(const boost::core::basic_string_view& needle); bool starts_with(const basic_rope&); bool ends_with(const basic_rope&); bool starts_with(const boost::core::basic_string_view&); bool ends_with(const boost::core::basic_string_view&); size_type size() const; bool empty() const; rope_ptr insert(size_type pos, const boost::core::basic_string_view&, rope_ptr) const; std::basic_string to_string(); std::basic_string to_string() const; public: basic_rope(const boost::core::basic_string_view& in = {}); ~basic_rope(); basic_rope& operator=(const basic_rope& rope) = delete; basic_rope(const basic_rope& rope) = delete; basic_rope& operator=(basic_rope&& rope); basic_rope(basic_rope&& rope); bool operator!=(const basic_rope& rope); bool operator==(const basic_rope& rope); bool operator!=(const boost::core::basic_string_view&); bool operator==(const boost::core::basic_string_view&); public: static constexpr size_type npos = (size_type)(-1); private: struct tree_impl; tree_impl* impl_{}; }; #if __cplusplus >= 201811L using u8rope = basic_rope; using u16rope = basic_rope; #endif using crope = basic_rope; using wrope = basic_rope; } // namespace ocl::tproc #include "rope_fwd.inl" #endif