ADTF  3.18.2
regularexpressionresolver.h
Go to the documentation of this file.
1 
7 #ifndef _REGULAR_EXPRESSION_RESOLVER_HEADER_
8 #define _REGULAR_EXPRESSION_RESOLVER_HEADER_
9 
10 namespace A_UTILS_NS
11 {
12 
27 {
28 
29  public:
33  typedef struct tag_tTreeMember
34  {
38  cFilename strFullPath;
43  } tTreeMember;
44 
48  typedef std::vector<tTreeMember> tTreeMemberList;
49 
50  public:
55 
61 
66  cRegularExpressionResolver(const cString &strExpression);
67 
73  cRegularExpressionResolver(const tChar* strExpression, tBool bCaseSensitive = tTrue);
74 
79 
89  tBool GetFilesPathList(const cString& strInput, tTreeMemberList& lstFiles);
90 
103  tBool GetFolderPathList(const cString& strInput, tTreeMemberList& lstFolders,
104  tBool bRecursive = tTrue, tUInt nRecDepth = 0);
105 
118  tBool GetFileFolderPathList(const cString& strInput, tTreeMemberList& lstFilesFolders,
119  tBool bRecursive = tTrue, tUInt nRecDepth = 0);
120 
134  tBool GetFolderMatch(const cString& strInput, cFilename& strFoldername,
135  tBool bRecursive = tTrue, tUInt nRecDepth = 0);
136 
148  tBool GetFileMatch(const cString& strInput, cFilename& strFilename);
149 
157  cString GetRegExFromString(const cString& strSource, cString& strPath, tBool bFull = tFalse);
158 
164  cString GetFirstMatch(const cString& strSource);
165 
171  static tBool ContainsRegEx(const cString& strSource);
172 
173  private:
174  cRegularExpression* m_pRegEx;
175 
176  private:
177  tUInt GetRecursionDepth(cString& strRegEx);
178  cString GetFolderReplacedRegEx(const cString& strInput, const cString& strName);
179  tBool CheckFolderMatch(const cString& strPath, const cString& strRegEx);
180  tInt FindFolder(tTreeMemberList& lstFilesFolders, cFilename& strFilename);
181 };
182 
183 } // namespace a_utils
184 
185 #endif // _REGULAR_EXPRESSION_RESOLVER_HEADER_
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
unsigned int tUInt
type definition for unsigned integer value (platform and compiler dependent type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
File name class.
Definition: filename.h:59
Class for resolving regular expression inside a filename or path.
static tBool ContainsRegEx(const cString &strSource)
Check if string contains regular expression.
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.
cRegularExpressionResolver()
Default constructor.
tBool GetFileMatch(const cString &strInput, cFilename &strFilename)
Retrieves a single file if any from a directory using regular expressions.
tBool GetFolderPathList(const cString &strInput, tTreeMemberList &lstFolders, tBool bRecursive=tTrue, tUInt nRecDepth=0)
Retrieve all subdirectories from a directory using regular expressions.
cString GetFirstMatch(const cString &strSource)
Retrieve first match of regular expression.
cRegularExpressionResolver(const cString &strExpression)
Constructor with preset expression.
tBool GetFilesPathList(const cString &strInput, tTreeMemberList &lstFiles)
Retrieve all files from a directory using regular expressions.
std::vector< tTreeMember > tTreeMemberList
Definition for List of List of tTreeMember.
virtual ~cRegularExpressionResolver()
Destructor.
tBool GetFileFolderPathList(const cString &strInput, tTreeMemberList &lstFilesFolders, tBool bRecursive=tTrue, tUInt nRecDepth=0)
Retrieve all files from subdirectories using regular expressions.
cRegularExpressionResolver(const cRegularExpressionResolver &oRegExpRes)
Copy constructor.
cRegularExpressionResolver(const tChar *strExpression, tBool bCaseSensitive=tTrue)
Constructor with preset expression.
cString GetRegExFromString(const cString &strSource, cString &strPath, tBool bFull=tFalse)
Retrieve regular expression and path.
#define tFalse
Value for tBool.
Definition: constants.h:60
#define tTrue
Value for tBool.
Definition: constants.h:62
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition: string.h:2778
Internal Structure to resolve Regular expressions.
cFilename strFullPath
File path of item.
tBool bIsFile
Is File or Directory.
cString strName
name of item
tInt nParentIdx
parent index depending on