Public Member Functions | List of all members
BeFileListIterator Class Reference

An iterator to walk through a semicolon delimited list of file paths. More...

#include <BeFileListIterator.h>

Public Member Functions

 BeFileListIterator (WCharCP filePathList, bool recursive)
 Construct an instance of a BeFileListIterator. More...
 
 BeFileListIterator (WStringCR filePathList, bool recursive)
 Construct an instance of a BeFileListIterator. More...
 
 BeFileListIterator (CharCP filePathList, bool recursive)
 Construct an instance of a BeFileListIterator. More...
 
 ~BeFileListIterator ()
 
BentleyStatus GetNextFileName (BeFileName &name)
 Retrieve the next filename found from the path list. More...
 

Detailed Description

An iterator to walk through a semicolon delimited list of file paths.

Each entry may include wildcards (e.g. "\a\*;*.exe;c:\temp\Ab*", etc.). The iterator returns one filename at a time. There is also an option to recursively return entries from subdirectories. This is most useful when the list includes the name of one or more directories. The interaction between wildcards and recursion can be confusing. If the list includes both, the result is that if the wildcard returns a directory, all of its entries are returned (note, the wildcard is applied only at the first level, NOT recursively). So, if the filepath "\123\a*" is passed with recursion on, the file "\123\abc.txt" is returned, as well as ALL of the files in the directory "\123\apples\" and all of its subdirectories, but none of the files in "\123\def\" are returned, even if they start with "a".

Note
This class does NOT accept environment or configuration variables in the list.
It returns only filenames that actually exist. So, if the list is just the full name of a file which is not present, this iterator will return ERROR without returning anything.

Constructor & Destructor Documentation

BeFileListIterator ( WCharCP  filePathList,
bool  recursive 
)

Construct an instance of a BeFileListIterator.

Parameters
[in]filePathListA list of semicolon delimited file paths, including wildcards, to iterate.
[in]recursiveIf the list contatains the name of a directory, or if a directory matches a wildcard, return its contents, recursively.
BeFileListIterator ( WStringCR  filePathList,
bool  recursive 
)

Construct an instance of a BeFileListIterator.

Parameters
[in]filePathListA list of semicolon delimited file paths, including wildcards, to iterate.
[in]recursiveIf the list contatains the name of a directory, or if a directory matches a wildcard, return its contents, recursively.
BeFileListIterator ( CharCP  filePathList,
bool  recursive 
)

Construct an instance of a BeFileListIterator.

Parameters
[in]filePathListA list of semicolon delimited file paths, including wildcards, to iterate.
[in]recursiveIf the list contatains the name of a directory, or if a directory matches a wildcard, return its contents, recursively.

Member Function Documentation

BentleyStatus GetNextFileName ( BeFileName &  name)

Retrieve the next filename found from the path list.

Parameters
[out]nameThe name of the next valid file from the path list.
Returns
SUCCESS if the name returned is valid, ERROR if there are no more files.

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

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.