From d502fce7d4db492690e39c72fc029aa05a65057d Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Sat, 19 May 2012 16:38:56 +0200 Subject: More improvements in FWIK - more strings, Dir class, ... --- src/user/lib/fwik/include/IO/Dir.h | 24 ++++++++++++++++++++++++ src/user/lib/fwik/include/IO/Node.h | 5 ++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/user/lib/fwik/include/IO/Dir.h (limited to 'src/user/lib/fwik/include') diff --git a/src/user/lib/fwik/include/IO/Dir.h b/src/user/lib/fwik/include/IO/Dir.h new file mode 100644 index 0000000..bbfe3ed --- /dev/null +++ b/src/user/lib/fwik/include/IO/Dir.h @@ -0,0 +1,24 @@ +#ifndef DEF_FWIK_IO_DIR_H +#define DEF_FWIK_IO_DIR_H + +#include "Node.h" +#include + +class Dir : public Node { + void _init(); + + public: + int pos; + + Dir(FILE f); + Dir(const char* file, int mode); + Dir(const Node &n); + virtual ~Dir(); + + String read_ent(); + + virtual Dir* as_dir() { return this; } +}; + +#endif + diff --git a/src/user/lib/fwik/include/IO/Node.h b/src/user/lib/fwik/include/IO/Node.h index ed8290f..6b5b063 100644 --- a/src/user/lib/fwik/include/IO/Node.h +++ b/src/user/lib/fwik/include/IO/Node.h @@ -9,19 +9,22 @@ #include class Term; +class Dir; class Node { public: FILE fd; file_info info; - bool valid; + int error; // will be 0 if this is a valid file descriptor Node(FILE f); Node(const char* filename, int mode); + Node(FILE parent, const char* filename, int mode); virtual ~Node() {} void close(); virtual Term* as_term() { return 0; } + virtual Dir* as_dir() { return 0; } }; String path_cat(const String &a, const String &b, bool trailing_slash = true); -- cgit v1.2.3