#include <molequeue/filespecification.h>
Public Types | |
enum | Format { InvalidFileSpecification = -1, PathFileSpecification = 0, ContentsFileSpecification } |
Public Member Functions | |
FileSpecification () | |
FileSpecification (const QJsonObject &json) | |
FileSpecification (const QString &path) | |
FileSpecification (const QString &filename_, const QString &contents_) | |
FileSpecification (QFile *file, Format format_=PathFileSpecification) | |
FileSpecification (const FileSpecification &other) | |
FileSpecification & | operator= (const FileSpecification &other) |
~FileSpecification () | |
Format | format () const |
bool | isValid () const |
QByteArray | toJson () const |
QJsonObject | toJsonObject () const |
bool | fileExists () const |
bool | writeFile (const QDir &dir, const QString &filename_=QString()) const |
QString | filename () const |
QString | contents () const |
QString | filepath () const |
bool | fileHasExtension () const |
QString | fileBaseName () const |
QString | fileExtension () const |
Specify files for simplifying Client-Server communication.
The FileSpecification class contains a description of a file to facilite file manipulation during RPC communication. Files are stored as either a path to the local file on disk, or a filename and content string.
enum Format |
Creates an invalid FileSpecification.
|
explicit |
Create a FileSpecification using the members of the input QJsonObject.
|
explicit |
Create a FileSpecification from the input absolute filepath.
FileSpecification | ( | const QString & | filename_, |
const QString & | contents_ | ||
) |
Create a FileSpecification from the filename and content strings.
FileSpecification | ( | QFile * | file, |
Format | format_ = PathFileSpecification |
||
) |
Create a FileSpecification from the specified file using the indicated format
FileSpecification | ( | const FileSpecification & | other | ) |
Copy a FileSpecification.
~FileSpecification | ( | ) |
Destroy the FileSpec.
FileSpecification& operator= | ( | const FileSpecification & | other | ) |
Copy a FileSpecification.
Format format | ( | ) | const |
bool isValid | ( | ) | const |
QByteArray toJson | ( | ) | const |
QJsonObject toJsonObject | ( | ) | const |
bool fileExists | ( | ) | const |
bool writeFile | ( | const QDir & | dir, |
const QString & | filename_ = QString() |
||
) | const |
Write contents() to a file with filename_ in dir. If filename is not specified, filename() will be used instead (default).
QString filename | ( | ) | const |
QString contents | ( | ) | const |
QString filepath | ( | ) | const |
bool fileHasExtension | ( | ) | const |
QString fileBaseName | ( | ) | const |
QString fileExtension | ( | ) | const |