ADTF
|
Class for resolving regular expression inside a filename or path. More...
Public Types | |
typedef std::vector< tTreeMember > | tTreeMemberList |
Definition for List of List of tTreeMember. | |
Public Member Functions | |
cRegularExpressionResolver () | |
Default constructor. | |
cRegularExpressionResolver (const cRegularExpressionResolver &oRegExpRes) | |
Copy constructor. More... | |
cRegularExpressionResolver (const cString &strExpression) | |
Constructor with preset expression. More... | |
cRegularExpressionResolver (const tChar *strExpression, tBool bCaseSensitive=tTrue) | |
Constructor with preset expression. More... | |
virtual | ~cRegularExpressionResolver () |
Destructor. | |
tBool | GetFilesPathList (const cString &strInput, tTreeMemberList &lstFiles) |
Retrieve all files from a directory using regular expressions. More... | |
tBool | GetFolderPathList (const cString &strInput, tTreeMemberList &lstFolders, tBool bRecursive=tTrue, tUInt nRecDepth=0) |
Retrieve all subdirectories from a directory using regular expressions. More... | |
tBool | GetFileFolderPathList (const cString &strInput, tTreeMemberList &lstFilesFolders, tBool bRecursive=tTrue, tUInt nRecDepth=0) |
Retrieve all files from subdirectories using regular expressions. More... | |
tBool | GetFolderMatch (const cString &strInput, cFilename &strFoldername, tBool bRecursive=tTrue, tUInt nRecDepth=0) |
Retrieves a single folder, if any, from a directory using regular expressions. More... | |
tBool | GetFileMatch (const cString &strInput, cFilename &strFilename) |
Retrieves a single file if any from a directory using regular expressions. More... | |
cString | GetRegExFromString (const cString &strSource, cString &strPath, tBool bFull=tFalse) |
Retrieve regular expression and path. More... | |
cString | GetFirstMatch (const cString &strSource) |
Retrieve first match of regular expression. More... | |
Static Public Member Functions | |
static tBool | ContainsRegEx (const cString &strSource) |
Check if string contains regular expression. More... | |
Private Member Functions | |
tUInt | GetRecursionDepth (cString &strRegEx) |
cString | GetFolderReplacedRegEx (const cString &strInput, const cString &strName) |
tBool | CheckFolderMatch (const cString &strPath, const cString &strRegEx) |
tInt | FindFolder (tTreeMemberList &lstFilesFolders, cFilename &strFilename) |
Private Attributes | |
cRegularExpression * | m_pRegEx |
Class for resolving regular expression inside a filename or path.
This class implements basic regular expression resolving functionality.
Regular expressions can be defined as %{REGEX} or %%REGEX%. You can escape % by typing \%.
The REGEX in an input string has to fullfill the following constraints:
Definition at line 26 of file regularexpressionresolver.h.
cRegularExpressionResolver | ( | const cRegularExpressionResolver & | oRegExpRes | ) |
Copy constructor.
oRegExpRes | [in] The object to copy. |
cRegularExpressionResolver | ( | const cString & | strExpression | ) |
Constructor with preset expression.
strExpression | [in] The regular expression string. |
cRegularExpressionResolver | ( | const tChar * | strExpression, |
tBool | bCaseSensitive = tTrue |
||
) |
Constructor with preset expression.
strExpression | [in] The regular expression string. |
bCaseSensitive | [in] Whether or not the match case sensitive. |
Check if string contains regular expression.
strSource | [in] The string to check. Use forward slashes a seperator. Only absolute path. |
tBool GetFileFolderPathList | ( | const cString & | strInput, |
tTreeMemberList & | lstFilesFolders, | ||
tBool | bRecursive = tTrue , |
||
tUInt | nRecDepth = 0 |
||
) |
Retrieve all files from subdirectories using regular expressions.
strInput | [in] The directory to check. Use forward slashes a seperator. Only absolute path. |
lstFilesFolders | [out] The filled list of strings. |
bRecursive | [in] Check folder recursive or not. |
nRecDepth | [in] Recursion depth. |
Retrieves a single file if any from a directory using regular expressions.
strInput | [in] The directory to check. |
strFilename | [out] The discovered file matching the regular expression (if matched) |
tBool GetFilesPathList | ( | const cString & | strInput, |
tTreeMemberList & | lstFiles | ||
) |
Retrieve all files from a directory using regular expressions.
strInput | [in] The directory to check. |
lstFiles | [out] The filled list of strings. |
Retrieve first match of regular expression.
strSource | [in] The string to check. Use forward slashes a seperator. Only absolute path. |
tBool GetFolderMatch | ( | const cString & | strInput, |
cFilename & | strFoldername, | ||
tBool | bRecursive = tTrue , |
||
tUInt | nRecDepth = 0 |
||
) |
Retrieves a single folder, if any, from a directory using regular expressions.
strInput | [in] The directory to check. |
strFoldername | [out] The discovered folder matching the regular expression (if matched) |
bRecursive | [in] Check folder recursive or not. |
nRecDepth | [in] Recursion depth. |
tBool GetFolderPathList | ( | const cString & | strInput, |
tTreeMemberList & | lstFolders, | ||
tBool | bRecursive = tTrue , |
||
tUInt | nRecDepth = 0 |
||
) |
Retrieve all subdirectories from a directory using regular expressions.
strInput | [in] The directory to check. Use forward slashes a seperator. Only absolute path. |
lstFolders | [out] The filled list of strings. |
bRecursive | [in] Check folder recursive or not. |
nRecDepth | [in] depth number for recursion |
Retrieve regular expression and path.
strSource | [in] The string to check. Use forward slashes a seperator. Only absolute path. |
strPath | [out] The string containing the path until regular expression starts. |
bFull | [in] Return only the regex or the full regex (with opening and closing characters) |