Guest User

Untitled

a guest
Apr 26th, 2019
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. // Created by Lorenzo Del Sordo on 2019-04-26.
  3. //
  4.  
  5. #ifndef UNTITLED2_DIRECTORY_H
  6. #define UNTITLED2_DIRECTORY_H
  7.  
  8.  
  9. #include <vector>
  10. #include "Base.h"
  11. #include "File.h"
  12.  
  13. class Directory: public Base {
  14. protected:
  15.     Directory();
  16. private:
  17.     static std::shared_ptr<Directory> instance;
  18.     int type;
  19.     std::vector<std::shared_ptr<Base>> list;
  20.     std::weak_ptr<Directory> father;
  21.     std::weak_ptr<Directory> me;
  22. public:
  23.     static std::shared_ptr<Directory> getRoot();
  24.     std::shared_ptr<Directory> addDirectory(std::string nome);
  25.     std::shared_ptr<File> addFile(std::string nome,uintmax_t size);
  26.     std::shared_ptr<Base> get(std::string name);
  27.     std::shared_ptr<Base> getDir(std::string name);
  28.     std::shared_ptr<File> getFile(std::string name);
  29.     void remove(std::string nome);
  30.     void ls(int indent=0) const override;
  31.     int mType() const override ;
  32. };
  33.  
  34.  
  35. #endif //UNTITLED2_DIRECTORY_H
RAW Paste Data