Back to index

scribus-ng  1.3.4.dfsg+svn20071115
prefscontext.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008  *   Copyright (C) 2004 by Riku Leino                                      *
00009  *   tsoots@gmail.com                                                      *
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This program is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00019  *   GNU General Public License for more details.                          *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU General Public License     *
00022  *   along with this program; if not, write to the                         *
00023  *   Free Software Foundation, Inc.,                                       *
00024  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00025  ***************************************************************************/
00026 
00027 #ifndef PREFSCONTEXT_H
00028 #define PREFSCONTEXT_H
00029 
00030 #include <string>
00031 #include <qmap.h>
00032 #include <qstring.h>
00033 
00034 #include "scribusapi.h"
00035 #include "prefstable.h"
00036 
00037 typedef QMap<QString, QString> AttributeMap;
00038 typedef QMap<QString, PrefsTable*> TableMap;
00039 
00040 class SCRIBUS_API PrefsContext
00041 {
00042 private:
00043        QString name;
00044        bool isplugin;
00045        bool ispersistent;
00046 public:
00047        AttributeMap values;
00048        TableMap tables;
00049        PrefsContext();
00050        PrefsContext(QString contextName, bool persistent = true, bool plugin = false);
00051        ~PrefsContext();
00052        QString getName();
00053        bool    isPersistent();
00054        bool    isPlugin();
00055        bool    isEmpty();
00056        bool    contains(const QString& key);
00057        bool    containsTable(const QString& key);
00058        QString get(const QString& key, const QString& defValue = "");
00059        void    set(const QString& key, const char* value);
00060        void    set(const QString& key, const std::string& value);
00061        void    set(const QString& key, const QString& value);
00062        int     getInt(const QString& key, int defValue = -1);
00063        void    set(const QString& key, int value);
00064        void    set(const QString& key, uint value);
00065        uint    getUInt(const QString& key, uint defValue = 0);
00066        double  getDouble(const QString& key, double defValue = -1.0);
00067        void    set(const QString& key, double value);
00068        bool    getBool(const QString& key, bool defValue = false);
00069        void    set(const QString& key, bool value);
00070        PrefsTable* getTable(const QString& name);
00071        void    removeTable(const QString& name);
00072 };
00073 
00074 #endif // PREFSCONTEXTS_H