[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
src/klftools/klfdatautil.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *   file klfdatautil.h
00003  *   This file is part of the KLatexFormula Project.
00004  *   Copyright (C) 2011 by Philippe Faist
00005  *   philippe.faist at bluewin.ch
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 /* $Id$ */
00023 
00024 #ifndef KLFDATAUTIL_H
00025 #define KLFDATAUTIL_H
00026 
00027 #include <QString>
00028 #include <QStringList>
00029 #include <QDomElement>
00030 
00031 #include <klffactory.h>
00032 
00038 KLF_EXPORT QByteArray klfDataToEscaped(const QByteArray& data, char escapechar = '\\');
00039 
00046 KLF_EXPORT QByteArray klfEscapedToData(const QByteArray& escaped, char escapechar = '\\');
00047 
00048 
00074 KLF_EXPORT QByteArray klfSaveVariantToText(const QVariant& value, bool saveListAndMapsAsXML = false,
00075                                            QByteArray * savedType = NULL,
00076                                            QByteArray * savedListOrMapType = NULL);
00077 
00097 KLF_EXPORT QVariant klfLoadVariantFromText(const QByteArray& string, const char * dataTypeName,
00098                                            const char *listOrMapTypeName = NULL);
00099 
00100 
00102 KLF_EXPORT QDomElement klfSaveVariantMapToXML(const QVariantMap& vmap, QDomElement xmlNode);
00104 KLF_EXPORT QVariantMap klfLoadVariantMapFromXML(const QDomElement& xmlNode);
00105 
00107 KLF_EXPORT QDomElement klfSaveVariantListToXML(const QVariantList& vlist, QDomElement xmlNode);
00109 KLF_EXPORT QVariantList klfLoadVariantListFromXML(const QDomElement& xmlNode);
00110 
00111 
00112 
00113 
00114 
00115 
00116 class KLFAbstractPropertizedObject;
00117 
00123 class KLFAbstractPropertizedObjectSaver : public KLFFactoryBase
00124 {
00125 public:
00126   KLFAbstractPropertizedObjectSaver();
00127   virtual ~KLFAbstractPropertizedObjectSaver();
00128 
00129   virtual QStringList supportedTypes() const = 0;
00130 
00131   virtual QString recognizeDataFormat(const QByteArray& data) const = 0;
00132 
00133   virtual QByteArray save(const KLFAbstractPropertizedObject * obj, const QString& format) = 0;
00134   virtual bool load(const QByteArray& data, KLFAbstractPropertizedObject * obj, const QString& format) = 0;
00135 
00136   static KLFAbstractPropertizedObjectSaver * findRecognizedFormat(const QByteArray& data, QString * format = NULL);
00137   static KLFAbstractPropertizedObjectSaver * findSaverFor(const QString& format);
00138 private:
00139   static KLFFactoryManager pFactoryManager;
00140 };
00141 
00142 
00143 
00144 KLF_EXPORT QByteArray klfSave(const KLFAbstractPropertizedObject * obj, const QString& = "XML");
00145 
00149 KLF_EXPORT bool klfLoad(const QByteArray& data, KLFAbstractPropertizedObject * obj,
00150                         const QString& format = QString());
00151 
00152 
00153 
00154 
00155 
00156 #endif

Generated by doxygen 1.7.6.1. The KLatexFormula website is hosted on sourceforge.net