Image Component Library (ICL)
|
Utility class implementing a list of files. More...
#include <FileList.h>
Public Member Functions | |
FileList () | |
Create a null file-list. | |
FileList (const std::string &pattern, bool omitDoubledFiles=false) | |
Create a file-list of given type. | |
FileList (const std::vector< std::string > &filenames) | |
create a file list by given set of filenames | |
~FileList () | |
does nothing | |
int | size () const |
returns the number of files in this list | |
const std::string & | operator[] (int i) const |
returns the i-th filename in this list | |
void | join (const FileList &other) |
adds all files from another FileList to this | |
void | show () const |
shows the filelist to std::out | |
void | toSequenceFile (const std::string &seqFileName) const |
generates a ".seq" from this FileList | |
Static Public Member Functions | |
static std::string | translateHashPattern (const std::string &hashPattern) |
translates a hashpattern to a regular expression |
Utility class implementing a list of files.
Create a null file-list.
icl::io::FileList::FileList | ( | const std::string & | pattern, |
bool | omitDoubledFiles = false |
||
) |
Create a file-list of given type.
pattern migtht be a file pattern like "images/ *.ppm" a single file like "./theimage.jpg" or a file seqenece file with postfix ".seq" which is a textfile where each line is single filename.
Sequence files which are determined by their postfix ".seq" are are treated in a special way. A sequence file must contain a new-line separated list of filename (in particular other sequence files). Each entry of the seqence file is then added using a recursive "add"- function. If a sequence file contains other sequence files, this files are parsed recursively in the same way. Sequence files may not contain file patterns like "*.ppm".
To avoid infinite recursion, the FileLists implementation internally holds a list of all already contained sequence files, so adding the same sequence more than once (even indirect by other sequence files) will have no effect.
Another feature of the FileList class is provided using an additional constructor flag "omitDoubledFiles". If this flag is set to true (it is false by default), the FileLists implementation will internally skip files, which have already been added.
pattern | the file pattern Either something like images/ *.p[gnp]m or a seqence file name |
omitDoubledFiles | flag to control the creation of double file names. Double file names creation is not allowed at default. |
icl::io::FileList::FileList | ( | const std::vector< std::string > & | filenames | ) |
create a file list by given set of filenames
double filenames are allowed in this mode. Sequence files are not handled in a special way.
does nothing
void icl::io::FileList::join | ( | const FileList & | other | ) |
adds all files from another FileList to this
const std::string& icl::io::FileList::operator[] | ( | int | i | ) | const |
returns the i-th filename in this list
void icl::io::FileList::show | ( | ) | const |
shows the filelist to std::out
int icl::io::FileList::size | ( | ) | const |
returns the number of files in this list
void icl::io::FileList::toSequenceFile | ( | const std::string & | seqFileName | ) | const |
generates a ".seq" from this FileList
static std::string icl::io::FileList::translateHashPattern | ( | const std::string & | hashPattern | ) | [static] |
translates a hashpattern to a regular expression