utils.cpp File Reference


Detailed Description

Contains a number of functions used by different classes.

Definition in file utils.cpp.

#include <cmath>
#include <qcheckbox.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qtable.h>
#include "utils.h"

Go to the source code of this file.

Functions

QString inputLine (const QString keyword, const double a, const double b, const double c)
 Returns a string ready to be written to a Brabo input file.
QString inputLine (const QString keyword, const int a, const int b, const int c)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string ready to be written to a Brabo input file.
QString inputLine (const QString keyword, const int a, const double b)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string ready to be written to a Brabo input file.
QString validatedSYMMLine (QCheckBox *bx, QCheckBox *by, QCheckBox *bz, QCheckBox *bxy, QCheckBox *bxz, QCheckBox *byz, QCheckBox *bxyz)
 Returns a string ready to be written to an input file, from the symmetry checkboxes.
template<typename T>
void limitRange (const T &min, T &value, const T &max)
 Limits the value between min and max.
void resetTable (QTable *table)
 Clears a table and sets the number of rows to 3.
void saveTable (const QTable *table, unsigned int &numLines, vector< unsigned int > &hPos, vector< unsigned int > &vPos, QStringList &contents)
 Saves the contents of a QTable to a data structure for use with BraboBase, RelaxBase, .
void restoreTable (QTable *table, const unsigned int &numLines, const vector< unsigned int > &hPos, const vector< unsigned int > &vPos, const QStringList &contents)
 Restores a QTable from the contents of a data structure for use with BraboBase, RelaxBase, .
void checkTableOverflow (QTable *table, const int row, const int col)
 Spans cells of a QTable over multiple columns if the contents exceed 10 characters.
void addTableRow (QTable *table)
 Adds a row to a table when no rows are selected.
bool removeTableRow (QTable *table)
 Removes the selected rows from a QTable.
bool clearTableSelection (QTable *table)
 Clears the selected cells in a table. Returns false if no cells were cleared.
QStringList tableContents (const QTable *table)
 Returns the contents of the non-empty rows of the Table in BRABO fixed format.
bool emptyTableRow (const QTable *table, const int row)
 Returns true if a certain row of a Table is empty.
int firstEmptyTableRow (QTable *table)
 Returns the number of the first empty row of a Table and adds a new row if none are empty.


Function Documentation

QString inputLine const QString  keyword,
const double  a,
const double  b,
const double  c
 

Returns a string ready to be written to a Brabo input file.

It will consist of the keyword and up to 3 double values.

Definition at line 35 of file utils.cpp.

QString inputLine const QString  keyword,
const int  a,
const int  b,
const int  c
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string ready to be written to a Brabo input file.

It will consist of the keyword and up to 3 integer values.

Definition at line 62 of file utils.cpp.

QString inputLine const QString  keyword,
const int  a,
const double  b
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns a string ready to be written to a Brabo input file.

It will consist of the keyword, 1 integer and 1 double value.

Definition at line 100 of file utils.cpp.

QString validatedSYMMLine QCheckBox *  bx,
QCheckBox *  by,
QCheckBox *  bz,
QCheckBox *  bxy,
QCheckBox *  bxz,
QCheckBox *  byz,
QCheckBox *  bxyz
 

Returns a string ready to be written to an input file, from the symmetry checkboxes.

It should also adapt those checkboxes to reflect the proper configuration.

Definition at line 121 of file utils.cpp.

template<typename T>
void limitRange const T &  min,
T &  value,
const T &  max
 

Limits the value between min and max.

Definition at line 156 of file utils.cpp.

void resetTable QTable *  table  ) 
 

Clears a table and sets the number of rows to 3.

Definition at line 176 of file utils.cpp.

void saveTable const QTable *  table,
unsigned int &  numLines,
vector< unsigned int > &  hPos,
vector< unsigned int > &  vPos,
QStringList &  contents
 

Saves the contents of a QTable to a data structure for use with BraboBase, RelaxBase, .

..

Definition at line 185 of file utils.cpp.

void restoreTable QTable *  table,
const unsigned int &  numLines,
const vector< unsigned int > &  hPos,
const vector< unsigned int > &  vPos,
const QStringList &  contents
 

Restores a QTable from the contents of a data structure for use with BraboBase, RelaxBase, .

..

Definition at line 209 of file utils.cpp.

void checkTableOverflow QTable *  table,
const int  row,
const int  col
 

Spans cells of a QTable over multiple columns if the contents exceed 10 characters.

For use with BraboBase and RelaxBase.

Definition at line 232 of file utils.cpp.

void addTableRow QTable *  table  ) 
 

Adds a row to a table when no rows are selected.

Inserts a row before a selected row.

Definition at line 248 of file utils.cpp.

bool removeTableRow QTable *  table  ) 
 

Removes the selected rows from a QTable.

Returns false if no rows were selected.

Definition at line 268 of file utils.cpp.

bool clearTableSelection QTable *  table  ) 
 

Clears the selected cells in a table. Returns false if no cells were cleared.

Definition at line 285 of file utils.cpp.

QStringList tableContents const QTable *  table  ) 
 

Returns the contents of the non-empty rows of the Table in BRABO fixed format.

Definition at line 307 of file utils.cpp.

bool emptyTableRow const QTable *  table,
const int  row
 

Returns true if a certain row of a Table is empty.

Definition at line 343 of file utils.cpp.

int firstEmptyTableRow QTable *  table  ) 
 

Returns the number of the first empty row of a Table and adds a new row if none are empty.

Definition at line 358 of file utils.cpp.


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