Image Component Library (ICL)
Public Member Functions | Static Public Member Functions | List of all members
icl::io::FileList Class Reference

Utility class implementing a list of files. More...

#include <FileList.h>

Inheritance diagram for icl::io::FileList:
icl::utils::ShallowCopyable< FileListImpl, FileListImplDelOp >

Public Member Functions

 FileList ()
 Create a null file-list. More...
 
 FileList (const std::string &pattern, bool omitDoubledFiles=false)
 Create a file-list of given type. More...
 
 FileList (const std::vector< std::string > &filenames)
 create a file list by given set of filenames More...
 
 ~FileList ()
 does nothing More...
 
int size () const
 returns the number of files in this list More...
 
const std::string & operator[] (int i) const
 returns the i-th filename in this list More...
 
void join (const FileList &other)
 adds all files from another FileList to this More...
 
void show () const
 shows the filelist to std::out More...
 
void toSequenceFile (const std::string &seqFileName) const
 generates a ".seq" from this FileList More...
 
- Public Member Functions inherited from icl::utils::ShallowCopyable< FileListImpl, FileListImplDelOp >
bool isNull () const
 returns wheter the objects implementation holds a null pointer More...
 

Static Public Member Functions

static std::string translateHashPattern (const std::string &hashPattern)
 translates a hashpattern to a regular expression More...
 

Additional Inherited Members

- Public Types inherited from icl::utils::ShallowCopyable< FileListImpl, FileListImplDelOp >
typedef ShallowCopyable< FileListImpl, FileListImplDelOp > ParentSC
 
- Protected Member Functions inherited from icl::utils::ShallowCopyable< FileListImpl, FileListImplDelOp >
 ShallowCopyable (FileListImpl *t=0)
 create a the implementation with a given T* value More...
 
- Protected Attributes inherited from icl::utils::ShallowCopyable< FileListImpl, FileListImplDelOp >
SmartPtrBase< FileListImpl, FileListImplDelOp > impl
 shared pointer for the classes implementation More...
 

Detailed Description

Utility class implementing a list of files.

Constructor & Destructor Documentation

icl::io::FileList::FileList ( )

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.

File (postfix ".seq")

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.

Doubled Files

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.

Parameters
patternthe file pattern Either something like images/ *.p[gnp]m or a seqence file name
omitDoubledFilesflag 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.

icl::io::FileList::~FileList ( )

does nothing

Member Function Documentation

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


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