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

ReadAction

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

    ReadAction

    02340124

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

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

    ReadAction

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

    uni-folder.vercel.app

    readaction.h

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

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

    #pragma once
    
    #include <fstream>
    #include <vector>
    
    #include "Action.h"
    
    /**
     * @class ReadAction
     * A subtype of Action, it shows the user what is in a specific file or folder
     * or, puts the contents of a file to an external file in the host system.
     */
    class ReadAction : public Action {
    public:
        /**
         * Creates the action with the necessary ingredients to read a file.
         * @param hostPath the path in the host system if we want to export the file.
         * @param text the list(vector) of lines to read/export.
         * @param isCout if true, it shows the user. if false, sends the content to the hostPath.
         */
        ReadAction(const std::string& hostPath, const std::vector<std::string>& text, bool isCout);
    
        virtual ~ReadAction() = default;
    
        /**
         * @brief Executes the action
         */
        virtual void execute() const override;
    
    private:
        const std::string hostPath;
        const std::vector<std::string> lines;
        bool isCout;
    };