4#ifndef PODOFO_BASE_TYPES_H
5#define PODOFO_BASE_TYPES_H
33 template <
typename =
void>
42 std::string::resize(size);
45 : std::string(std::move(str)) { }
47 : std::string(str, size) { }
49 : std::string(view.data(), view.size()) { }
50 explicit charbuff_t(
const std::string_view& view)
51 : std::string(view) { }
53 : std::string(str) { }
57 charbuff_t& operator=(
const std::string_view & view)
59 std::string::assign(view.data(), view.size());
64 std::string::assign(str.data(), str.size());
69 std::string::assign(view.data(), view.size());
72 charbuff_t& operator=(std::string&& str)
noexcept
74 std::string::operator=(std::move(str));
79 return static_cast<const std::string&
>(*this) ==
static_cast<const std::string&
>(rhs);
82 size_t length()
const =
delete;
85 template <
typename =
void>
86 bool operator==(
const charbuff_t<>& lhs,
const char* rhs)
88 return static_cast<const std::string&
>(lhs) == rhs;
91 template <
typename =
void>
92 bool operator==(
const char* lhs,
const charbuff_t<>& rhs)
94 return lhs ==
static_cast<const std::string&
>(rhs);
97 template <
typename =
void>
98 bool operator==(
const charbuff_t<>& lhs,
const bufferview& rhs)
100 return static_cast<const std::string&
>(lhs) == std::string_view(rhs.data(), rhs.size());
103 template <
typename =
void>
104 bool operator==(
const bufferview& lhs,
const charbuff_t<>& rhs)
106 return std::string_view(lhs.data(), lhs.size()) ==
static_cast<const std::string&
>(rhs);
109 template <
typename =
void>
110 bool operator==(
const charbuff_t<>& lhs,
const std::string_view& rhs)
noexcept
112 return std::string_view(lhs) == rhs;
115 template <
typename =
void>
116 bool operator==(
const std::string_view& lhs,
const charbuff_t<>& rhs)
noexcept
118 return lhs == std::string_view(rhs);
121 template <
typename =
void>
122 bool operator==(
const charbuff_t<>& lhs,
const std::string& rhs)
noexcept
124 return static_cast<const std::string&
>(lhs) == rhs;
127 template <
typename =
void>
128 bool operator==(
const std::string& lhs,
const charbuff_t<>& rhs)
noexcept
130 return lhs ==
static_cast<const std::string&
>(rhs);
133 using charbuff = charbuff_t<>;
139 template <
typename =
void>
149 : m_buff(std::move(
buff)), m_view(*m_buff) { }
151 : m_buff(std::move(
buff)), m_view(*m_buff) { }
153 : m_buff(std::move(
buff)), m_view(*m_buff) { }
155 : m_buff(std::move(
buff)), m_view(*m_buff) { }
157 const bufferview& view()
const {
return m_view; }
159 std::shared_ptr<const charbuff_t<>> m_buff;
166 template <
class... T>
167 constexpr bool always_false =
false;
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:35
A const data provider that can hold a view to a static segments or a shared buffer.
Definition basetypes.h:141
All classes, functions, types and enums of PoDoFo are members of these namespace.
Definition basetypes.h:13
cspan< char32_t > unicodeview
Unicode code point view.
Definition basetypes.h:24
tcb::span< const T, Extent > cspan
Constant span.
Definition span.h:19
mspan< char > bufferspan
Convenient writable char buffer span.
Definition basetypes.h:20
tcb::span< T, Extent > mspan
Mutable span.
Definition span.h:24
cspan< char > bufferview
Convenient read-only char buffer span.
Definition basetypes.h:16