Subversion Repositories spk

Rev

Rev 129 | Rev 183 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef __DIRIO_H__
#define __DIRIO_H__

#include "Utils/StringList.h"
#include "StringList.h"
#include "spkdll.h"

class CFileIO;

class SPKEXPORT CDirIO
{
public:
        static bool Exists(const Utils::String &dir);

public:
        CDirIO ();
        CDirIO ( CyString dir );
        CDirIO ( CFileIO *file );
        ~CDirIO ();

        void setDir(const Utils::String& dir);

        // access functions
        bool exists() const;
        bool exists(const Utils::String &dir) const;
        bool isDir() const;
        bool isDir(const Utils::String &dir) const;
        bool isFile() const;
        bool isFile(const Utils::String &dir) const;

        // directory handling
        bool create() const;
        bool create(const Utils::String &dir) const;
        bool createAndChange(const Utils::String &dir);

        bool move(const Utils::String &to);
        bool move(const Utils::String& from, const Utils::String& to);
        bool RemoveDir(CyString dir, bool doFiles = false, bool recursive = false, CyStringList* errors = NULL);
        bool removeDir(const Utils::String &dir, bool doFiles = false, bool recursive = false, Utils::CStringList* errors = NULL);
        bool cd(const Utils::String &dir);

        bool dirList(Utils::CStringList &files, Utils::String dir = Utils::String::Null(), Utils::String filePattern = Utils::String::Null()) const;
        bool checkEmptyDir(const Utils::CStringList &dirList) const;

        Utils::String file(const Utils::String &filename) const;
        Utils::String dir(const Utils::String &sDir) const;
        const Utils::String &dir() const;
        Utils::String topDir() const;
        const Utils::String &moveBack();
        Utils::String back() const;

private:
        Utils::String _parseDir(const Utils::String &dir) const;

        Utils::String m_sCurrentDir;
};

#endif //__DIRIO_H__