COPASI API  4.16.103
qtUtilities.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2003 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #ifndef COPASI_qtUtilities
16 #define COPASI_qtUtilities
17 
18 #include <QtCore/QString>
20 
21 class QStringList;
23 
24 /**
25  * Retrieve a parameter from a parameter group and convert it to a QString.
26  * @param const CCopasiParameterGroup * group
27  * @param const size_t & index
28  * @param CCopasiParameter::Type * type (default: NULL)
29  * @return QString value
30  */
31 QString getParameterValue(const CCopasiParameterGroup * group,
32  const size_t & index,
33  CCopasiParameter::Type * type = NULL);
34 /**
35  * Retrieve a parameter from a parameter group and convert it to a QString.
36  * @param const CCopasiParameterGroup * group
37  * @param const std::string & name
38  * @param CCopasiParameter::Type * type (default: NULL)
39  * @return QString value
40  */
41 QString getParameterValue(const CCopasiParameterGroup * group,
42  const std::string & name,
43  CCopasiParameter::Type * type = NULL);
44 /**
45  * Set a parameter of a parameter group from a value given as a QString.
46  * Success = true is returned when the set operation was succesful, i.e.,
47  * value == getParameterValue.
48  * @param CCopasiParameterGroup * group
49  * @param const size_t & index
50  * @param const QString & value
51  * @return bool success.
52  */
54  const size_t & index,
55  const QString & value);
56 
57 /**
58  * Set a parameter of a parameter group from a value given as a QString.
59  * Success = true is returned when the set operation was succesful, i.e.,
60  * value == getParameterValue.
61  * @param CCopasiParameterGroup * group
62  * @param const std::string & name
63  * @param const QString & value
64  * @return bool success.
65  */
67  const std::string & name,
68  const QString & value);
69 
70 /**
71  * Convert a utf8 encoded std::string to a QString
72  */
73 #define FROM_UTF8(__x) QString::fromUtf8((__x).c_str())
74 #define TO_UTF8(__x) (__x).toUtf8().data()
75 
76 /**
77  * Checks whether the file exists. If the file exist the user
78  * is prompted whether to overwrite the file. The return value is
79  * one of QMessageBox::Yes, QMessageBox::No, or QMessageBox::Cancel.
80  * If the file does not exist QMessageBox::Yes is returned.
81  * param const QString & file
82  * @return C_INT32 overwrite
83  */
84 C_INT32 checkSelection(const QString & file);
85 
86 /**
87  * This converts a std::vector<std::string> into a QStringList
88  */
89 void vectorOfStrings2QStringList(std::vector<std::string> vs, QStringList & qsl);
90 
91 #endif // COPASI_qtUtilities
bool setParameterValue(CCopasiParameterGroup *group, const size_t &index, const QString &value)
Definition: qtUtilities.cpp:94
C_INT32 checkSelection(const QString &file)
QString getParameterValue(const CCopasiParameterGroup *group, const size_t &index, CCopasiParameter::Type *type=NULL)
Definition: qtUtilities.cpp:28
#define C_INT32
Definition: copasi.h:90
void vectorOfStrings2QStringList(std::vector< std::string > vs, QStringList &qsl)