libhext: C++ Library Documentation  1.0.12-3ea013c
Public Member Functions | List of all members
hext::RegexPipe Class Referencefinal

Filters a string according to a given regex. More...

Inheritance diagram for hext::RegexPipe:
Inheritance graph
[legend]
Collaboration diagram for hext::RegexPipe:
Collaboration graph
[legend]

Public Member Functions

 RegexPipe (boost::regex regex)
 Constructs a RegexPipe from a boost::regex. More...
 
std::string transform (std::string str) const override
 Filters the string according to the regex given in the constructor. More...
 
- Public Member Functions inherited from hext::Cloneable< RegexPipe, StringPipe >
virtual std::unique_ptr< StringPipeclone () const override
 Clones objects of template type Derived and returns an owning pointer to the newly allocated Base. More...
 
- Public Member Functions inherited from hext::StringPipe
 StringPipe () noexcept
 
 StringPipe (const StringPipe &other)
 
 StringPipe (StringPipe &&) noexcept=default
 
StringPipeoperator= (const StringPipe &other)
 
StringPipeoperator= (StringPipe &&) noexcept=default
 
virtual ~StringPipe () noexcept=default
 
std::string pipe (std::string str) const
 Calls StringPipe::transform successively until the whole StringPipe chain was traversed. More...
 
void append (std::unique_ptr< StringPipe > pipe) noexcept
 Append a StringPipe at the end of the chain. More...
 
template<typename StringPipeType , typename... Args>
void emplace (Args &&... arg)
 Construct a StringPipe at the end of the chain. More...
 

Detailed Description

Filters a string according to a given regex.

Regex behavior:
A regex containing a capture group will produce only the matched content of that capture group, otherwise the whole regex match is returned. All capture groups after the first one will be ignored.
Example regex:
Input Regex Result
Highway 61 revisited \d+ 61
Highway 61 revisited Highway \d+ Highway 61
Highway 61 revisited Highway (\d+) 61
Highway 61 revisited \w+ Highway
Highway 61 revisited (\w+) (\d+) Highway (not an error)

Definition at line 49 of file RegexPipe.h.

Constructor & Destructor Documentation

◆ RegexPipe()

hext::RegexPipe::RegexPipe ( boost::regex  regex)
explicit

Constructs a RegexPipe from a boost::regex.

Parameters
regexA regular expression that is applied to the string. See RegexPipeBehavior.

Member Function Documentation

◆ transform()

std::string hext::RegexPipe::transform ( std::string  str) const
overridevirtual

Filters the string according to the regex given in the constructor.

See RegexPipeBehavior.

Implements hext::StringPipe.


The documentation for this class was generated from the following file: