summaryrefslogtreecommitdiffhomepage
path: root/include/ocl/tproc/detail/rope_fwd.hpp
blob: 7a3d92a567e2c6080f2f7d537617e7481274de6c (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
58
59
60
61
62
63
64
// 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 <memory>
#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 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() = default;
  basic_rope(const boost::string_view& in = {});

private:
  struct impl;
  std::unique_ptr<impl> impl_;

#if !defined(OCL_ROPE_IMPL)
  struct impl {};
#endif
};

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

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

} // namespace ocl

#endif