4#ifndef PODOFO_BASE_TYPES_H
5#define PODOFO_BASE_TYPES_H
28 template <
typename =
void>
37 std::string::resize(size);
40 : std::string(std::move(str)) { }
42 : std::string(str, size) { }
44 : std::string(view.data(), view.size()) { }
45 explicit charbuff_t(
const std::string_view& view)
46 : std::string(view) { }
48 : std::string(str) { }
52 charbuff_t& operator=(
const std::string_view & view)
54 std::string::assign(view.data(), view.size());
59 std::string::assign(str.data(), str.size());
64 std::string::assign(view.data(), view.size());
67 charbuff_t& operator=(std::string&& str)
noexcept
69 std::string::operator=(std::move(str));
74 return static_cast<const std::string&
>(*this) ==
static_cast<const std::string&
>(rhs);
77 size_t length()
const =
delete;
80 template <
typename =
void>
81 bool operator==(
const charbuff_t<>& lhs,
const char* rhs)
83 return static_cast<const std::string&
>(lhs) == rhs;
86 template <
typename =
void>
87 bool operator==(
const char* lhs,
const charbuff_t<>& rhs)
89 return lhs ==
static_cast<const std::string&
>(rhs);
92 template <
typename =
void>
93 bool operator==(
const charbuff_t<>& lhs,
const bufferview& rhs)
95 return static_cast<const std::string&
>(lhs) == std::string_view(rhs.data(), rhs.size());
98 template <
typename =
void>
99 bool operator==(
const bufferview& lhs,
const charbuff_t<>& rhs)
101 return std::string_view(lhs.data(), lhs.size()) ==
static_cast<const std::string&
>(rhs);
104 template <
typename =
void>
105 bool operator==(
const charbuff_t<>& lhs,
const std::string_view& rhs)
noexcept
107 return std::string_view(lhs) == rhs;
110 template <
typename =
void>
111 bool operator==(
const std::string_view& lhs,
const charbuff_t<>& rhs)
noexcept
113 return lhs == std::string_view(rhs);
116 template <
typename =
void>
117 bool operator==(
const charbuff_t<>& lhs,
const std::string& rhs)
noexcept
119 return static_cast<const std::string&
>(lhs) == rhs;
122 template <
typename =
void>
123 bool operator==(
const std::string& lhs,
const charbuff_t<>& rhs)
noexcept
125 return lhs ==
static_cast<const std::string&
>(rhs);
128 using charbuff = charbuff_t<>;
133 template <
typename =
void>
143 : m_buff(std::move(
buff)), m_view(*m_buff) { }
145 : m_buff(std::move(
buff)), m_view(*m_buff) { }
147 : m_buff(std::move(
buff)), m_view(*m_buff) { }
149 : m_buff(std::move(
buff)), m_view(*m_buff) { }
151 const bufferview& view()
const {
return m_view; }
153 std::shared_ptr<const charbuff_t<>> m_buff;
160 template <
class... T>
161 constexpr bool always_false =
false;
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:30
A const data provider that can hold a view to a static segments or a shared buffer.
Definition basetypes.h:135
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:21
tcb::span< const T, Extent > cspan
Constant span.
Definition span.h:18
mspan< char > bufferspan
Convenient writable char buffer span.
Definition basetypes.h:18
tcb::span< T, Extent > mspan
Mutable span.
Definition span.h:22
cspan< char > bufferview
Convenient read-only char buffer span.
Definition basetypes.h:15