QCodeEdit  2.2
lib/qformatscheme.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
00004 **
00005 ** This file is part of the Edyuk project <http://edyuk.org>
00006 ** 
00007 ** This file may be used under the terms of the GNU General Public License
00008 ** version 3 as published by the Free Software Foundation and appearing in the
00009 ** file GPL.txt included in the packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ****************************************************************************/
00015 
00016 #ifndef _QFORMAT_SCHEME_H_
00017 #define _QFORMAT_SCHEME_H_
00018 
00030 #include "qce-config.h"
00031 
00032 #include <QVector>
00033 #include <QObject>
00034 
00035 struct QFormat;
00036 class QString;
00037 class QSettings;
00038 class QStringList;
00039 class QDomElement;
00040 
00041 class QCE_EXPORT QFormatScheme : public QObject
00042 {
00043     Q_OBJECT
00044     
00045     public:
00046         QFormatScheme(QObject *p = 0);
00047         QFormatScheme(const QString& f, QObject *p = 0);
00048         virtual ~QFormatScheme();
00049         
00050         void clear();
00051         
00052         virtual void load(const QString& filename);
00053         virtual void save(const QString& filename = QString()) const;
00054         
00055         virtual void load(const QDomElement& doc, bool ignoreNewIds = false);
00056         virtual void save(QDomElement& elem) const;
00057         
00058         virtual void load(QSettings& s, bool ignoreNewIds = false);
00059         virtual void save(QSettings& s) const;
00060         
00061         int formatCount() const;
00062         QStringList formats() const;
00063         
00064         virtual QString id(int ifid) const;
00065         virtual int id(const QString& sfid) const;
00066         
00067         virtual QFormat& formatRef(int ifid);
00068         virtual QFormat& formatRef(const QString& sfid);
00069         
00070         virtual QFormat format(int ifid) const;
00071         virtual QFormat format(const QString& sfid) const;
00072         
00073     public slots:
00074         virtual void setFormat(const QString& fid, const QFormat& fmt);
00075         
00076     protected:
00077         QString m_settings;
00078         
00079         QVector<QString> m_formatKeys;
00080         QVector<QFormat> m_formatValues;
00081 };
00082 
00083 #endif // !_QFORMAT_SCHEME_H_