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

Base class and factory for files. More...

#include <file.h>

Public Member Functions

virtual ~File ()=0
 Destructs the file. More...
 
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 ()
 Constructs a file. More...
 

Detailed Description

Base class and factory for files.

Constructor & Destructor Documentation

retdec::File::~File ( )
pure virtualdefault

Destructs the file.

retdec::File::File ( const File )
delete
retdec::File::File ( File &&  )
delete
retdec::File::File ( )
protecteddefault

Constructs a file.

Member Function Documentation

std::unique_ptr< File > retdec::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.
std::unique_ptr< File > retdec::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.

std::unique_ptr< File > retdec::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.

retdec::File::getContent ( )
pure virtual

Returns the content of the file.

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

Returns the name of the file.

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

File& retdec::File::operator= ( const File )
delete
File& retdec::File::operator= ( File &&  )
delete
retdec::File::saveCopyTo ( const std::string &  directoryPath)
pure virtual

Stores a copy of the file into the given directory.

retdec::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: