libcryfs/fs_interface/Dir.h

41 lines
1.1 KiB
C
Raw Normal View History

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;
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
};
struct Entry {
Entry(EntryType type_, const std::string &name_): type(type_), name(name_) {}
EntryType type;
std::string name;
};
virtual cpputils::unique_ref<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;
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
//TODO Allow alternative implementation returning only children names without more information
//virtual std::unique_ptr<std::vector<std::string>> children() const = 0;
virtual cpputils::unique_ref<std::vector<Entry>> children() const = 0;
2014-11-15 23:47:38 +01:00
};
}
2014-11-15 23:47:38 +01:00
#endif