jeudi 7 janvier 2021

Finding and compering Path of File - C++

I have been asked to create a method that getting string that contain a path of Folder, and then i need to find it and return a pointer to the Folder.

ADFILE Class is like root. All folders and files (i have been asked too), are store in **files. I need somehow to run all over files and find the Folder that i need. For Example C:\myFiles\folder2 and of course could be hundred of folders so thats make it hard.

The functions is called void mkDir(string);

Example

 class Folder : public ADFile
{
    ADFile** files;
    int arrSize;
    string filePath;
    static Folder*(root);

public:
    Folder(string, string);
    string getFullPath();
    void addFileToArray(ADFile *);
    Folder(Folder &, const string); //copy constructor
    void mkFile(string, string);
    void mkDir(string);
    void dir(ADFile*);
    static Folder* cd(string);
    virtual bool operator ==(Folder &);
    virtual friend ostream&  operator <<(ostream& out, Folder& file);

    friend class ADFile FC(Folder&, string, string);
};

class ADFile
{
    string fileName;
    tm *lastUpdateTime;

public:
    ADFile(string);
    
    void setFileName(string);
    string getFileName();
    void setTime();
    string getTime() const;
    virtual bool operator == (const string) const;
    virtual friend ostream&  operator <<(ostream& out,  ADFile& file);
    //bool isFolder();
};

Aucun commentaire:

Enregistrer un commentaire