Back to index

scribus-ng  1.3.4.dfsg+svn20071115
prefstable.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  *   riku.leino@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 PREFSTABLE_H
00028 #define PREFSTABLE_H
00029 
00030 #include <string>
00031 #include <vector>
00032 #include <qmap.h>
00033 #include <qstring.h>
00034 #include <qstringlist.h>
00035 
00036 #include "scribusapi.h"
00037 
00038 typedef std::vector<QStringList*> Table;
00039 
00040 class SCRIBUS_API PrefsTable
00041 {
00042 private:
00043  QString name;
00044  Table table;
00045  int rowCount;
00046  int colCount;
00047  void checkSize(int rowIndex, int colIndex, QString defValue = "");
00048  void checkHeight(int rowIndex);
00049  void checkWidth(int rowIndex, int colIndex, QString defValue = "");
00050 public:
00051  PrefsTable(QString tableName);
00052  ~PrefsTable();
00053  QString getName();
00054  int     height();
00055  int     getRowCount();
00056  int     width();
00057  int     getColCount();
00058  QString get(int row, int col, const QString& defValue = "");
00059  void    set(int row, int col, const char* value);
00060  void    set(int row, int col, const std::string& value);
00061  void    set(int row, int col, const QString& value);
00062  int     getInt(int row, int col = 0, int defValue = -1);
00063  void    set(int row, int col, int value);
00064  void    set(int row, int col, uint value);
00065  uint    getUInt(int row, int col, uint defValue = 0);
00066  double  getDouble(int row, int col, double defValue = -1.0);
00067  void    set(int row, int col, double value);
00068  bool    getBool(int row, int col, bool defValue = false);
00069  void    set(int row, int col, bool value);
00070 /*** finds what in searchCol and returns the row index if found if not will return -1 */
00071  int  find(int searchCol, const QString& what);
00072 /*** Removes the row where in column colIndex can be found text what ********/
00073  void removeRow(int colIndex, const QString& what);
00074 /*** Empties the table ***/
00075  void clear();
00076 };
00077 
00078 #endif