3 #ifndef SZA_UTIL_DIRLIST_H
4 #define SZA_UTIL_DIRLIST_H
31 TYPE_ANY = TYPE_FILE | TYPE_DIR | TYPE_PIPE,
46 volatile EntryType type_;
47 volatile EntryRights rights_;
54 std::list<DirEnt> entries_;
56 DirEnt(std::string name, std::string path, EntryType type,
65 return (
unsigned)(type_) & TYPE_DIR;
69 return (
unsigned)(type_) & TYPE_LINK;
73 return (
unsigned)(type_) & TYPE_FILE;
77 return (
unsigned)(rights_) & ENTRY_READ;
80 std::string pathName() {
81 std::ostringstream os;
86 std::string fullName() {
87 std::ostringstream os;
88 os << path_ <<
"/" << name_;
93 friend std::ostream& operator<<(std::ostream& os, DirEnt& entry);
98 DirList(std::string path,
bool descend);
103 DirList(
const DirList& objToBeCopied);
108 DirList(DirList& objToBeCopied);
113 void operator=(
const DirList& objToBeAssigned);
118 void operator=(DirList& objToBeAssigned);
123 friend std::ostream& operator<<(std::ostream& os, DirList& obj);
135 std::list<DirEnt> getFiles(
bool includeSymlinks=
false);
136 std::list<DirEnt> getDirs(
bool includeSymlinks=
false);
138 void listEntries(std::list<DirEnt>& entries);
144 std::list<DirEnt> entries_;
146 void findEntries(std::list<DirEnt>& entries_, std::string path,
152 bool testPathname(std::string path, EntryType type,
unsigned rights);
157 EntryType getType(std::string path,
bool link=
false);
161 DirList::EntryRights getRights(std::string path);
163 void getFiles(std::list<DirEnt>& files,
164 std::list<DirEnt>& entries,
bool includeSymlinks);
166 void getDirs(std::list<DirEnt>& dirs,
167 std::list<DirEnt>& entries,
bool includeSymlinks);
176 #endif // End #ifndef SZA_UTIL_DIRLIST_H