[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
klfdatautil.h
Go to the documentation of this file.
1/***************************************************************************
2 * file klfdatautil.h
3 * This file is part of the KLatexFormula Project.
4 * Copyright (C) 2011 by Philippe Faist
5 * philippe.faist at bluewin.ch
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21 ***************************************************************************/
22/* $Id$ */
23
24#ifndef KLFDATAUTIL_H
25#define KLFDATAUTIL_H
26
27#include <QString>
28#include <QStringList>
29#include <QDomElement>
30
31#include <klffactory.h>
32
38KLF_EXPORT QByteArray klfDataToEscaped(const QByteArray& data, char escapechar = '\\');
39
46KLF_EXPORT QByteArray klfEscapedToData(const QByteArray& escaped, char escapechar = '\\');
47
48
74KLF_EXPORT QByteArray klfSaveVariantToText(const QVariant& value, bool saveListAndMapsAsXML = false,
75 QByteArray * savedType = NULL,
76 QByteArray * savedListOrMapType = NULL);
77
97KLF_EXPORT QVariant klfLoadVariantFromText(const QByteArray& string, const char * dataTypeName,
98 const char *listOrMapTypeName = NULL);
99
100
102KLF_EXPORT QDomElement klfSaveVariantMapToXML(const QVariantMap& vmap, QDomElement xmlNode);
104KLF_EXPORT QVariantMap klfLoadVariantMapFromXML(const QDomElement& xmlNode);
105
107KLF_EXPORT QDomElement klfSaveVariantListToXML(const QVariantList& vlist, QDomElement xmlNode);
109KLF_EXPORT QVariantList klfLoadVariantListFromXML(const QDomElement& xmlNode);
110
111
112
113
114
115
117
124{
125public:
128
129 virtual QStringList supportedTypes() const = 0;
130
131 virtual QString recognizeDataFormat(const QByteArray& data) const = 0;
132
134 virtual bool load(const QByteArray& data, KLFAbstractPropertizedObject * obj, const QString& format) = 0;
135
138private:
139 static KLFFactoryManager pFactoryManager;
140};
141
142
143
145
150 const QString& format = QString());
151
152
153
154
155
156#endif
An abstract object characterized by properties.
Definition klfpobj.h:59
Inherit this class to implement a custom saver for KLFAbstractPropertizedObjects.
virtual QString recognizeDataFormat(const QByteArray &data) const =0
virtual QStringList supportedTypes() const =0
virtual bool load(const QByteArray &data, KLFAbstractPropertizedObject *obj, const QString &format)=0
static KLFAbstractPropertizedObjectSaver * findSaverFor(const QString &format)
static KLFAbstractPropertizedObjectSaver * findRecognizedFormat(const QByteArray &data, QString *format=NULL)
virtual QByteArray save(const KLFAbstractPropertizedObject *obj, const QString &format)=0
Base class for factories.
Definition klffactory.h:41
A base abstract factory manager class.
Definition klffactory.h:92
const char * format
KLF_EXPORT QByteArray klfDataToEscaped(const QByteArray &data, char escapechar='\\')
KLF_EXPORT bool klfLoad(const QByteArray &data, KLFAbstractPropertizedObject *obj, const QString &format=QString())
KLF_EXPORT QByteArray klfSaveVariantToText(const QVariant &value, bool saveListAndMapsAsXML=false, QByteArray *savedType=NULL, QByteArray *savedListOrMapType=NULL)
KLF_EXPORT QByteArray klfSave(const KLFAbstractPropertizedObject *obj, const QString &="XML")
KLF_EXPORT QVariant klfLoadVariantFromText(const QByteArray &string, const char *dataTypeName, const char *listOrMapTypeName=NULL)
KLF_EXPORT QDomElement klfSaveVariantListToXML(const QVariantList &vlist, QDomElement xmlNode)
Lossless save of full list to XML with type information.
KLF_EXPORT QDomElement klfSaveVariantMapToXML(const QVariantMap &vmap, QDomElement xmlNode)
Lossless save of full map to XML with type information.
KLF_EXPORT QVariantMap klfLoadVariantMapFromXML(const QDomElement &xmlNode)
Load a map saved with klfSaveVariantMapToXML()
KLF_EXPORT QVariantList klfLoadVariantListFromXML(const QDomElement &xmlNode)
Load a list saved with klfSaveVariantListToXML()
KLF_EXPORT QByteArray klfEscapedToData(const QByteArray &escaped, char escapechar='\\')
#define KLF_EXPORT
Definition klfdefs.h:41

Generated by doxygen 1.11.0