C++ Utilities 5.26.1
Useful C++ classes and routines such as argument parser, IO and conversion utilities
|
The BufferSearch struct invokes a callback if an initially given search term occurs in consecutively provided buffers. More...
#include <buffersearch.h>
Public Types | |
using | CallbackType = std::function<void(BufferSearch &, std::string &&)> |
Public Member Functions | |
BufferSearch (std::string_view searchTerm, std::string_view terminationChars, std::string_view giveUpTerm, CallbackType &&callback) | |
Constructs a new BufferSearch. | |
void | operator() (std::string_view buffer) |
Processes the specified buffer. | |
void | operator() (const std::string_view::value_type *buffer, std::size_t bufferSize) |
Processes the specified buffer. | |
template<std::size_t bufferCapacity> | |
void | operator() (std::shared_ptr< std::array< std::string_view::value_type, bufferCapacity > > buffer, std::size_t bufferSize) |
Processes the specified buffer which is a shared array with fixed. | |
const std::string_view::value_type * | process (std::string_view buffer) |
Processes the specified buffer. | |
const std::string_view::value_type * | process (const std::string_view::value_type *buffer, std::size_t bufferSize) |
Processes the specified buffer. | |
void | reset () |
Resets the search to its initial state (assuming no characters of the search term or give-up term have been found yet). | |
std::string & | result () |
Returns the search result at this point. | |
const std::string & | result () const |
Returns the search result at this point. | |
The BufferSearch struct invokes a callback if an initially given search term occurs in consecutively provided buffers.
Definition at line 15 of file buffersearch.h.
using CppUtilities::BufferSearch::CallbackType = std::function<void(BufferSearch &, std::string &&)> |
Definition at line 17 of file buffersearch.h.
|
inline |
Constructs a new BufferSearch.
Might be overloaded in the future.
Definition at line 45 of file buffersearch.h.
void CppUtilities::BufferSearch::operator() | ( | const std::string_view::value_type * | buffer, |
std::size_t | bufferSize ) |
Processes the specified buffer.
Invokes the callback according to the remarks mentioned in the class documentation.
Definition at line 80 of file buffersearch.cpp.
|
inline |
Processes the specified buffer which is a shared array with fixed.
bufferCapacity. | Invokes the callback according to the remarks mentioned in the class documentation. |
Definition at line 70 of file buffersearch.h.
|
inline |
Processes the specified buffer.
Invokes the callback according to the remarks mentioned in the class documentation.
Definition at line 61 of file buffersearch.h.
const std::string_view::value_type * CppUtilities::BufferSearch::process | ( | const std::string_view::value_type * | buffer, |
std::size_t | bufferSize ) |
Processes the specified buffer.
Invokes the callback according to the remarks mentioned in the class documentation.
Definition at line 32 of file buffersearch.cpp.
|
inline |
Processes the specified buffer.
Invokes the callback according to the remarks mentioned in the class documentation.
Definition at line 79 of file buffersearch.h.
void CppUtilities::BufferSearch::reset | ( | ) |
Resets the search to its initial state (assuming no characters of the search term or give-up term have been found yet).
Definition at line 88 of file buffersearch.cpp.
|
inline |
Returns the search result at this point.
Definition at line 87 of file buffersearch.h.
|
inline |
Returns the search result at this point.
Definition at line 95 of file buffersearch.h.