/* Blinker
   Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org>
   Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
   a blinkenarea.org project */

#ifndef BLINKER_DIRECTORY_H
#define BLINKER_DIRECTORY_H

#include <list>
#include <string>

#include "File.h"

namespace Blinker {

/// information about a directory
class Directory: public File
{
public:
  /// type of directory entries
  enum Type {
    TypeSubdir, ///< subdirectory
    TypeFile    ///< file
  };

public:
  /**
   * @brief constructor from path
   * @param[in] path path to directory
   */
  Directory(const std::string &path);

public:
  /**
   * @brief get list of entries in directory
   * @param[in] type type of directory entries to return
   * @param[out] entries list of directory entries
   */
  void getEntries(Type type, std::list<std::string> &entries) const;

  /**
   * @brief get subdirectory
   * @param[in] name of subdirectory
   * @return subdirectory object
   */
  Directory getSubdir(const std::string &name) const;

  /**
   * @brief get file in directory
   * @param[in] name of file
   * @return file object
   */
  File getFile(const std::string &name) const;
}; // class Directory

} // namespace Blinker

#endif // #ifndef BLINKER_DIRECTORY_H

