|
crawlserv++
[under development]
Application for crawling and analyzing textual content of websites.
|
RAII wrapper for buffers used by the tidy-html5 API. More...
#include <TidyBuffer.hpp>
Construction and Destruction | |
| TidyBuffer ()=default | |
| Default constructor. More... | |
| virtual | ~TidyBuffer () |
| Destructor clearing the underlying buffer if necessary. More... | |
Getters | |
| ::TidyBuffer * | get () noexcept |
| Gets a pointer to the underlying buffer. More... | |
| const ::TidyBuffer * | getc () const noexcept |
| Gets a const pointer to the underlying buffer. More... | |
| std::string | getString () const noexcept |
| Copies the content of the underlying buffer into a string. More... | |
| bool | valid () const noexcept |
| Checks whether the underlying buffer is valid. More... | |
| std::size_t | size () const noexcept |
| Gets the current size of the content in the underlying buffer in bytes. More... | |
| bool | empty () const noexcept |
| Checks whether the underlying buffer is empty. More... | |
| std::size_t | capacity () const noexcept |
| Gets the current capacity of the underlying buffer in bytes. More... | |
Cleanup | |
| void | clear () noexcept |
| Frees the underlying buffer. More... | |
Copy and Move | |
| TidyBuffer (const TidyBuffer &other) | |
| Copy constructor. More... | |
| TidyBuffer & | operator= (const TidyBuffer &other) |
| Copy assignment operator. More... | |
| TidyBuffer (TidyBuffer &&other) noexcept | |
| Move constructor. More... | |
| TidyBuffer & | operator= (TidyBuffer &&other) noexcept |
| Move assignment operator. More... | |
RAII wrapper for buffers used by the tidy-html5 API.
Zeroes the buffer on construction and automatically clears it on destruction, avoiding memory leaks.
At the moment, this class is used exclusively by TidyDoc.
|
default |
Default constructor.
|
inlinevirtual |
Destructor clearing the underlying buffer if necessary.
References clear().
|
inline |
Copy constructor.
Allocates the same amount of memory as the capacity() of the other buffer and copies its content.
| other | The buffer to copy from. |
|
inlinenoexcept |
|
inlinenoexcept |
Gets the current capacity of the underlying buffer in bytes.
Referenced by operator=().
|
inlinenoexcept |
Frees the underlying buffer.
The buffer will be invalid and valid() will return false afterwards.
Referenced by crawlservpp::Wrapper::TidyDoc::cleanAndRepair(), crawlservpp::Wrapper::TidyDoc::getOutput(), operator=(), crawlservpp::Wrapper::TidyDoc::parse(), and ~TidyBuffer().
|
inlinenoexcept |
Checks whether the underlying buffer is empty.
References size().
Referenced by crawlservpp::Wrapper::TidyDoc::cleanAndRepair(), crawlservpp::Wrapper::TidyDoc::getOutput(), operator=(), and crawlservpp::Wrapper::TidyDoc::parse().
|
inlinenoexcept |
Gets a pointer to the underlying buffer.
Referenced by crawlservpp::Wrapper::TidyDoc::getOutput(), and crawlservpp::Wrapper::TidyDoc::TidyDoc().
|
inlinenoexcept |
Gets a const pointer to the underlying buffer.
|
inlinenoexcept |
Copies the content of the underlying buffer into a string.
References size().
Referenced by crawlservpp::Wrapper::TidyDoc::cleanAndRepair(), crawlservpp::Wrapper::TidyDoc::getOutput(), and crawlservpp::Wrapper::TidyDoc::parse().
|
inline |
Copy assignment operator.
Clears the existing buffer, allocates the same amount of memory as capacity() of the other buffer and copies its content.
| other | The buffer to copy from. |
References capacity(), clear(), empty(), size(), and valid().
|
inlinenoexcept |
Move assignment operator.
Moves the buffer from the specified location into this instance of the class.
| other | The buffer to move from. |
|
inlinenoexcept |
Gets the current size of the content in the underlying buffer in bytes.
References size().
Referenced by empty(), getString(), operator=(), size(), and TidyBuffer().
|
inlinenoexcept |
Checks whether the underlying buffer is valid.
Referenced by crawlservpp::Wrapper::TidyDoc::cleanAndRepair(), crawlservpp::Wrapper::TidyDoc::getOutput(), operator=(), and crawlservpp::Wrapper::TidyDoc::parse().