CoreUtils/DirectoryEntry.h
2022-05-23 12:51:44 -07:00

43 lines
663 B
C++

#ifndef __DirectoryEntry_h__
# define __DirectoryEntry_h__
#include <dirent.h>
#include <string>
#include <string.h>
namespace coreutils {
class DirectoryEntry {
public:
DirectoryEntry(struct dirent *entry) {
memcpy(&this->entry, entry, sizeof(struct dirent));
}
~DirectoryEntry() {}
std::string getName() {
return std::string(entry.d_name);
}
unsigned char getType() {
return entry.d_type;
}
bool isFile() {
return entry.d_type == DT_REG;
}
bool isDirectory() {
return entry.d_type == DT_DIR;
}
private:
struct dirent entry;
};
}
#endif