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

Abstract base for every StringPipe. More...

Inheritance diagram for hext::StringPipe:
Inheritance graph
[legend]

Public Member Functions

 StringPipe () noexcept
 
 StringPipe (const StringPipe &other)
 
 StringPipe (StringPipe &&) noexcept=default
 
StringPipeoperator= (const StringPipe &other)
 
StringPipeoperator= (StringPipe &&) noexcept=default
 
virtual ~StringPipe () noexcept=default
 
virtual std::unique_ptr< StringPipeclone () const =0
 Clones derived object. More...
 
virtual std::string transform (std::string str) const =0
 Transforms str. More...
 
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

Abstract base for every StringPipe.

A StringPipe transforms a given string into another one, for example a TrimPipe removes all left and right whitespace from a string. StringPipes can be chained ("linked list").

Note: You probably don't want to inherit from this class directly, unless you want to provide your own StringPipe::clone() method. If your subclass has a copy constructor, you can extend from hext::Cloneable<YourSubclass, hext::StringPipe> which provides a generic clone method.

Definition at line 40 of file StringPipe.h.

Constructor & Destructor Documentation

◆ StringPipe() [1/3]

hext::StringPipe::StringPipe ( )
noexcept

◆ StringPipe() [2/3]

hext::StringPipe::StringPipe ( const StringPipe other)

◆ StringPipe() [3/3]

hext::StringPipe::StringPipe ( StringPipe &&  )
defaultnoexcept

◆ ~StringPipe()

virtual hext::StringPipe::~StringPipe ( )
virtualdefaultnoexcept

Member Function Documentation

◆ append()

void hext::StringPipe::append ( std::unique_ptr< StringPipe pipe)
noexcept

Append a StringPipe at the end of the chain.

◆ clone()

virtual std::unique_ptr<StringPipe> hext::StringPipe::clone ( ) const
pure virtual

◆ emplace()

template<typename StringPipeType , typename... Args>
void hext::StringPipe::emplace ( Args &&...  arg)
inline

Construct a StringPipe at the end of the chain.

Definition at line 70 of file StringPipe.h.

◆ operator=() [1/2]

StringPipe& hext::StringPipe::operator= ( const StringPipe other)

◆ operator=() [2/2]

StringPipe& hext::StringPipe::operator= ( StringPipe &&  )
defaultnoexcept

◆ pipe()

std::string hext::StringPipe::pipe ( std::string  str) const

Calls StringPipe::transform successively until the whole StringPipe chain was traversed.

Returns
The result of applying this StringPipe and every connected one to str.

◆ transform()

virtual std::string hext::StringPipe::transform ( std::string  str) const
pure virtual

Transforms str.

Note: Use StringPipe::pipe to apply all transformations in this chain.

Implemented in hext::TrimPipe, hext::RegexReplacePipe, hext::RegexPipe, hext::PrependPipe, hext::CollapseWsPipe, hext::CasePipe, and hext::AppendPipe.


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