#ifndef PROJECTITEM_H #define PROJECTITEM_H #include #include namespace Ember { class Project; class ProjectItem { public: enum ProjectItemType { UNKNOWN, MISSING, DIRECTORY, IMAGE, AUDIO, VIDEO, SUBTITLES, PROJECT, COMPOSITION, SEQUENCE }; /** * @brief ProjectItem constructor * @param name Name corresponding to file on disk * @param parent Parent project item * @param project Assigned project */ ProjectItem(boost::filesystem::path path, ProjectItem* parent, Project* project); // Getters /** * @brief Gets the name of the item * @return Name */ std::string name() const; /** * @brief Gets the type of the item. * @return Type of item */ ProjectItemType type(); /** * @brief Gets the parent project item. * @return Parent item */ ProjectItem *parent() const; /** * @brief Gets the parent project * @return Parent project */ Project *project() const; /** * @brief Gets a list of children. If not a directory, the list will be empty. * @return Vector of children. */ const std::vector& children(); /** * @brief Gets the path of this project item * @return */ boost::filesystem::path path() const; // Action /** * @brief Sets the name of the item. Will result in a disk rename. * @param name New name */ void rename(const std::string &name); /** * @brief Sets the parent project item. Will result in a disk move. * @param newParent New parent */ void move(ProjectItem *newParent); /** * @brief Delete from the disk. 'this' object is DELETED! * TODO: recycle bin or permanent delete? */ void unlink(); private: ProjectItem* unparentChild(ProjectItem* child); boost::filesystem::path m_path; ProjectItemType m_type; bool m_typeLoaded; ProjectItem* m_parent; std::vector m_children; bool m_childrenLoaded; Project* m_project; }; } #endif // PROJECTITEM_H