Subversion Repositories spk

Rev

Rev 124 | Rev 129 | 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(CyString 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(CyString dir = NullString);
        bool CreateAndChange(CyString dir);

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

        bool dirList(Utils::CStringList &files, Utils::String dir = Utils::String::Null(), Utils::String filePattern = Utils::String::Null()) const;
        Utils::CStringList dirList(Utils::String dir = Utils::String::Null(), Utils::String filePattern = Utils::String::Null()) const;
        CyStringList *DirList(CyString dir = NullString, CyString filepattern = NullString);
        bool CheckEmptyDir(CyStringList *dirList);

        CyString File(CyString filename);
        Utils::String file(const Utils::String &filename) const;
        CyString Dir(CyString dir = NullString);
        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__