MeVisLab Toolbox Reference
ml::StringLineFilterFieldAddOn Class Reference

Class implementing the StringLineFilterFieldAddOn which manages fields for line based filtering of a text string. More...

#include <mlStringLineFilterFieldAddOn.h>

Inheritance diagram for ml::StringLineFilterFieldAddOn:
ml::FieldAddOnBase

Public Types

enum  { NumFilters = 2 }
 The number of currently supported filter expressions. More...
 
- Public Types inherited from ml::FieldAddOnBase
enum  FieldChangeState { NoChange = 0 , StatusOnlyChange , RecalculationRequired }
 Describes the type of a field changes detected in handleFieldChanges(Field *field). More...
 

Public Member Functions

 StringLineFilterFieldAddOn (FieldContainer &fieldContainerRef)
 Constructor, setting the reference of the FieldContainer managing the fields. More...
 
void addFields () override
 Add fields to field container of module. More...
 
void handleFieldActivationChanges () override
 Do the activateAttachment-like stuff in this method. More...
 
FieldAddOnBase::FieldChangeState handleFieldChanges (Field *field) override
 Handle field notifications. More...
 
void filterString (const std::string &stringToBeFiltered)
 Update the filter results according to the new string stringToBeFiltered; the string is not copied nor stored. More...
 
- Public Member Functions inherited from ml::FieldAddOnBase
 FieldAddOnBase (FieldContainer &fieldContainerRef)
 Constructor, setting the reference of the FieldContainer managing the fields. More...
 
virtual ~FieldAddOnBase ()
 Destructor. More...
 
FieldContainergetFieldContainer ()
 Returns the referenced container. More...
 
const FieldContainergetFieldContainer () const
 Returns the referenced container. More...
 
std::vector< Field * > & getFields ()
 Return modification access to the list of managed fields, use at own risk! More...
 
const std::vector< Field * > & getFields () const
 Return constant access to the list of managed fields! More...
 
virtual FieldChangeState getMergedFieldChangeState (FieldChangeState state1, FieldChangeState state2) const
 Returns a FieldChangeState which best represents a merge of the two given states. More...
 
virtual bool hasField (Field *field) const
 Returns true if the passed fieldPtr is in _fieldPointers, otherwise false. More...
 

Static Public Member Functions

static ReleaseToolsIO::StringVector determineFilterLines (const std::string &inString, bool simplify)
 Searches lines in inStr which match a prefix expression followed somewhere later by a post fix expression and return the value between. More...
 

Protected Attributes

The managed fields.
BoolField_compressWhiteSpacesFld
 If true then all white spaces are replaced by spaces and multiple occurrences are compressed to single ones. More...
 
BoolField_useRegularExpressionFld [NumFilters]
 If disabled then the content of _firstExpressionFld is used as line start, otherwise it is interpreted as regular expression which must match the searched line. More...
 
StringField_firstExpressionFld [NumFilters]
 Expression which must match the line begin section before the desired value starts if _useRegularExpressionFld is off, otherwise it is the regular which must match the line. More...
 
StringField_lineEndFld [NumFilters]
 Expression which must match the line section after the desired value starts. More...
 
IntField_occurenceFld [NumFilters]
 Selects which matched line shall be used for output, 0=first, -1=last. More...
 
StringField_foundValue1Fld [NumFilters]
 The value found between firstExpression and lineEnd or empty if not found. More...
 
BoolField_foundValue1IsValidFld [NumFilters]
 True if a value between firstExpression and lineEnd was found, otherwise false. More...
 
StringField_foundValue2Fld [NumFilters]
 The second match value of a regular expression is valid, otherwise empty. More...
 
BoolField_foundValue2IsValidFld [NumFilters]
 True if a second match value from regular expression exists, otherwise false. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ml::FieldAddOnBase
void _addFieldPointer (Field *field)
 Helper routine to add a Field pointer to _fieldPointers, empty pointers and pointers added more than once will be handled fatally. More...
 

Detailed Description

Class implementing the StringLineFilterFieldAddOn which manages fields for line based filtering of a text string.

Definition at line 28 of file mlStringLineFilterFieldAddOn.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

The number of currently supported filter expressions.

Enumerator
NumFilters 

Definition at line 35 of file mlStringLineFilterFieldAddOn.h.

Constructor & Destructor Documentation

◆ StringLineFilterFieldAddOn()

ml::StringLineFilterFieldAddOn::StringLineFilterFieldAddOn ( FieldContainer fieldContainerRef)
inline

