2014-11-15 23:47:38 +01:00
|
|
|
#pragma once
|
2014-11-16 00:05:28 +01:00
|
|
|
#ifndef FSPP_DIR_H_
|
|
|
|
#define FSPP_DIR_H_
|
2014-11-15 23:47:38 +01:00
|
|
|
|
2015-02-17 00:48:49 +01:00
|
|
|
#include "Node.h"
|
2014-11-15 23:47:38 +01:00
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
2014-11-16 00:05:28 +01:00
|
|
|
namespace fspp {
|
2014-11-15 23:47:38 +01:00
|
|
|
class Device;
|
2015-03-11 00:22:36 +01:00
|
|
|
class OpenFile;
|
2014-11-15 23:47:38 +01:00
|
|
|
|
|
|
|
class Dir: public virtual Node {
|
|
|
|
public:
|
|
|
|
virtual ~Dir() {}
|
|
|
|
|
2015-03-10 21:51:12 +01:00
|
|
|
enum class EntryType {
|
|
|
|
DIR = 0,
|
|
|
|
FILE = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Entry {
|
|
|
|
Entry(EntryType type_, const std::string &name_): type(type_), name(name_) {}
|
|
|
|
EntryType type;
|
|
|
|
std::string name;
|
|
|
|
};
|
|
|
|
|
2015-04-22 14:31:15 +02:00
|
|
|
virtual std::unique_ptr<OpenFile> createAndOpenFile(const std::string &name, mode_t mode, uid_t uid, gid_t gid) = 0;
|
|
|
|
virtual void createDir(const std::string &name, mode_t mode, uid_t uid, gid_t gid) = 0;
|
2014-11-15 23:47:38 +01:00
|
|
|
|
2015-03-10 21:51:12 +01:00
|
|
|
//TODO Allow alternative implementation returning only children names without more information
|
|
|
|
//virtual std::unique_ptr<std::vector<std::string>> children() const = 0;
|
|
|
|
virtual std::unique_ptr<std::vector<Entry>> children() const = 0;
|
2014-11-15 23:47:38 +01:00
|
|
|
};
|
|
|
|
|
2015-03-16 02:14:27 +01:00
|
|
|
}
|
2014-11-15 23:47:38 +01:00
|
|
|
|
2015-03-16 02:14:27 +01:00
|
|
|
#endif
|