vrfileman

view src/fs.h @ 1:9e3d77dad51b

moving on...
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 31 Jan 2015 20:01:35 +0200
parents
children 282da6123fd4
line source
1 #ifndef FS_H_
2 #define FS_H_
4 #include <vector>
6 class FSNode {
7 protected:
8 char *path, *name;
9 FSNode *parent;
11 std::vector<FSNode*> children;
12 bool expanded;
14 unsigned int uid, gid, mode;
16 private:
17 FSNode(const FSNode&);
18 FSNode &operator =(const FSNode&);
20 public:
21 FSNode();
22 virtual ~FSNode();
24 void init();
25 void destroy();
26 void destroy_tree();
28 virtual void set_path(const char *path);
29 virtual void set_name(const char *name);
31 virtual const char *get_path() const;
32 virtual const char *get_name() const;
34 virtual void add_child(FSNode *node);
36 virtual FSNode *get_parent();
37 virtual const FSNode *get_parent() const;
39 virtual int get_child_count() const;
40 virtual FSNode *get_child(int n);
41 virtual const FSNode *get_child(int n) const;
43 virtual void expand();
44 virtual bool is_expanded() const;
45 };
47 class FSDir : public FSNode {
48 public:
49 FSDir();
51 virtual void expand();
52 };
54 class FSFile : public FSNode {
55 protected:
56 unsigned long size;
58 public:
59 FSFile();
61 void set_size(unsigned long s);
62 unsigned long get_size() const;
63 };
65 #endif // FS_H_