הערה (קובץ קוד)
קובץ זה הוא קובץ קוד מסוג C.
#pragma once
#include "File.h"
#include <string>
#include <list>
#include <memory>
#include "TextFile.h"
/**
* @class SymbolicLink
* A subtype of File, it provides a way to have a file in a couple of different places in the system
* without duplicating it.
*/
class SymbolicLink : public File {
public:
/**
* Creates a new link with the file provided in the path vector
* @param name the name of the link.
* @param parent the parent folder the link is in.
* @param pathVector the path to the file the link links to from the root directory.
*/
SymbolicLink(const std::string& name, Directory* parent,
const std::vector<std::string>& pathVector);
virtual ~SymbolicLink() = default;
using File::operator[];
/**
* This operator returns the file that is in the given relative path from this file.
* @param path The relative path to search at.
* @return A reference to the file in the relative path.
*/
virtual File& operator[](std::list<std::string> path) override;
/**
* This operator returns the file that is in the given relative path from this file.
* @param path The relative path to search at.
* @return A reference to the file in the relative path.
*/
virtual const File& operator[](std::list<std::string> path) const override;
/**
* Creates a ReadAction of a fitting type to the inputted user data.
* @param request The data to send to create the action.
* @return The action created.
*/
virtual std::unique_ptr<Action> CreateReadAction(ReadRequest& request) const override;
/**
* Creates a WriteAction of a fitting type to the inputted user data.
* @param request The data to send to create the action.
* @return The action created.
*/
virtual std::unique_ptr<Action> CreateWriteAction(WriteRequest& request) override;
/**
* Creates a SearchAction of a fitting type to the inputted user data.
* @param request The data to send to create the action.
* @return The action created.
*/
virtual std::unique_ptr<Action> CreateSearchAction(SearchRequest& request) const override;
/**
* @return The file the link links to.
*/
TextFile& getFile() const;
private:
std::vector<std::string> pathVector;
};