#include <StringFilter.hpp>
Collaboration diagram for Ionflux::Tools::StringFilter:
Public Member Functions | |
StringFilter () | |
Constructor. | |
StringFilter (const std::string &initFilter) | |
Constructor. | |
virtual | ~StringFilter () |
Destructor. | |
virtual void | setFilter (const std::string &newFilter) |
Sets filter expression. | |
virtual void | addManipulator (StringManipulator *newManip, bool manage) |
Add a string manipulator. | |
virtual std::string | apply (const std::string &bytes) |
Apply filter. | |
virtual void | printDebugInfo () |
Print debug information. | |
virtual Reporter & | getLog () |
Get Console output/logging facility. | |
Static Public Attributes | |
static const TokenType | TT_FUNC_SEP |
Token type: Function separator. | |
static const TokenType | TT_FUNC_BRACKET_LEFT |
Token type: Function left bracket. | |
static const TokenType | TT_FUNC_BRACKET_RIGHT |
Token type: Function right bracket. | |
static const TokenType | TT_FUNC_ARG_DELIM |
Token type: Argument delimiter. | |
static const TokenType | TT_FUNC_ARG_SEP |
Token type: Argument separator. | |
Protected Member Functions | |
virtual void | clearFunctions () |
Delete all functions. | |
virtual void | clearManipulators () |
Delete string manipulators. | |
virtual void | initTokenTypes () |
Initialize token types. | |
virtual void | initManipulators () |
Initialize string manipulators. | |
virtual void | parse () |
Parse filter expression. | |
virtual StringManipulator * | getManipulator (const std::string &manipName) |
Get string manipulator by name. | |
Protected Attributes | |
Ionflux::Tools::Reporter | log |
Console output/logging. | |
std::string | filter |
The filter expression. | |
std::vector< StringFilterFunction * > | functions |
The functions in this filter. | |
std::vector< StringManipulatorEntry > | manipulators |
String manipulators available to this filter. | |
std::map< std::string, StringManipulator * > | manipIndex |
String manipulator index map. | |
Tokenizer | tok |
Tokenizer for parsing filter expressions. | |
Static Protected Attributes | |
static StringUppercase | STRINGMANIP_UPPERCASE |
String manipulator: uppercase. | |
static StringLowercase | STRINGMANIP_LOWERCASE |
String manipulator: lowercase. | |
static StringErase | STRINGMANIP_ERASE |
String manipulator: erase. | |
static StringReplace | STRINGMANIP_REPLACE |
String manipulator: replace. | |
static StringTrim | STRINGMANIP_TRIM |
String manipulator: trim. | |
static StringLTrim | STRINGMANIP_LTRIM |
String manipulator: ltrim. | |
static StringRTrim | STRINGMANIP_RTRIM |
String manipulator: rtrim. | |
static StringTruncate | STRINGMANIP_TRUNCATE |
String manipulator: truncate. | |
static StringCenter | STRINGMANIP_CENTER |
String manipulator: center. | |
static StringMove | STRINGMANIP_MOVE |
String manipulator: move. | |
static StringAppend | STRINGMANIP_APPEND |
String manipulator: append. | |
static StringInsert | STRINGMANIP_INSERT |
String manipulator: insert. | |
static StringNumFormat | STRINGMANIP_NUMFORMAT |
String manipulator: numformat. | |
static StringTranslate | STRINGMANIP_TRANSLATE |
String manipulator: translate. | |
static StringSubstr | STRINGMANIP_SUBSTR |
String manipulator: substr. | |
static StringLPad | STRINGMANIP_LPAD |
String manipulator: lpad. | |
static StringRPad | STRINGMANIP_RPAD |
String manipulator: rpad. | |
static StringSWrap | STRINGMANIP_SWRAP |
String manipulator: swrap. | |
static StringXMLEscape | STRINGMANIP_XMLESCAPE |
String manipulator: xmlescape. | |
static StringURLEncode | STRINGMANIP_URLENCODE |
String manipulator: urlencode. |
A string filter is a set of functions (manipulators) that can be applied to a string to yield another string. String manipulators may take one or more arguments, and they can be stacked. An example of a string filter expression would be:
uppercase|remove(' ')
This filter would first change the string to uppercase and then remove all spaces.
The general format of a string manipulator is:
<function> [ '(' [ (<identifier> | (<quote char> <argument> <quote char>)) [',' | <linear whitespace>]+ ]+ ')' ]+
Where <quote char>
is either ' or ". String arguments should always be enclosed in quotes and multiple arguments should be separated by ','.
|
Constructor. Construct new StringFilter object. |
|
Constructor. Construct new StringFilter object.
|
|
Destructor. Destruct StringFilter object. |
|
Add a string manipulator.
Add a string manipulator to the set of manipulators available to this string filter. Manipulators must be added before they can be used in a filter expression. They also must be available during the whole lifetime of the string filter object.
|
|
Apply filter. Apply the filter to a string of bytes.
|
|
Delete all functions. Erase all parsed functions from this filter. |
|
Delete string manipulators. Erase all manipulators from this filter. |
|
Get Console output/logging facility.
|
|
Get string manipulator by name. Find a string manipulator of the specified name in the vector of registered manipulators.
|
|
Initialize string manipulators. Initialize string manipulators usable by this filter. |
|
Initialize token types. Initialize the token types used for parsing filter expressions. |
|
Parse filter expression. Parse the current filter expression. |
|
Print debug information.
|
|
Sets filter expression. Sets the filter expression for this string filter.
|
|
The filter expression.
|
|
The functions in this filter.
|
|
Console output/logging.
|
|
String manipulator index map.
|
|
String manipulators available to this filter.
|
|
String manipulator: append.
|
|
String manipulator: center.
|
|
String manipulator: erase.
|
|
String manipulator: insert.
|
|
String manipulator: lowercase.
|
|
String manipulator: lpad.
|
|
String manipulator: ltrim.
|
|
String manipulator: move.
|
|
String manipulator: numformat.
|
|
String manipulator: replace.
|
|
String manipulator: rpad.
|
|
String manipulator: rtrim.
|
|
String manipulator: substr.
|
|
String manipulator: swrap.
|
|
String manipulator: translate.
|
|
String manipulator: trim.
|
|
String manipulator: truncate.
|
|
String manipulator: uppercase.
|
|
String manipulator: urlencode.
|
|
String manipulator: xmlescape.
|
|
Tokenizer for parsing filter expressions.
|
|
Token type: Argument delimiter.
|
|
Initial value: { TokenType::USERTYPE_ID + 5, ",", false, 1}
|
|
Initial value: { TokenType::USERTYPE_ID + 2, "(", false, 1}
|
|
Initial value: { TokenType::USERTYPE_ID + 3, ")", false, 1}
|
|
Initial value: { TokenType::USERTYPE_ID + 1, "|", false, 1}
|