Open C++ Libraries.org develop
Loading...
Searching...
No Matches
rope_fwd.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// Copyright 2025-2026, Amlal El Mahrouss (amlal@nekernel.org)
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5// Official repository: https://github.com/open-cpp-libraries/tproc
6
7#ifndef OCL_TPROC_ROPE_FWD_HPP
8#define OCL_TPROC_ROPE_FWD_HPP
9
10#include <ocl/tproc/detail/config.hpp>
11
14
15namespace ocl::tproc
16{
17
21 template <class CharT, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT>>
22 class basic_rope final
23 {
24 public:
25 using traits_type = Traits;
26 using value_type = CharT;
27 using char_type = value_type;
28 using allocator_type = Allocator;
29 using size_type = std::allocator_traits<Allocator>::size_type;
30 using reference = CharT&;
31 using const_reference = const CharT&;
32 using pointer = std::allocator_traits<Allocator>::pointer;
33 using const_pointer = const std::allocator_traits<Allocator>::pointer;
35
36 rope_ptr rbegin();
37 rope_ptr rend();
38
39 rope_ptr begin();
40 rope_ptr end();
41
42 pointer operator*() const;
43 rope_ptr operator--();
44 rope_ptr operator--(int);
45 rope_ptr operator++();
46 rope_ptr operator++(int);
47
48 const rope_ptr cbegin() const;
49 const rope_ptr cend() const;
50
51 rope_ptr concat(rope_ptr right);
52
53 basic_rope<CharT, Traits, Allocator>& substr(size_type pos, const size_type n = 0);
54 size_type at(const boost::core::basic_string_view<CharT>& needle);
55
56 bool starts_with(const basic_rope<CharT>&);
57 bool ends_with(const basic_rope<CharT>&);
58
59 bool starts_with(const boost::core::basic_string_view<CharT>&);
60 bool ends_with(const boost::core::basic_string_view<CharT>&);
61
62 size_type size() const;
63 bool empty() const;
64
65 rope_ptr insert(size_type pos,
66 const boost::core::basic_string_view<CharT>&,
67 rope_ptr) const;
68
69 std::basic_string<value_type> to_string();
70 std::basic_string<value_type> to_string() const;
71
72 public:
73 basic_rope(const boost::core::basic_string_view<CharT>& in = {});
75
76 basic_rope& operator=(const basic_rope& rope) = delete;
77 basic_rope(const basic_rope& rope) = delete;
78
79 basic_rope& operator=(basic_rope&& rope);
80 basic_rope(basic_rope&& rope);
81
82 bool operator!=(const basic_rope& rope);
83 bool operator==(const basic_rope& rope);
84
85 bool operator!=(const boost::core::basic_string_view<CharT>&);
86 bool operator==(const boost::core::basic_string_view<CharT>&);
87
88 public:
89 static constexpr size_type npos = (size_type)(-1);
90
91 private:
92 struct tree_impl;
93 tree_impl* impl_{};
94 };
95
96#if __cplusplus >= 201811L
97 using u8rope = basic_rope<char8_t>;
98 using u16rope = basic_rope<char16_t>;
99#endif
100
101 using crope = basic_rope<char>;
103
104} // namespace ocl::tproc
105
106#include "rope_fwd.inl"
107
108#endif
This class implements a rope type for any CharT type.
Definition rope_fwd.hpp:23
AMLALE: SourcePair desrves documentation by themselves.
Definition bfs.hpp:13
PImpl of the rope algorithm.
Definition rope_fwd.inl:18