Changeset 9869 in orxonox.OLD for trunk/src/lib/util/filesys/directory.h
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/filesys/directory.h
r8333 r9869 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 { … … 41 49 bool create(); 42 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 57 43 58 /** @returns if the Directory was opened */ 44 59 bool isOpen() const { return this->_opened; } … … 50 65 const std::string& operator[](unsigned int fileNumber) const { return this->_fileNames[fileNumber]; }; 51 66 /** @returns a formated string containing the FileName, prepended with the directory-Name */ 52 std::string fileNameInDir(unsigned int fileNumber) const { return this->name() + "/"+ _fileNames[fileNumber]; };67 std::string fileNameInDir(unsigned int fileNumber) const { return this->name() + Directory::delimiter + _fileNames[fileNumber]; }; 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: … … 58 76 std::vector<std::string> _fileNames; //!< The List of Files contained in the directory. (will be filled when open was called.) 59 77 }; 78 79 File operator+(const Directory& dir, const File& file); 60 80 61 81 #endif /* __DIRECTORY_H_ */
Note: See TracChangeset
for help on using the changeset viewer.