LibrePCB Developers Documentation
TransactionalDirectory Class Referencefinal

Helper class to access a subdirectory of TransactionalFileSystem. More...

#include <transactionaldirectory.h>

+ Inheritance diagram for TransactionalDirectory:
+ Collaboration diagram for TransactionalDirectory:

Public Member Functions

 TransactionalDirectory (QObject *parent=nullptr)
 
 TransactionalDirectory (std::shared_ptr< TransactionalFileSystem > fs, const QString &dir="", QObject *parent=nullptr) noexcept
 
 TransactionalDirectory (TransactionalDirectory &other, const QString &subdir="", QObject *parent=nullptr) noexcept
 
virtual ~TransactionalDirectory () noexcept
 
std::shared_ptr< const TransactionalFileSystemgetFileSystem () const noexcept
 
std::shared_ptr< TransactionalFileSystemgetFileSystem () noexcept
 
const QString & getPath () const noexcept
 
bool isWritable () const noexcept
 
bool isRestoredFromAutosave () const noexcept
 
virtual FilePath getAbsPath (const QString &path="") const noexcept override
 
virtual QStringList getDirs (const QString &path="") const noexcept override
 
virtual QStringList getFiles (const QString &path="") const noexcept override
 
virtual bool fileExists (const QString &path) const noexcept override
 
virtual QByteArray read (const QString &path) const override
 
virtual QByteArray readIfExists (const QString &path) const override
 
virtual void write (const QString &path, const QByteArray &content) override
 
virtual void renameFile (const QString &src, const QString &dst) override
 
virtual void removeFile (const QString &path) override
 
virtual void removeDirRecursively (const QString &path="") override
 
void copyTo (TransactionalDirectory &dest) const
 
void saveTo (TransactionalDirectory &dest)
 
void moveTo (TransactionalDirectory &dest)
 
- Public Member Functions inherited from FileSystem
 FileSystem (QObject *parent=nullptr) noexcept
 
virtual ~FileSystem () noexcept
 
virtual FilePath getAbsPath (const QString &path="") const noexcept=0
 
virtual QStringList getDirs (const QString &path="") const noexcept=0
 
virtual QStringList getFiles (const QString &path="") const noexcept=0
 
virtual bool fileExists (const QString &path) const noexcept=0
 
virtual QByteArray read (const QString &path) const =0
 
virtual QByteArray readIfExists (const QString &path) const =0
 
virtual void write (const QString &path, const QByteArray &content)=0
 
virtual void renameFile (const QString &src, const QString &dst)=0
 
virtual void removeFile (const QString &path)=0
 
virtual void removeDirRecursively (const QString &path="")=0
 

Static Private Member Functions

static void copyDirRecursively (TransactionalFileSystem &srcFs, const QString &srcDir, TransactionalFileSystem &dstFs, const QString &dstDir)
 

Private Attributes

std::shared_ptr< TransactionalFileSystemmFileSystem
 
QString mPath
 

Detailed Description

Helper class to access a subdirectory of TransactionalFileSystem.

Wraps a subdirectory of a librepcb::TransactionalFileSystem instance to allow accessing it like it was the root directory of a file system. In addition, it allows to copy or move whole directories between different transactional file systems.

Constructor & Destructor Documentation

◆ TransactionalDirectory() [1/3]

TransactionalDirectory ( QObject *  parent = nullptr)

◆ TransactionalDirectory() [2/3]

TransactionalDirectory ( std::shared_ptr< TransactionalFileSystem fs,
const QString &  dir = "",
QObject *  parent = nullptr 
)
explicitnoexcept

◆ TransactionalDirectory() [3/3]

TransactionalDirectory ( TransactionalDirectory other,
const QString &  subdir = "",
QObject *  parent = nullptr 
)
noexcept

◆ ~TransactionalDirectory()

~TransactionalDirectory ( )
virtualnoexcept

Member Function Documentation

◆ getFileSystem() [1/2]

std::shared_ptr< const TransactionalFileSystem > getFileSystem ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getFileSystem() [2/2]

std::shared_ptr< TransactionalFileSystem > getFileSystem ( )
inlinenoexcept

◆ getPath()

const QString & getPath ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ isWritable()

bool isWritable ( ) const
noexcept
+ Here is the caller graph for this function:

◆ isRestoredFromAutosave()

bool isRestoredFromAutosave ( ) const
noexcept

◆ getAbsPath()

FilePath getAbsPath ( const QString &  path = "") const
overridevirtualnoexcept

Implements FileSystem.

+ Here is the caller graph for this function:

◆ getDirs()

QStringList getDirs ( const QString &  path = "") const
overridevirtualnoexcept

Implements FileSystem.

+ Here is the caller graph for this function:

◆ getFiles()

QStringList getFiles ( const QString &  path = "") const
overridevirtualnoexcept

Implements FileSystem.

+ Here is the caller graph for this function:

◆ fileExists()

bool fileExists ( const QString &  path) const
overridevirtualnoexcept

Implements FileSystem.

+ Here is the caller graph for this function:

◆ read()

QByteArray read ( const QString &  path) const
overridevirtual

Implements FileSystem.

+ Here is the caller graph for this function:

◆ readIfExists()

QByteArray readIfExists ( const QString &  path) const
overridevirtual

Implements FileSystem.

+ Here is the caller graph for this function:

◆ write()

void write ( const QString &  path,
const QByteArray &  content 
)
overridevirtual

Implements FileSystem.

+ Here is the caller graph for this function:

◆ renameFile()

void renameFile ( const QString &  src,
const QString &  dst 
)
overridevirtual

Implements FileSystem.

◆ removeFile()

void removeFile ( const QString &  path)
overridevirtual

Implements FileSystem.

+ Here is the caller graph for this function:

◆ removeDirRecursively()

void removeDirRecursively ( const QString &  path = "")
overridevirtual

Implements FileSystem.

◆ copyTo()

void copyTo ( TransactionalDirectory dest) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTo()

void saveTo ( TransactionalDirectory dest)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveTo()

void moveTo ( TransactionalDirectory dest)
+ Here is the call graph for this function:

◆ copyDirRecursively()

void copyDirRecursively ( TransactionalFileSystem srcFs,
const QString &  srcDir,
TransactionalFileSystem dstFs,
const QString &  dstDir 
)
staticprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ mFileSystem

std::shared_ptr<TransactionalFileSystem> mFileSystem
private

◆ mPath

QString mPath
private

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