utils.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                            utils.h  -  description
00003                              -------------------
00004     begin                : Wed Jul 31 2002
00005     copyright            : (C) 2002-2006 by Ben Swerts
00006     email                : bswerts@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
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  ***************************************************************************/
00017 
00020 #ifndef UTILS_H
00021 #define UTILS_H
00022 
00024 
00025 // STL header files
00026 #include <vector>
00027 using std::vector;
00028 
00030 class QCheckBox;
00031 class QString;
00032 class QStringList;
00033 class QTable;
00034 
00035 
00037 
00039 QString inputLine(const QString keyword, const double a, const double b = 0.0, const double c = 0.0);         // returns a string ready to be written to an input file
00040 QString inputLine(const QString keyword, const int a, const int b = 0, const int c = 0);  // overloaded
00041 QString inputLine(const QString keyword, const int a, const double b);// overloaded
00042 QString validatedSYMMLine(QCheckBox* bx, QCheckBox* by, QCheckBox* bz, QCheckBox* bxy, QCheckBox* bxz, QCheckBox* byz, QCheckBox* bxyz);    // returns a string containing a valid SYMM line based on the checkboxes
00043 
00045 template<typename T> void limitRange(const T& min, T& value, const T& max);
00046 
00048 void resetTable(QTable* table);         // resets a table to an empty 3-row table
00049 void saveTable(const QTable* table, unsigned int& numLines, vector<unsigned int>& hPos, vector<unsigned int>& vPos, QStringList& contents); // saves the contents of the table
00050 void restoreTable(QTable* table, const unsigned int& numLines, const vector<unsigned int>& hPos, const vector<unsigned int>& vPos, const QStringList& contents);// restores the table
00051 void checkTableOverflow(QTable* table, const int row, const int col);
00052 void addTableRow(QTable* table);        // adds a row to a table
00053 bool removeTableRow(QTable* table);     // removes the selected row(s) from a table
00054 bool clearTableSelection(QTable* table);// clears the selected cells in a table
00055 QStringList tableContents(const QTable* table);   // returns the contents of a QTable in BRABO input format
00056 bool emptyTableRow(const QTable* table, const int row);     // returns true if the row is empty
00057 int firstEmptyTableRow(QTable* table);  // returns the first empty row
00058 
00059 #endif
00060 

Generated on Fri May 19 14:31:56 2006 for Brabosphere by  doxygen 1.4.6-NO