Kanzi Framework  3.9.0
Kanzi Engine API
kanzi::SplitStringRange Class Reference

SplitStringRange is a range that iteratively performs a string split. More...

#include <kanzi/core.ui/binding/split_string_range.hpp>

Inheritance diagram for kanzi::SplitStringRange:
[legend]

Classes

struct  SplitPosition
 String position. More...
 
class  SplitStringRangeLocation
 Location implementation for split string range. More...
 

Public Member Functions

void assignString (string_view inputString, string_view delimiter)
 Assign a new string. More...
 
SplitPosition nextSplitPosition (size_t pos, bool delim) const
 Initializes the string to the next valid location. More...
 
SplitPosition nextSplitPosition (const SplitPosition &splitPos) const
 Wrapper to nextSplitPosition that uses the input split position for advancing. More...
 
string substr (size_t pos, size_t len) const
 Returns a sub-string from the internal test. More...
 
- Public Member Functions inherited from kanzi::AbstractRange
AbstractRangeIterator beginIteration ()
 Gets an iterator to the beginning of this range. More...
 
AbstractRangeSharedPtr createView (size_t length)
 Creates a view over this range. More...
 
AbstractRangeSharedPtr evaluate ()
 Evaluate the abstract range. More...
 
AbstractRangeLocationPtr locationBegin ()
 Gets an iteratable location to beginning of the range. More...
 
virtual ~AbstractRange ()=default
 Destructor. More...
 

Static Public Member Functions

static SplitStringRangeSharedPtr create (string_view inputString, string_view delimiter)
 Creates a new split string range. More...
 

Protected Member Functions

AbstractRangeSharedPtr evaluateOverride () override
 AbstractRange::evaluateOverride() implementation. More...
 
AbstractRangeLocationPtr locationBeginOverride () override
 AbstractRange::locationBeginOverride() implementation. More...
 
 SplitStringRange (string_view inputString, string_view delimiter)
 Constructor. More...
 
- Protected Member Functions inherited from kanzi::AbstractRange
 AbstractRange ()=default
 Constructor. More...
 
virtual AbstractRangeSharedPtr createViewOverride (size_t length)
 Implementation-dependent view over the range. More...
 

Protected Attributes

string m_delimiter
 Delimiter. More...
 
SplitPosition m_splitPos
 Split position. More...
 
string m_text
 Text to split. More...
 

Detailed Description

SplitStringRange is a range that iteratively performs a string split.

The string is split in a lazy manner, without creating storage for all the words separately.

Since
Kanzi 3.9.0

Constructor & Destructor Documentation

◆ SplitStringRange()

kanzi::SplitStringRange::SplitStringRange ( string_view  inputString,
string_view  delimiter 
)
explicitprotected

Constructor.

Parameters
inputStringInput string to split.
delimiterSplit delimiter.

Member Function Documentation

◆ create()

static SplitStringRangeSharedPtr kanzi::SplitStringRange::create ( string_view  inputString,
string_view  delimiter 
)
static

Creates a new split string range.

Parameters
inputStringInput string to split.
delimiterSplit delimiter.
Returns
Iterator range shared pointer.

◆ assignString()

void kanzi::SplitStringRange::assignString ( string_view  inputString,
string_view  delimiter 
)

Assign a new string.

Called to reuse the split string range without destroying the range.

Parameters
inputStringInput string to split.
delimiterSplit delimiter.

◆ nextSplitPosition() [1/2]

SplitPosition kanzi::SplitStringRange::nextSplitPosition ( size_t  pos,
bool  delim 
) const

Initializes the string to the next valid location.

Parameters
posPosition to start looking for the next string.
delimIf delimiter was the last thing read true, otherwise false.
Returns
Next split position.

◆ nextSplitPosition() [2/2]

SplitPosition kanzi::SplitStringRange::nextSplitPosition ( const SplitPosition splitPos) const
inline

Wrapper to nextSplitPosition that uses the input split position for advancing.

Parameters
splitPosPrevious split position.
Returns
Next split position.

◆ substr()

string kanzi::SplitStringRange::substr ( size_t  pos,
size_t  len 
) const
inline

Returns a sub-string from the internal test.

Parameters
posPosition into string.
lenLength of substring.

◆ evaluateOverride()

AbstractRangeSharedPtr kanzi::SplitStringRange::evaluateOverride ( )
overrideprotectedvirtual

AbstractRange::evaluateOverride() implementation.

Reimplemented from kanzi::AbstractRange.

◆ locationBeginOverride()

AbstractRangeLocationPtr kanzi::SplitStringRange::locationBeginOverride ( )
overrideprotectedvirtual

Member Data Documentation

◆ m_text

string kanzi::SplitStringRange::m_text
protected

Text to split.

◆ m_delimiter

string kanzi::SplitStringRange::m_delimiter
protected

Delimiter.

◆ m_splitPos

SplitPosition kanzi::SplitStringRange::m_splitPos
protected

Split position.


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