From f9403975df404eb03db29a6ffa655158d2739b1f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 7 Jan 2012 14:21:22 +0000 Subject: Added class to read filenames from a directory. --- src/filesystem/directory.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/filesystem/directory.h (limited to 'src/filesystem/directory.h') 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 +#include + +namespace filesystem +{ + +/** + * @brief an abstract interface to handle file access + */ +class Directory { + +public: + typedef std::list 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__ + -- cgit v1.2.3