Compare commits
No commits in common. "2bb04c64ea5a4047e0671bb8128310e869103876" and "6558ff487a3f27f41c5c6b3231bf0b93bc280b44" have entirely different histories.
2bb04c64ea
...
6558ff487a
|
@ -24,7 +24,7 @@ namespace CppUtilities {
|
||||||
/*!
|
/*!
|
||||||
* \brief Processes the specified \a buffer. Invokes the callback according to the remarks mentioned in the class documentation.
|
* \brief Processes the specified \a buffer. Invokes the callback according to the remarks mentioned in the class documentation.
|
||||||
*/
|
*/
|
||||||
void BufferSearch::operator()(const std::string_view::value_type *buffer, std::size_t bufferSize)
|
void BufferSearch::operator()(const char *buffer, std::size_t bufferSize)
|
||||||
{
|
{
|
||||||
if (m_hasResult || (!m_giveUpTerm.empty() && m_giveUpTermIterator == m_giveUpTerm.end())) {
|
if (m_hasResult || (!m_giveUpTerm.empty() && m_giveUpTermIterator == m_giveUpTerm.end())) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
#define IOUTILITIES_BUFFER_SEARCH_H
|
#define IOUTILITIES_BUFFER_SEARCH_H
|
||||||
|
|
||||||
#include "../global.h"
|
#include "../global.h"
|
||||||
#include "../misc/traits.h"
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
|
@ -17,9 +14,7 @@ public:
|
||||||
using CallbackType = std::function<void(BufferSearch &, std::string &&)>;
|
using CallbackType = std::function<void(BufferSearch &, std::string &&)>;
|
||||||
BufferSearch(std::string_view searchTerm, std::string_view terminationChars, std::string_view giveUpTerm, CallbackType &&callback);
|
BufferSearch(std::string_view searchTerm, std::string_view terminationChars, std::string_view giveUpTerm, CallbackType &&callback);
|
||||||
void operator()(std::string_view buffer);
|
void operator()(std::string_view buffer);
|
||||||
void operator()(const std::string_view::value_type *buffer, std::size_t bufferSize);
|
void operator()(const char *buffer, std::size_t bufferSize);
|
||||||
template <std::size_t bufferCapacity>
|
|
||||||
void operator()(std::shared_ptr<std::array<std::string_view::value_type, bufferCapacity>> buffer, std::size_t bufferSize);
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -59,15 +54,6 @@ inline void BufferSearch::operator()(std::string_view buffer)
|
||||||
(*this)(buffer.data(), buffer.size());
|
(*this)(buffer.data(), buffer.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Processes the specified \a buffer which is a shared array with fixed \tp bufferCapacity. Invokes the callback according to the remarks mentioned in the class documentation.
|
|
||||||
*/
|
|
||||||
template <std::size_t bufferCapacity>
|
|
||||||
inline void BufferSearch::operator()(std::shared_ptr<std::array<std::string_view::value_type, bufferCapacity>> buffer, std::size_t bufferSize)
|
|
||||||
{
|
|
||||||
(*this)(buffer->data(), bufferSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace CppUtilities
|
} // namespace CppUtilities
|
||||||
|
|
||||||
#endif // IOUTILITIES_BUFFER_SEARCH_H
|
#endif // IOUTILITIES_BUFFER_SEARCH_H
|
||||||
|
|
Loading…
Reference in New Issue