Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7625 in orxonox.OLD for branches/qt_gui


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

qt_gui: Directory in File-style

Location:
branches/qt_gui/src/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/qt_gui/src/lib/parser/ini_parser/ini_parser.h

    r7624 r7625  
    1818 * This class can be used to load an initializer file and parse it's contents for variablename=value pairs.
    1919 */
    20 class IniParser
     20class IniParser : public File
    2121{
    2222  private:
  • branches/qt_gui/src/lib/shell/shell_completion_plugin.cc

    r7616 r7625  
    9898    if (completionBegin.empty()) // if we do not yet have the beginning of the line, start with the chosen startDir.
    9999    {
    100       dir.open(ResourceManager::getInstance()->getDataDir() + this->_subDir);
     100      dir.setFileName(ResourceManager::getInstance()->getDataDir() + this->_subDir);
     101      dir.open();
    101102      while(dir)
    102103      {
     
    112113        directoryName = completionBegin.substr(0, pos);
    113114
    114       dir.open(ResourceManager::getInstance()->getDataDir() + directoryName);
     115      dir.setFileName(ResourceManager::getInstance()->getDataDir() + directoryName);
     116      dir.open();
    115117
    116118      std::string fileName;
  • 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.