2014-11-15 23:47:38 +01:00
|
|
|
#pragma once
|
2015-10-15 13:04:57 +02:00
|
|
|
#ifndef MESSMER_FSPP_FSINTERFACE_DIR_H_
|
|
|
|
#define MESSMER_FSPP_FSINTERFACE_DIR_H_
|
2014-11-15 23:47:38 +01:00
|
|
|
|
2015-02-17 00:48:49 +01:00
|
|
|
#include "Node.h"
|
2015-06-21 17:44:30 +02:00
|
|
|
#include <messmer/cpp-utils/pointer/unique_ref.h>
|
2014-11-15 23:47:38 +01:00
|
|
|
#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-07-20 17:56:44 +02:00
|
|
|
enum class EntryType: uint8_t {
|
|
|
|
DIR = 0x00,
|
|
|
|
FILE = 0x01,
|
|
|
|
SYMLINK = 0x02
|
2015-03-10 21:51:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Entry {
|
|
|
|
Entry(EntryType type_, const std::string &name_): type(type_), name(name_) {}
|
|
|
|
EntryType type;
|
|
|
|
std::string name;
|
|
|
|
};
|
|
|
|
|
2015-06-18 19:30:52 +02:00
|
|
|
virtual cpputils::unique_ref<OpenFile> createAndOpenFile(const std::string &name, mode_t mode, uid_t uid, gid_t gid) = 0;
|
2015-04-22 14:31:15 +02:00
|
|
|
virtual void createDir(const std::string &name, mode_t mode, uid_t uid, gid_t gid) = 0;
|
2015-04-23 09:17:23 +02:00
|
|
|
virtual void createSymlink(const std::string &name, const boost::filesystem::path &target, 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;
|
2015-06-18 19:30:52 +02:00
|
|
|
virtual cpputils::unique_ref<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
|