ar-cpp
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
ar::File Class Referenceabstract

Base class and factory for files. More...

#include <file.h>

Public Member Functions

virtual ~File ()=0
 
virtual std::string getName () const =0
 Returns the name of the file. More...
 
virtual std::string getContent ()=0
 Returns the content of the file. More...
 
virtual void saveCopyTo (const std::string &directoryPath)=0
 Stores a copy of the file into the given directory. More...
 
virtual void saveCopyTo (const std::string &directoryPath, const std::string &name)=0
 Stores a copy of the file into the given directory under the given name. More...
 
Disabled
 File (const File &)=delete
 
 File (File &&)=delete
 
Fileoperator= (const File &)=delete
 
Fileoperator= (File &&)=delete
 

Static Public Member Functions

static std::unique_ptr< FilefromContentWithName (const std::string &content, const std::string &name)
 Returns a file containing the given content with the given name. More...
 
static std::unique_ptr< FilefromFilesystem (const std::string &path)
 Returns a file from the given path. More...
 
static std::unique_ptr< FilefromFilesystemWithOtherName (const std::string &path, const std::string &name)
 Returns a file from the given path, but with a custom name. More...
 

Protected Member Functions

 File ()
 

Detailed Description

Base class and factory for files.

Constructor & Destructor Documentation

◆ ~File()

ar::File::~File ( )
pure virtualdefault

◆ File() [1/3]

ar::File::File ( const File )
delete

◆ File() [2/3]

ar::File::File ( File &&  )
delete

◆ File() [3/3]

ar::File::File ( )
protecteddefault

Member Function Documentation

◆ fromContentWithName()

std::unique_ptr< File > ar::File::fromContentWithName ( const std::string &  content,
const std::string &  name 
)
static

Returns a file containing the given content with the given name.

Parameters
[in]contentContent of the file.
[in]nameName of the file.

◆ fromFilesystem()

std::unique_ptr< File > ar::File::fromFilesystem ( const std::string &  path)
static

Returns a file from the given path.

Parameters
[in]pathPath to the file.

The name of the file is obtained automatically.

◆ fromFilesystemWithOtherName()

std::unique_ptr< File > ar::File::fromFilesystemWithOtherName ( const std::string &  path,
const std::string &  name 
)
static

Returns a file from the given path, but with a custom name.

Parameters
[in]pathPath to the file.
[in]nameName to be used as the file's name.

Use this function only if you want to choose a different name for the file than the one it already has.

◆ getContent()

ar::File::getContent ( )
pure virtual

Returns the content of the file.

◆ getName()

ar::File::getName ( ) const
pure virtual

Returns the name of the file.

When the file has no name, the empty string is returned.

◆ operator=() [1/2]

File& ar::File::operator= ( const File )
delete

◆ operator=() [2/2]

File& ar::File::operator= ( File &&  )
delete

◆ saveCopyTo() [1/2]

ar::File::saveCopyTo ( const std::string &  directoryPath)
pure virtual

Stores a copy of the file into the given directory.

◆ saveCopyTo() [2/2]

ar::File::saveCopyTo ( const std::string &  directoryPath,
const std::string &  name 
)
pure virtual

Stores a copy of the file into the given directory under the given name.


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