31 #ifndef WRAPPER_TIDYBUFFER_HPP_ 32 #define WRAPPER_TIDYBUFFER_HPP_ 34 #include <tidybuffio.h> 68 [[nodiscard]] const ::TidyBuffer *
getc()
const noexcept;
69 [[nodiscard]] std::string
getString()
const noexcept;
70 [[nodiscard]]
bool valid()
const noexcept;
71 [[nodiscard]] std::size_t
size()
const noexcept;
72 [[nodiscard]]
bool empty()
const noexcept;
73 [[nodiscard]] std::size_t
capacity()
const noexcept;
79 void clear() noexcept;
120 return &(this->buffer);
128 return &(this->buffer);
137 if(this->buffer.bp ==
nullptr || this->buffer.
size == 0) {
142 static_cast<const char *>(static_cast<void *>(this->buffer.bp)),
156 return this->buffer.bp !=
nullptr;
171 return this->buffer.
size;
186 return this->buffer.allocated;
196 return this->buffer.bp ==
nullptr || this->buffer.
size == 0;
210 if(this->buffer.bp !=
nullptr) {
211 tidyBufFree(&(this->buffer));
232 if(other.buffer.allocator !=
nullptr) {
233 ::tidyBufAllocWithAllocator(
235 other.buffer.allocator,
279 if(other.buffer.allocator !=
nullptr) {
280 ::tidyBufAllocWithAllocator(
282 other.buffer.allocator,
319 this->buffer = other.buffer;
321 other.buffer.allocator =
nullptr;
322 other.buffer.bp =
nullptr;
323 other.buffer.
size = 0;
324 other.buffer.allocated = 0;
325 other.buffer.next = 0;
348 this->buffer = other.buffer;
350 other.buffer.allocator =
nullptr;
351 other.buffer.bp =
nullptr;
352 other.buffer.
size = 0;
353 other.buffer.allocated = 0;
354 other.buffer.next = 0;
std::size_t size() const noexcept
Gets the current size of the content in the underlying buffer in bytes.
Definition: TidyBuffer.hpp:170
const ::TidyBuffer * getc() const noexcept
Gets a const pointer to the underlying buffer.
Definition: TidyBuffer.hpp:127
::TidyBuffer * get() noexcept
Gets a pointer to the underlying buffer.
Definition: TidyBuffer.hpp:119
bool valid() const noexcept
Checks whether the underlying buffer is valid.
Definition: TidyBuffer.hpp:155
bool empty() const noexcept
Checks whether the underlying buffer is empty.
Definition: TidyBuffer.hpp:195
TidyBuffer & operator=(const TidyBuffer &other)
Copy assignment operator.
Definition: TidyBuffer.hpp:272
RAII wrapper for buffers used by the tidy-html5 API.
Definition: TidyBuffer.hpp:53
virtual ~TidyBuffer()
Destructor clearing the underlying buffer if necessary.
Definition: TidyBuffer.hpp:107
std::string getString() const noexcept
Copies the content of the underlying buffer into a string.
Definition: TidyBuffer.hpp:136
void clear() noexcept
Frees the underlying buffer.
Definition: TidyBuffer.hpp:209
Namespace for RAII wrappers and Wrapper::Database.
Definition: Database.hpp:109
std::size_t capacity() const noexcept
Gets the current capacity of the underlying buffer in bytes.
Definition: TidyBuffer.hpp:185
TidyBuffer()=default
Default constructor.