Web framework C++  2.0.0
Simple web framework on c++ designed to easily create web pages, etc
Public Member Functions | List of all members
FsComponent Class Referenceabstract

Interface for filesystem entity - file or path. Composite template. More...

#include <fs_component.h>

Inheritance diagram for FsComponent:
Inheritance graph
Collaboration diagram for FsComponent:
Collaboration graph

Public Member Functions

virtual ~FsComponent ()=default
 
virtual std::string getName ()=0
 
virtual std::string getFileContent ()=0
 
virtual std::string findFileAndGetContent (std::string &filePath)=0
 
virtual void add (FsComponent *component)=0
 
virtual void remove (FsComponent *component)=0
 
virtual bool isComposite ()=0
 

Detailed Description

Interface for filesystem entity - file or path. Composite template.

This class is intended to represent a filesystem hierarchy as composite template and quickly find any file with specified path and get it's content.

Constructor & Destructor Documentation

virtual FsComponent::~FsComponent ( )
virtualdefault

virtual destructor

Member Function Documentation

virtual void FsComponent::add ( FsComponent component)
pure virtual

Add FsComponent to current entity's children

Parameters
componentFsComponent object - file or folder
Exceptions
RuntimeException,ifthis component was not a folder

Implemented in FsFolder, and FsFile.

virtual std::string FsComponent::findFileAndGetContent ( std::string &  filePath)
pure virtual

recursively find a file with such path in folder hierarchy and read it's content

Parameters
filePathfile path of file relatively root folder
Returns
content, that was read from file with specified filepath
Exceptions
RuntimeException,ifthis component was not a folder

Implemented in FsFolder, and FsFile.

virtual std::string FsComponent::getFileContent ( )
pure virtual

returns a content, stored in this file.

Returns
content, that was read from file
Exceptions
RuntimeException,ifthis component was not a file

Implemented in FsFolder, and FsFile.

virtual std::string FsComponent::getName ( )
pure virtual

get name of current component

Returns
name of component as string

Implemented in FsFolder, and FsFile.

virtual bool FsComponent::isComposite ( )
pure virtual

Check, if current entity is composite and have children

Returns
true, if this component is folder, false otherwise

Implemented in FsFolder, and FsFile.

virtual void FsComponent::remove ( FsComponent component)
pure virtual

Remove FsComponent from current entity's children

Parameters
componentFsComponent object - file or folder
Exceptions
RuntimeException,ifthis component was not a folder

Implemented in FsFolder, and FsFile.


The documentation for this class was generated from the following file: