summaryrefslogtreecommitdiffhomepage
path: root/include/ocl/tproc/detail/rope_fwd.hpp
blob: c9c356789ec1e9e766043488565c9b027354b731 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// 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_HPP
#define OCL_TPROC_ROPE_FWD_HPP

#include <boost/utility/string_view.hpp>
#include <memory>

/// \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 final {
public:
  using traits_type = Traits;
  using value_type = CharT;
  using allocator_type = Allocator;
  using size_type = std::allocator_traits<Allocator>::size_type;
  using reference = CharT &;
  using const_reference = const CharT &;
  using pointer = std::allocator_traits<Allocator>::pointer;
  using const_pointer = std::allocator_traits<Allocator>::pointer;

  CharT *begin();
  CharT *end();
  size_type size();
  bool empty() const;

  ~basic_rope();
  basic_rope(const boost::basic_string_view<CharT> &in = {});

private:
  struct tree_impl;
  std::unique_ptr<tree_impl> impl_;
};

#if __cplusplus >= 201811L
using u8rope = basic_rope<char8_t>;
#endif

using crope = basic_rope<char>;
using wrope = basic_rope<wchar_t>;

} // namespace ocl

#include "rope_fwd.inl"

#endif