MeVisLabToolboxReference
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...
 
virtual void addFields ()
 Add fields to field container of module. More...
 
virtual void handleFieldActivationChanges ()
 Do the activateAttachment-like stuff in this method. More...
 
virtual FieldAddOnBase::FieldChangeState handleFieldChanges (Field *field)
 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...
 
virtual bool hasField (Field *field)
 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

BoolField_compressWhiteSpacesFld
 The managed fields. 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 32 of file mlStringLineFilterFieldAddOn.h.

Member Enumeration Documentation

anonymous enum

The number of currently supported filter expressions.

Enumerator
NumFilters 

Definition at line 39 of file mlStringLineFilterFieldAddOn.h.

Constructor & Destructor Documentation

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

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

Definition at line 36 of file mlStringLineFilterFieldAddOn.h.

Member Function Documentation

virtual void ml::StringLineFilterFieldAddOn::addFields ( )
virtual

Add fields to field container of module.

Implements ml::FieldAddOnBase.

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.
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.

virtual void ml::StringLineFilterFieldAddOn::handleFieldActivationChanges ( )
virtual

Do the activateAttachment-like stuff in this method.

Reimplemented from ml::FieldAddOnBase.

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

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

BoolField* ml::StringLineFilterFieldAddOn::_compressWhiteSpacesFld
protected

The managed fields.

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

Definition at line 74 of file mlStringLineFilterFieldAddOn.h.

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 83 of file mlStringLineFilterFieldAddOn.h.

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

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

Definition at line 92 of file mlStringLineFilterFieldAddOn.h.

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

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

Definition at line 95 of file mlStringLineFilterFieldAddOn.h.

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

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

Definition at line 98 of file mlStringLineFilterFieldAddOn.h.

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

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

Definition at line 101 of file mlStringLineFilterFieldAddOn.h.

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

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

Definition at line 86 of file mlStringLineFilterFieldAddOn.h.

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

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

Definition at line 89 of file mlStringLineFilterFieldAddOn.h.

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 78 of file mlStringLineFilterFieldAddOn.h.


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