All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QtHelpers.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 
33 /**
34  \file QtHelpers.hpp
35  \brief Header of ...
36 
37  \author Jean-Christophe FABRE <fabrejc@supagro.inra.fr>
38  */
39 
40 
41 #ifndef __QTHELPERS_HPP__
42 #define __QTHELPERS_HPP__
43 
44 
47 
48 #include <string>
49 #include <list>
50 #include <vector>
51 #include <set>
52 
53 #include <QVariant>
54 #include <QString>
55 #include <QStringList>
56 #include <QDateTime>
57 #include <QColor>
58 
59 #include <openfluid/dllexport.hpp>
60 
61 
62 namespace openfluid { namespace tools {
63 
64 /**
65  Transforms the given string to a string compatible with the INI files managed with QSettings.
66  @param[in] Str the string to transform
67  @return The transformed string
68 */
69 QString DLLEXPORT toIniCompatible(const std::string& Str);
70 
71 
72 /**
73  Transforms the given variable from an INI file managed with QSettings to a string
74  @param[in] Var the variable to transform
75  @return The variable transformed into a string
76 */
77 std::string DLLEXPORT fromIniCompatible(const QVariant& Var);
78 
79 
80 /**
81  Transforms a QStringList into a std::list of std::string
82  @param[in] StrList the QStringList to transform
83  @return The QStringList transformed into a std::list of std::string
84 */
85 std::list<std::string> DLLEXPORT toStdStringList(const QStringList& StrList);
86 
87 
88 /**
89  Transforms an OpenFLUID DateTime to a QDateTime
90  @param[in] DT The OpenFLUID DateTime to transform
91  @return The DT transformed into QDateTime
92 */
94 
95 
96 /**
97  Transforms a std::vector of std::string into a QStringList
98  @param[in] StrVect the std::vector of std::string to transform
99  @return The StrVect transformed into a QStringList
100 */
101 QStringList DLLEXPORT toQStringList(const std::vector<std::string>& StrVect);
102 
103 
104 /**
105  Transforms a std::set of std::string into a QStringList
106  @param[in] StrSet the std::set of std::string to transform
107  @return The StrSet transformed into a QStringList
108 */
109 QStringList DLLEXPORT toQStringList(const std::set<std::string>& StrSet);
110 
111 
112 /**
113  Transforms a std::list of std::string into a QStringList
114  @param[in] StrList the std::list of std::string to transform
115  @return The StrList transformed into a QStringList
116 */
117 QStringList DLLEXPORT toQStringList(const std::list<std::string>& StrList);
118 
119 
120 /**
121  Transforms a std::set of int into a QStringList
122  @param[in] IntSet the std::set of int to transform
123  @return The intSet transformed into a QStringList
124 */
125 QStringList DLLEXPORT toQStringList(const std::set<int>& IntSet);
126 
127 
128 /**
129  Returns the available GDAL/OGR formats as a QFileDialog formats string.
130  The string is built according to GDAL/OGR available drivers.
131  The OGRRegisterAll() and/or GDALAllRegister() instruction must be called before using this function.
132  @param[in] Drivers The available extensions list
133  @param[in] AllFormatsLabel the label displayed for all formats
134  @return the format string (e.g. "All vector files (*.shp *.mif *.tab);;ESRI Shapefiles (*.shp);;Mapinfo (*.mif *.tab)")
135 */
137  const QString& AllFormatsLabel);
138 
139 /**
140  Escapes characters in the given string to be compatible with the XML format.
141  @param[in] Str the string to escape
142  @return The escaped string
143 */
144 QString DLLEXPORT escapeXMLEntities(const QString& Str);
145 
146 
147 } } // namespaces
148 
149 
150 #endif /* __QTHELPERS_HPP__ */
Class for management of date and time information.
Definition: DateTime.hpp:131
QString DLLEXPORT escapeXMLEntities(const QString &Str)
QStringList DLLEXPORT toQStringList(const std::vector< std::string > &StrVect)
Header of ...
QString DLLEXPORT getOGRGDALFormatsForQFileDialogs(const GDALDriversFilesExts_t &Drivers, const QString &AllFormatsLabel)
std::string DLLEXPORT fromIniCompatible(const QVariant &Var)
std::list< std::string > DLLEXPORT toStdStringList(const QStringList &StrList)
QDateTime DLLEXPORT toQDateTime(openfluid::core::DateTime DT)
std::map< std::string, GDALDriverInfos_t > GDALDriversFilesExts_t
Definition: GDALHelpers.hpp:68
QString DLLEXPORT toIniCompatible(const std::string &Str)
#define DLLEXPORT
Definition: dllexport.hpp:51