Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7625 in orxonox.OLD for branches/qt_gui/src/lib/util


Ignore:
Timestamp:
May 16, 2006, 9:17:10 AM (18 years ago)
Author:
bensch
Message:

qt_gui: Directory in File-style

Location:
branches/qt_gui/src/lib/util
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/qt_gui/src/lib/util/directory.cc

    r7624 r7625  
    4242#endif
    4343Directory::Directory(const std::string& directoryName)
    44     : willfail(false)
     44  : File(directoryName), willfail(false)
    4545{
    4646  this->handle = 0;
     
    5252}
    5353
    54 bool Directory::open(const std::string& directoryName)
     54bool Directory::open()
    5555{
    5656#if not defined(__WIN32__)
    5757  if (this->handle != NULL)
    5858    this->close();
    59   this->handle = opendir(directoryName.c_str());
     59  this->handle = opendir(this->name().c_str());
    6060  if (!handle)
    6161    willfail = true;
     
    7575    // First check the attributes trying to access a non-Directory with
    7676    // FindFirstFile takes ages
    77     DWORD attrs = GetFileAttributes(directoryName.c_str());
     77    DWORD attrs = GetFileAttributes(this->name().c_str());
    7878    if ( (attrs == 0xFFFFFFFF) || ((attrs && FILE_ATTRIBUTE_DIRECTORY) == 0) )
    7979    {
     
    8181      return false;
    8282    }
    83     std::string Full(directoryName);
     83    std::string Full(this->name());
    8484    // Circumvent a problem in FindFirstFile with c:\\* as parameter
    8585    if ( (Full.length() > 0) && (Full[Full.length()-1] != '\\') )
  • branches/qt_gui/src/lib/util/directory.h

    r7624 r7625  
    4242  ~Directory();
    4343
    44   virtual bool open(const std::string& directoryName);
     44  virtual bool open();
    4545  virtual bool close();
    4646  operator void*() const { return willfail ? (void*)0:(void*)(-1); }
  • branches/qt_gui/src/lib/util/file.h

    r7622 r7625  
    1111typedef struct stat;
    1212
     13//! A Class to Handle Files.
    1314class File
    1415{
    1516  public:
     17  //! How the File should be opened.
    1618  typedef enum
    1719  {
    18     ReadOnly,
    19     WriteOnly,
    20     ReadWrite,
    21     Append,
     20    ReadOnly,      //!< ReadOnly mode
     21    WriteOnly,     //!< WriteOnly mode
     22    ReadWrite,     //!< Read and Write mode together
     23    Append,        //!< Append at the end.
    2224  } OpenMode;
    2325
Note: See TracChangeset for help on using the changeset viewer.