Changeset 9719 in orxonox.OLD for branches/new_class_id/src/lib/util
- Timestamp:
- Sep 2, 2006, 1:19:24 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/util/filesys
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/filesys/directory.cc
r8523 r9719 41 41 #include <sys/stat.h> 42 42 #include <dirent.h> 43 const char Directory::delimiter = '/'; 43 44 #else 44 45 #include <windows.h> 45 46 #include <winbase.h> 47 const char Direcotry::delimiter = '\\'; 46 48 #endif 47 49 … … 63 65 */ 64 66 Directory::Directory(const Directory& directory) 65 : File(directory)67 : File(directory) 66 68 { 67 69 this->_opened = directory._opened; … … 166 168 #endif 167 169 } 170 171 172 Directory Directory::operator+(const Directory& dir) const 173 { 174 return Directory(*this) += dir; 175 } 176 177 /** 178 * @param dir the Directory to append to this one (say this one is "/var", then dir can be "log") 179 * @returns The Directory appended by dir. 180 * 181 * @note the Directoy will again be closed even if it was opened previously! 182 */ 183 Directory& Directory::operator+=(const Directory& dir) 184 { 185 this->setFileName(this->name() + Directory::delimiter + dir.name()); 186 return *this; 187 } 188 189 /** 190 * @brief Traverses the Directory tree one step up. (Parent Directory) 191 * @returns a Reference to the Directory. 192 */ 193 Directory& Directory::operator--() 194 { 195 } 196 197 198 /** 199 * @brief Traverses the Directory tree one step up. (Parent Directory) 200 * @param int the PostFix iterator 201 * @returns a Reference to the Directory. 202 */ 203 Directory& Directory::operator--(int) 204 { 205 } 206 207 /** 208 * @returns The Parent Directory. 209 */ 210 Directory Directory::parentDir() const 211 { 212 213 } -
branches/new_class_id/src/lib/util/filesys/directory.h
r8333 r9719 29 29 #include <vector> 30 30 31 //! A Directory is a Special file, that contains multiple Files. 32 /** 33 * @example Correct usage 34 * Directory dir("/var/log"); 35 * dir.open(); 36 * if (dir.fileNameInDir("emerge.log")) 37 * { // do stuff; } 38 */ 31 39 class Directory : public File 32 40 { … … 40 48 41 49 bool create(); 50 51 Directory operator+(const Directory& dir) const; 52 Directory& operator+=(const Directory& dir); 53 Directory& operator--(); 54 Directory& operator--(int); 55 Directory parentDir() const; 56 42 57 43 58 /** @returns if the Directory was opened */ … … 53 68 /** @returns a File pointing to the File @param fileNumber the fileNumber (must not bigger than fileCount()) */ 54 69 File getFile(unsigned int fileNumber) const { return File(fileNameInDir(fileNumber)); }; 70 71 public: 72 static const char delimiter; //!< A Delimiter (*nix: '/', windows: '\\') 55 73 56 74 private: -
branches/new_class_id/src/lib/util/filesys/file.cc
r8619 r9719 326 326 } 327 327 328 /** 329 * @brief converts an Absolute Filename to a Relative one 330 * @param absFileName the FileName to convert. The Relative path will be stored in absFileName. 331 */ 328 332 void File::absToRel(std::string& absFileName) 329 333 {
Note: See TracChangeset
for help on using the changeset viewer.