distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
Directory.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_FILESYSTEM_DIRECTORY_HPP_
13 #define INCLUDE_DISTORTOS_FILESYSTEM_DIRECTORY_HPP_
14 
15 #include <dirent.h>
16 
17 #include <utility>
18 
19 namespace distortos
20 {
21 
28 class Directory
29 {
30 public:
31 
38  virtual ~Directory() = default;
39 
54  virtual int close() = 0;
55 
66  virtual std::pair<int, off_t> getPosition() = 0;
67 
83  virtual void lock() = 0;
84 
98  virtual int read(dirent& entry) = 0;
99 
110  virtual int rewind() = 0;
111 
124  virtual int seek(off_t position) = 0;
125 
136  virtual void unlock() = 0;
137 
138  Directory() = default;
139  Directory(const Directory&) = delete;
140  Directory& operator=(const Directory&) = delete;
141 };
142 
143 } // namespace distortos
144 
145 #endif // INCLUDE_DISTORTOS_FILESYSTEM_DIRECTORY_HPP_
virtual int seek(off_t position)=0
Moves position in the directory.
Definition: dirent.h:34
dirent.h, suitable for newlib, which does not provide one.
virtual void unlock()=0
Unlocks the directory which was previously locked by current thread.
Definition: Directory.hpp:28
virtual ~Directory()=default
Directory's destructor.
virtual std::pair< int, off_t > getPosition()=0
Returns current position in the directory.
virtual int close()=0
Closes directory.
Top-level namespace of distortos project.
Definition: buttons.hpp:33
virtual int read(dirent &entry)=0
Reads next entry from directory.
virtual void lock()=0
Locks the directory for exclusive use by current thread.
virtual int rewind()=0
Resets current position in the directory.