Constructor, setting the reference of the FieldContainer managing the fields.

Definition at line 32 of file mlStringLineFilterFieldAddOn.h.

Member Function Documentation

◆ addFields()

void ml::StringLineFilterFieldAddOn::addFields ( )
overridevirtual

Add fields to field container of module.

Implements ml::FieldAddOnBase.

◆ determineFilterLines()

static ReleaseToolsIO::StringVector ml::StringLineFilterFieldAddOn::determineFilterLines ( const std::string &  inString,
bool  simplify 
)
static

Searches lines in inStr which match a prefix expression followed somewhere later by a post fix expression and return the value between.

Parameters
inStringThe string to be (perhaps compressed) and decomposed into lines.
simplifyIf true then all characters < ASCII 32 and white spaces except of line feed and carriage return are replaced by spaces and then multiple occurrences of spaces are compressed to single ones, or - if false - the string is left unchanged.
Returns
An empty vector of no lines are found, otherwise all decomposed lines.

◆ filterString()

void ml::StringLineFilterFieldAddOn::filterString ( const std::string &  stringToBeFiltered)

Update the filter results according to the new string stringToBeFiltered; the string is not copied nor stored.

For updates always this routine must be called.

◆ handleFieldActivationChanges()

void ml::StringLineFilterFieldAddOn::handleFieldActivationChanges ( )
overridevirtual

Do the activateAttachment-like stuff in this method.

Reimplemented from ml::FieldAddOnBase.

◆ handleFieldChanges()

FieldAddOnBase::FieldChangeState ml::StringLineFilterFieldAddOn::handleFieldChanges ( Field field)
overridevirtual

Handle field notifications.

If a call of filterString() because filter results need an update then FieldAddOnBase::RecalculationRequired is returned.

Reimplemented from ml::FieldAddOnBase.

Member Data Documentation

◆ _compressWhiteSpacesFld

BoolField* ml::StringLineFilterFieldAddOn::_compressWhiteSpacesFld
protected

If true then all white spaces are replaced by spaces and multiple occurrences are compressed to single ones.

Definition at line 71 of file mlStringLineFilterFieldAddOn.h.

◆ _firstExpressionFld

StringField* ml::StringLineFilterFieldAddOn::_firstExpressionFld[NumFilters]
protected

Expression which must match the line begin section before the desired value starts if _useRegularExpressionFld is off, otherwise it is the regular which must match the line.

Definition at line 80 of file mlStringLineFilterFieldAddOn.h.

◆ _foundValue1Fld

StringField* ml::StringLineFilterFieldAddOn::_foundValue1Fld[NumFilters]
protected

The value found between firstExpression and lineEnd or empty if not found.

Definition at line 89 of file mlStringLineFilterFieldAddOn.h.

◆ _foundValue1IsValidFld

BoolField* ml::StringLineFilterFieldAddOn::_foundValue1IsValidFld[NumFilters]
protected

True if a value between firstExpression and lineEnd was found, otherwise false.

Definition at line 92 of file mlStringLineFilterFieldAddOn.h.

◆ _foundValue2Fld

StringField* ml::StringLineFilterFieldAddOn::_foundValue2Fld[NumFilters]
protected

The second match value of a regular expression is valid, otherwise empty.

Definition at line 95 of file mlStringLineFilterFieldAddOn.h.

◆ _foundValue2IsValidFld

BoolField* ml::StringLineFilterFieldAddOn::_foundValue2IsValidFld[NumFilters]
protected

True if a second match value from regular expression exists, otherwise false.

Definition at line 98 of file mlStringLineFilterFieldAddOn.h.

◆ _lineEndFld

StringField* ml::StringLineFilterFieldAddOn::_lineEndFld[NumFilters]
protected

Expression which must match the line section after the desired value starts.

Definition at line 83 of file mlStringLineFilterFieldAddOn.h.

◆ _occurenceFld

IntField* ml::StringLineFilterFieldAddOn::_occurenceFld[NumFilters]
protected

Selects which matched line shall be used for output, 0=first, -1=last.

Definition at line 86 of file mlStringLineFilterFieldAddOn.h.

◆ _useRegularExpressionFld

BoolField* ml::StringLineFilterFieldAddOn::_useRegularExpressionFld[NumFilters]
protected

If disabled then the content of _firstExpressionFld is used as line start, otherwise it is interpreted as regular expression which must match the searched line.

Definition at line 75 of file mlStringLineFilterFieldAddOn.h.


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