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

Representation of folder in filesystem. More...

#include <fs_folder.h>

Inheritance diagram for FsFolder:
Inheritance graph
Collaboration diagram for FsFolder:
Collaboration graph

Public Member Functions

 ~FsFolder () override
 
 FsFolder (std::string &name)
 
 FsFolder (const char *name)
 
std::string getName () override
 
std::string getFileContent () override
 
std::string findFileAndGetContent (std::string &filePath) override
 
void add (FsComponent *component) override
 
void remove (FsComponent *component) override
 
bool isComposite () override
 
- Public Member Functions inherited from FsComponent
virtual ~FsComponent ()=default
 

Protected Attributes

std::list< FsComponent * > children
 

Detailed Description

Representation of folder in filesystem.

This class is intended to represent a folder in filesystem hierarchy

Constructor & Destructor Documentation

FsFolder::~FsFolder ( )
override

delete all inner hierarchy

FsFolder::FsFolder ( std::string &  name)
explicit

Create a FsFolder object with specified name

Parameters
namename of current folder as string
FsFolder::FsFolder ( const char *  name)
explicit

Create a FsFolder object with specified name

Parameters
namename of current folder as const char *

Member Function Documentation

void FsFolder::add ( FsComponent component)
overridevirtual

Add FsComponent to current entity's children

Parameters
componentFsComponent object - file or folder

Implements FsComponent.

std::string FsFolder::findFileAndGetContent ( std::string &  filePath)
overridevirtual

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

Implements FsComponent.

std::string FsFolder::getFileContent ( )
overridevirtual
Exceptions
RuntimeException,ifthis component was not a file

Implements FsComponent.

std::string FsFolder::getName ( )
overridevirtual

get name of current folder

Returns
name of folder as string

Implements FsComponent.

bool FsFolder::isComposite ( )
overridevirtual

Check, if current entity is composite and have children

Returns
true, because it's a folder

Implements FsComponent.

void FsFolder::remove ( FsComponent component)
overridevirtual

Remove FsComponent from current entity's children

Parameters
componentFsComponent object - file or folder

Implements FsComponent.

Member Data Documentation

std::list<FsComponent *> FsFolder::children
protected

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