LiveDocument Class

Encapsulates a relative path to a workspace document. More...

Header: #include <LiveDocument>

Public Functions

LiveDocument(const QString &relativeFilePath)
QString absoluteFilePathIn(const QDir &workspace) const
QString errorString() const
bool existsIn(const QDir &workspace) const
bool isFileIn(const QDir &workspace) const
bool isNull() const
QString relativeFilePath() const

Static Public Members

LiveDocument resolve(const QDir &workspace, const QString &filePath)

Detailed Description

Member Function Documentation

LiveDocument::LiveDocument(const QString &relativeFilePath)

Constructs instance for the given relativeFilePath.

The relativeFilePath MUST NOT be an empty string, it MUST be a relative path, and when resolved relatively to a directory it MUST NOT resolve to a path outside of the directory.


Constructs a null instance.

See also isNull() and errorString().

QString LiveDocument::absoluteFilePathIn(const QDir &workspace) const

Returns the absolute file path within a workspace, including the file name.

QString LiveDocument::errorString() const

When called just after resolve(), existsIn() or isFileIn() failed, returns a descriptive message suitable for displaying in user interface. When called in other context, the result is undefined.

bool LiveDocument::existsIn(const QDir &workspace) const

Returns true if this document exists in the given workspace directory.

See also errorString().

bool LiveDocument::isFileIn(const QDir &workspace) const

Returns true if this document exists as a regular file (or a symbolic link to a regular file) in the given workspace directory.

Symbolic links resolution applies.

See also errorString().

bool LiveDocument::isNull() const

Returns true if this is a null instance.

A null instance has been either contructed with the default constructor or the resolve() call failed.

See also errorString().

QString LiveDocument::relativeFilePath() const

Returns the relative file path including the file name.

[static] LiveDocument LiveDocument::resolve(const QDir &workspace, const QString &filePath)

Constructs a non-null instance unless the filePath resolves outside of the workspace directory.

filePath may be an absolute or relative file path to a file which is NOT required to exist.

See also isNull() and errorString().

© 2019 Luxoft Sweden AB. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.