Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9869 in orxonox.OLD for trunk/src/lib/util/filesys/directory.h


Ignore:
Timestamp:
Oct 3, 2006, 12:19:30 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/filesys/directory.h

    r8333 r9869  
    2929#include <vector>
    3030
     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 */
    3139class Directory : public File
    3240{
     
    4149  bool create();
    4250
     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
    4358  /** @returns if the Directory was opened */
    4459  bool isOpen() const { return this->_opened; }
     
    5065  const std::string& operator[](unsigned int fileNumber) const { return this->_fileNames[fileNumber]; };
    5166  /** @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]; };
    5368  /** @returns a File pointing to the File @param fileNumber the fileNumber (must not bigger than fileCount()) */
    5469  File getFile(unsigned int fileNumber) const { return File(fileNameInDir(fileNumber)); };
     70
     71public:
     72  static const char           delimiter;        //!< A Delimiter (*nix: '/', windows: '\\')
    5573
    5674private:
     
    5876  std::vector<std::string>    _fileNames;       //!< The List of Files contained in the directory. (will be filled when open was called.)
    5977};
     78
     79File operator+(const Directory& dir, const File& file);
    6080
    6181#endif /* __DIRECTORY_H_ */
Note: See TracChangeset for help on using the changeset viewer.