2016-03-08 22:14:30 +01:00
|
|
|
#ifndef GB_DIR_H
|
|
|
|
#define GB_DIR_H
|
2013-08-02 13:12:24 -07:00
|
|
|
|
2016-08-25 16:28:38 +02:00
|
|
|
#include <dirent.h>
|
|
|
|
#include <cstddef>
|
2013-08-02 13:12:24 -07:00
|
|
|
|
|
|
|
class Dir {
|
2016-08-25 16:28:38 +02:00
|
|
|
public:
|
|
|
|
Dir();
|
|
|
|
~Dir();
|
2013-08-02 13:12:24 -07:00
|
|
|
|
2016-08-25 16:28:38 +02:00
|
|
|
void reset();
|
2013-08-02 13:12:24 -07:00
|
|
|
|
2016-08-25 16:28:38 +02:00
|
|
|
bool set(const char *dirName);
|
|
|
|
bool set(const char *d1, const char *d2);
|
2013-08-02 13:12:24 -07:00
|
|
|
|
2016-08-25 16:28:38 +02:00
|
|
|
bool open();
|
|
|
|
bool close();
|
2013-08-02 13:12:24 -07:00
|
|
|
|
2016-08-25 16:28:38 +02:00
|
|
|
const char *getNextFilename(const char *pattern = NULL);
|
2013-08-02 13:12:24 -07:00
|
|
|
|
2016-08-25 16:28:38 +02:00
|
|
|
const char *getDir() { return m_dirname; }
|
2013-08-02 13:12:24 -07:00
|
|
|
|
2016-08-25 16:28:38 +02:00
|
|
|
private:
|
|
|
|
char *m_dirname;
|
|
|
|
DIR *m_dir;
|
|
|
|
char m_dentryBuffer[1024];
|
2013-08-02 13:12:24 -07:00
|
|
|
};
|
|
|
|
|
2016-03-08 22:14:30 +01:00
|
|
|
#endif // GB_DIR_H
|