diff options
author | Stijn Buys <ingar@osirion.org> | 2012-01-07 14:21:22 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-01-07 14:21:22 +0000 |
commit | f9403975df404eb03db29a6ffa655158d2739b1f (patch) | |
tree | 3867af5575126af5617c7210814c464c5e7de93a /src/filesystem/directory.h | |
parent | 59139096145529c90c34ec67192faa8babbaa083 (diff) |
Added class to read filenames from a directory.
Diffstat (limited to 'src/filesystem/directory.h')
-rw-r--r-- | src/filesystem/directory.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/filesystem/directory.h b/src/filesystem/directory.h new file mode 100644 index 0000000..cdd9870 --- /dev/null +++ b/src/filesystem/directory.h @@ -0,0 +1,67 @@ +/* + filesystem/directory.h + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_FILESYSTEM_DIRECTORY_H__ +#define __INCLUDED_FILESYSTEM_DIRECTORY_H__ + +// C++ headers +#include <string> +#include <list> + +namespace filesystem +{ + +/** + * @brief an abstract interface to handle file access + */ +class Directory { + +public: + typedef std::list<std::string> FileNames; + + Directory(); + + Directory(const std::string & location); + + ~Directory(); + + // inspectors + + /** + * @brief returns the underlying filesystem location + */ + inline const std::string & location() const { + return directory_location; + } + + inline const FileNames & filenames() const { + return directory_filenames; + } + + // mutators + + /** + * @brief set the underlying filesystem location + */ + void set_location(const std::string & location); + + /** + * @brief read the filenames from current filesystem location + */ + void read(); + + void clear(); +private: + + std::string directory_location; + + FileNames directory_filenames; +}; + +} // namespace filesystem + +#endif // __INCLUDED_FILESYSTEM_DIRECTORY_H__ + |