rocs/RocsCore
RocsGraphFileFormatPlugin.cpp
Go to the documentation of this file.
85 setError(CouldNotOpenFile, i18n("Could not open file \"%1\" in read mode: %2", file().toLocalFile(), fileHandle.errorString()));
123 else if (str.startsWith(QLatin1String("X-plugin-")) && tmpObject && dynamic_cast<DataStructure*>(tmpObject)) {
126 dynamic_cast<DataStructure*>(tmpObject)->getDataStructure()->setPluginProperty(identifier, property);
144 if (dataLine.startsWith(QLatin1String("Name :"))) tmpDataType->setName(dataLine.section(' ', 2));
156 } else if (dataLine.startsWith(QLatin1String("Color :"))) tmpDataType->setDefaultColor(QColor(dataLine.section(' ', 2)));
266 tmpPointer = tmpDataStructure->createPointer(dataMap[nameFrom.toInt()],dataMap[nameTo.toInt()], type);
269 tmpPointer = tmpDataStructure->createPointer(dataMap[nameFrom.toInt()],dataMap[nameTo.toInt()], 0);
298 KSaveFile saveFile(!file().toLocalFile().endsWith(".graph") ? QString("%1.graph").arg(file().toLocalFile()) : file().toLocalFile());
301 setError(FileIsReadOnly, i18n("Could not open file \"%1\" in write mode: %2", file().fileName(), saveFile.errorString()));
312 setError(FileIsReadOnly, i18n("Could not write data, aborting. Error: %1.", saveFile.errorString()));
325 % QString("DataStructurePlugin : ") % DataStructureBackendManager::self().activeBackend()->internalName() % QChar('\n')
331 properties.append(property + QString('=') + document.dataType(dataTypeIdentifier)->propertyDefaultValue(property).toString());
337 % QString("Color : ") % document.dataType(dataTypeIdentifier)->defaultColor().name() % QChar('\n')
346 properties.append(property + QString('=') + document.pointerType(pointerTypeIdentifier)->propertyDefaultValue(property).toString());
350 QString direction = (document.pointerType(pointerTypeIdentifier)->direction() == PointerType::Bidirectional)
354 d->_buffer += QString("[PointerType %1]").arg(QString::number(pointerTypeIdentifier)) % QChar('\n')
356 % QString("Color : ") % document.pointerType(pointerTypeIdentifier)->defaultColor().name() % QChar('\n')
357 % QString("LineStyle : ") % QString::number(document.pointerType(pointerTypeIdentifier)->lineStyle()) % QChar('\n')
372 d->_buffer += QString("X-plugin-%1 : %2").arg(propertyIter.key()).arg(propertyIter.value()) % QChar('\n');
virtual void setPluginProperty(const QString &, const QString &)
Set plugin specific properties of data structure.
Definition: DataStructure.cpp:585
void setCodec(QTextCodec *codec)
~RocsGraphFileFormatPlugin()
Definition: RocsGraphFileFormatPlugin.cpp:62
int registerDataType(const QString &name, int identifier=0)
Register new type for data elements.
Definition: Document.cpp:124
DataStructureBackendInterface * activeBackend() const
Returns the currently active data structure backend.
Definition: DataStructureBackendManager.cpp:275
Definition: PointerType.h:48
Definition: DataStructure.h:43
QString readLine(qint64 maxlen)
QString errorString() const
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
const_iterator constBegin() const
QString simplified() const
virtual const QMetaObject * metaObject() const
virtual const QStringList extensions() const
File extensions that are common for this file type.
Definition: RocsGraphFileFormatPlugin.cpp:67
QString join(const QString &separator) const
QString & remove(int position, int n)
virtual void writeFile(Document &graph)
Writes given graph document to formerly specified file.
Definition: RocsGraphFileFormatPlugin.cpp:296
static const KAboutData pluginAboutData("rocs_rocsgraphfileformat", 0, ki18nc("@title Displayed plugin name","Rocs Graph File Backend"),"0.2", ki18n("Read and write Rocs Graph Files"), KAboutData::License_GPL_V2)
static DataStructureBackendManager & self()
Returns self reference to backend manager.
Definition: DataStructureBackendManager.cpp:233
Definition: PointerType.h:47
const char * name() const
int propertyCount() const
QString number(int n, int base)
void append(const T &value)
bool atEnd() const
QVariant property(const char *name) const
void setBackend(const QString &pluginIdentifier)
Set data structure plugin for this document.
Definition: Document.cpp:441
void setError(Error error, QString message=QString())
Definition: GraphFilePluginInterface.cpp:83
virtual void readFile()
Open given file and imports it into internal format.
Definition: RocsGraphFileFormatPlugin.cpp:74
int toInt(bool *ok, int base) const
bool isEmpty() const
QString trimmed() const
const_iterator constEnd() const
DataStructurePtr addDataStructure(const QString &name=QString())
Add data structure to graph document with name name.
Definition: Document.cpp:333
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
int registerPointerType(const QString &name, int identifier=0)
Register new type for pointers.
Definition: Document.cpp:142
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
bool contains(QChar ch, Qt::CaseSensitivity cs) const
Definition: Document.h:41
const char * name() const
const Key key(const T &value) const
QList< DataStructurePtr > & dataStructures() const
Definition: Document.cpp:227
RocsGraphFileFormatPlugin(QObject *parent)
Definition: RocsGraphFileFormatPlugin.cpp:55
float toFloat(bool *ok) const
QList< int > pointerTypeList() const
Getter for all registered pointer types.
Definition: Document.cpp:165
QString internalName()
return the internal name from plugin.
Definition: DataStructureBackendInterface.cpp:63
QList< int > dataTypeList() const
Getter for all registered data types.
Definition: Document.cpp:160
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
bool setProperty(const char *name, const QVariant &value)
iterator insert(const Key &key, const T &value)
void setGraphDocument(Document *document)
Definition: GraphFilePluginInterface.cpp:108
QList< QByteArray > dynamicPropertyNames() const
const_iterator constEnd() const
const_iterator constBegin() const
int compare(const QString &other) const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString toString() const
const KUrl & file() const
Definition: GraphFilePluginInterface.cpp:120
This class provides an interface for graph file format plugins.
Definition: GraphFilePluginInterface.h:42
QByteArray toAscii() const
QMetaProperty property(int index) const
const T value(const Key &key) const
QByteArray toUtf8() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.