Tulip
4.4.0
Better Visualization Through Research
|
#include <TulipProject.h>
Inherits QObject.
Public Slots | |
void | setAuthor (const QString &) |
void | setDescription (const QString &) |
void | setName (const QString &) |
void | setPerspective (const QString &) |
Public Member Functions | |
QString | absoluteRootPath () const |
QString | author () const |
bool | copy (const QString &source, const QString &destination) |
QString | description () const |
QStringList | entryList (const QString &path, QDir::Filters filters=QDir::NoFilter, QDir::SortFlags sort=QDir::NoSort) |
QStringList | entryList (const QString &path, const QStringList &nameFilters, QDir::Filters filters=QDir::NoFilter, QDir::SortFlags sort=QDir::NoSort) |
bool | exists (const QString &path) |
QIODevice * | fileStream (const QString &path, QIODevice::OpenMode mode=QIODevice::ReadWrite) |
bool | isDir (const QString &path) |
bool | isValid () const |
QString | lastError () const |
bool | mkpath (const QString &path) |
QString | name () const |
QString | perspective () const |
QString | projectFile () const |
bool | removeAllDir (const QString &path) |
bool | removeDir (const QString &path) |
bool | removeFile (const QString &path) |
std::fstream * | stdFileStream (const QString &path, std::ios_base::openmode=std::fstream::in|std::fstream::out|std::fstream::app) |
QString | toAbsolutePath (const QString &relativePath) |
bool | touch (const QString &path) |
QString | version () const |
bool | write (const QString &file, tlp::PluginProgress *progress=NULL) |
Static Public Member Functions | |
static TulipProject * | newProject () |
static TulipProject * | openProject (const QString &file, tlp::PluginProgress *progress=NULL) |
static TulipProject * | restoreProject (const QString &path) |
Properties | |
QString | author |
QString | description |
QString | name |
QString | perspective |
The TulipProject object handles the content of a Tulip project.
All tulip projects contain a set of defined static meta-information:
Alongside this information, one can store any kind of file into a Tulip project. Since a project is meant to be associated to a specific perspective, the responisbility of those file is left to the perspective.
A TulipProject DOES NOT automatically save to disk. One will have to call the write() method to serialize data.
If something wrong happens when calling a method from TulipProject, this method will return either false or a invalid result (see specific method documentation). The last error message can be retrieved with the lastError() method.
After opening and before saving a project, user will be able to list/delete files and directories available in the project and open them using std filestreams or Qt's QIODevice. Files can be opened using the stdFileStram and fileStream methods. They will always be opened in Read/Write mode.
Files in a tulip project are identified by their path. Those path ar similar to the path of a standard file system and use the "/" character as a separator. The root directory is identified by "/".
Definition at line 71 of file TulipProject.h.
QString tlp::TulipProject::absoluteRootPath | ( | ) | const |
This method returns the real absolute path corresponding to / in the TulipProject.
This can be used to create a TulipProject directly from a path.
QString tlp::TulipProject::author | ( | ) | const |
bool tlp::TulipProject::copy | ( | const QString & | source, |
const QString & | destination | ||
) |
Copies a file from the local filesystem into the project.
source | The absolute path of the file to copy |
destination | The project path where to copy the file |
QString tlp::TulipProject::description | ( | ) | const |
QStringList tlp::TulipProject::entryList | ( | const QString & | path, |
QDir::Filters | filters = QDir::NoFilter , |
||
QDir::SortFlags | sort = QDir::NoSort |
||
) |
Lists entries in a directory.
path | The path to scan. |
QStringList tlp::TulipProject::entryList | ( | const QString & | path, |
const QStringList & | nameFilters, | ||
QDir::Filters | filters = QDir::NoFilter , |
||
QDir::SortFlags | sort = QDir::NoSort |
||
) |
Lists entries in a directory.
path | The path to scan. |
bool tlp::TulipProject::exists | ( | const QString & | path | ) |
Checks if the specified file/folder exists.
path | The path to check. |
QIODevice* tlp::TulipProject::fileStream | ( | const QString & | path, |
QIODevice::OpenMode | mode = QIODevice::ReadWrite |
||
) |
Gets a Qt I/O device (default to R/W access mode) to the given path.
path | The path to open. |
mode | The opening mode as described in the Qt documentation. |
bool tlp::TulipProject::isDir | ( | const QString & | path | ) |
Checks if the given path is a directory.
path | The path to check. |
|
inline |
Check if the object is a valid TulipProject.
Definition at line 242 of file TulipProject.h.
|
inline |
Returns the last error raised.
Definition at line 233 of file TulipProject.h.
bool tlp::TulipProject::mkpath | ( | const QString & | path | ) |
Recursively creates the specified path.
Created folders will be empty
QString tlp::TulipProject::name | ( | ) | const |
|
static |
Starts a new TulipProject from scratch.
This method builds up a new TulipProject file without taking any input.
|
static |
Opens a previously saved tulip project file.
This method will unpack a tulip project file into some directory and allow the user to manipulate the files.
file | The file to open. |
progress | A progress handler. |
QString tlp::TulipProject::perspective | ( | ) | const |
|
inline |
Return the archive file associated with this project.
If the project has been opened from an existing file or if the write method has already been called, this method will return the last file path specified. In other cases, this method will return an empty string.
Definition at line 252 of file TulipProject.h.
bool tlp::TulipProject::removeAllDir | ( | const QString & | path | ) |
Removes a directory and all its content from the project.
If the given file points to a file, or if the directory does not exist, this method will fail and return false.
path | The path to delete. |
bool tlp::TulipProject::removeDir | ( | const QString & | path | ) |
Removes a directory from the project.
If the given file points to a file, or if the directory does not exist, or if the directory is not empty, this method will fail and return false.
path | The path to delete. |
bool tlp::TulipProject::removeFile | ( | const QString & | path | ) |
Removes a file from the project.
If the given path points to a directory, or if the file does not exist, this method will fail and return false
path | The path to delete. |
|
static |
Restores a project which has already been extracted into path.
path | The path where the archive was previously extracted |
|
slot |
|
slot |
|
slot |
|
slot |
std::fstream* tlp::TulipProject::stdFileStream | ( | const QString & | path, |
std::ios_base::openmode | = std::fstream::in|std::fstream::out|std::fstream::app |
||
) |
Gets a STL file stream (default to R/W access mode) to the given path.
path | The path to open. |
QString tlp::TulipProject::toAbsolutePath | ( | const QString & | relativePath | ) |
Returns the absolute filesystem path used to store the file.
bool tlp::TulipProject::touch | ( | const QString & | path | ) |
Creates a empty file.
This method is similar to the UNIX's touch shell command. Except it won't renew the file's creation date if the file already exists.
file | the file to create |
QString tlp::TulipProject::version | ( | ) | const |
The version of the Tulip project format with which the file was created. Project from older format versions will always by saved into the newest version available.
bool tlp::TulipProject::write | ( | const QString & | file, |
tlp::PluginProgress * | progress = NULL |
||
) |
Writes files in the TulipProject into a packed archive.
This method packs every file in the project into a single archive.
file | Absolute path where files should be packed. |
progress | A progress handler |
|
readwrite |
Name of the author.
Definition at line 286 of file TulipProject.h.
|
readwrite |
User-written description of the project.
Definition at line 277 of file TulipProject.h.
|
readwrite |
the name of the project
Definition at line 268 of file TulipProject.h.
|
readwrite |
Name of the perspective associated to the project.
When the user open a project from Tulip, this porperty is first read to identify find kind of perspective plugin should be launched to open the project
Definition at line 300 of file TulipProject.h.