חזור לתיקייה: actions

CreateAction

חיפוש בתיקיה
Ctrl K
לחץ כאן או הקש Ctrl K כדי לחפש בכל התיקיה

    CreateAction

    02340124

    מבוא לתכנות מערכות

    רשימות הרצאה לקריאה בשבת

    CreateAction

    הופק מתוך תקיית התואר של שקד

    uni-folder.vercel.app

    createaction.h

    הערה (קובץ קוד)

    קובץ זה הוא קובץ קוד מסוג C.

    #pragma once
    
    #include <fstream>
    #include <vector>
    
    #include "Action.h"
    #include "Directory.h"
    
    /**
     * @class CreateAction
     * A subtype of Action, it creates a file in a specific place in the system.
     */
    class CreateAction : public Action {
    public:
        /**
         * Creates a CreateAction with the necessary ingredients to create a file. (yes, it's a soup)
         * @param name the name of the file that is going to be created.
         * @param type the type of the file(textfile, symlink, directory)
         * @param pathVector if it's a symlink, than that's the path from root the the file it links to.
         * @param directory the parent folder of the file in the system.
         */
        CreateAction(const std::string& name, const std::string& type,
                     const std::vector<std::string>& pathVector, Directory& directory);
    
        virtual ~CreateAction() = default;
    
        /**
         * @brief Executes the action
         */
        virtual void execute() const override;
    
    private:
        const std::string name;
        const std::string type;
        const std::vector<std::string> pathVector;
        Directory& parent;
    };