70 #include <QTextStream> 71 #include <QStringList> 76 template <
typename VectorT >
80 const QString & _section,
81 const QString & _key )
const 83 SectionMap::const_iterator sIter;
84 EntryMap::const_iterator eIter;
91 if( (eIter = sIter->second.find( _key )) == sIter->second.end() )
94 QStringList list = eIter->second.split(
';',QString::SkipEmptyParts);
100 if ( list.size() != dim ) {
101 std::cerr <<
"Differet size when reading Vector" << std::endl;
106 for (
int i = 0 ; i < dim; ++i) {
108 _val[i] = (
typename VectorT::value_type) list[i].toInt(&tmpOk);
118 template <
typename VectorT >
122 const QString & _section,
123 const QString & _key )
const 125 SectionMap::const_iterator sIter;
126 EntryMap::const_iterator eIter;
133 if( (eIter = sIter->second.find( _key )) == sIter->second.end() )
136 QStringList list = eIter->second.split(
';',QString::SkipEmptyParts);
142 if ( list.size() != dim ) {
143 std::cerr <<
"Differet size when reading Vector" << std::endl;
148 for (
int i = 0 ; i < dim; ++i) {
150 _val[i] = (
typename VectorT::value_type) list[i].toDouble(&tmpOk);
160 template <
typename VectorT >
164 const QString & _section,
165 const QString & _key )
const 167 SectionMap::const_iterator sIter;
168 EntryMap::const_iterator eIter;
175 if( (eIter = sIter->second.find( _key )) == sIter->second.end() )
179 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) 180 QStringList list = eIter->second.split(
';',QString::SkipEmptyParts);
182 QStringList list = eIter->second.split(
';',Qt::SkipEmptyParts);
190 if ( list.size() != dim ) {
191 std::cerr <<
"Differet size when reading Vector" << std::endl;
196 for (
int i = 0 ; i < dim; ++i) {
198 _val[i] = (
typename VectorT::value_type) list[i].toFloat(&tmpOk);
208 template <
typename VectorT >
212 const QString & _key,
213 const VectorT & _value)
221 for (
int j = 0; j < dim; ++j)
222 list += QString::number( _value[j] ) +
";";
229 template <
typename VectorT >
233 const QString & _section,
234 const QString & _key )
const 236 SectionMap::const_iterator sIter;
237 EntryMap::const_iterator eIter;
246 if( (eIter = sIter->second.find( _key )) == sIter->second.end() )
249 QStringList list = eIter->second.split(
';',QString::SkipEmptyParts);
256 for (
int i = 0 ; i < list.size(); )
258 if ( list[i].isEmpty() )
262 std::vector<double> tmp;
264 for (
int j = 0; j < dim; ++j)
267 tmp.push_back( list[i].toDouble(&tmpOk) );
272 for (
int j = 0; j < dim; ++j)
273 vec[j] = (
typename VectorT::value_type)(tmp[j]);
285 template <
typename VectorT >
289 const QString & _section,
290 const QString & _key )
const 292 SectionMap::const_iterator sIter;
293 EntryMap::const_iterator eIter;
302 if( (eIter = sIter->second.find( _key )) == sIter->second.end() )
305 QStringList list = eIter->second.split(
';',QString::SkipEmptyParts);
312 for (
int i = 0 ; i < list.size(); )
314 if ( list[i].isEmpty() )
318 std::vector<double> tmp;
320 for (
int j = 0; j < dim; ++j)
323 tmp.push_back( list[i].toFloat(&tmpOk) );
328 for (
int j = 0; j < dim; ++j)
329 vec[j] = (
typename VectorT::value_type)(tmp[j]);
341 template <
typename VectorT >
345 const QString & _section,
346 const QString & _key )
const 348 SectionMap::const_iterator sIter;
349 EntryMap::const_iterator eIter;
358 if( (eIter = sIter->second.find( _key )) == sIter->second.end() )
361 QStringList list = eIter->second.split(
';',QString::SkipEmptyParts);
368 for (
int i = 0 ; i < list.size(); )
370 if ( list[i].isEmpty() )
374 std::vector<double> tmp;
376 for (
int j = 0; j < dim; ++j)
379 tmp.push_back( list[i].toInt(&tmpOk) );
384 for (
int j = 0; j < dim; ++j)
385 vec[j] = (
typename VectorT::value_type)(tmp[j]);
398 template <
typename VectorT >
402 const QString & _key,
403 const std::vector< VectorT > & _value)
406 typename std::vector< VectorT >::const_iterator viter;
410 for(viter = _value.begin();viter!=_value.end();++viter)
412 for (
int i = 0; i < tmp.dim(); ++i)
413 list += QString::number( (*viter)[i] ) +
";";
bool get_entryVecf(VectorT &_val, const QString &_section, const QString &_key) const
Get a Vec_n_i (int)
SectionMap m_iniData
Stored data of an INI file.
bool get_entryVecd(VectorT &_val, const QString &_section, const QString &_key) const
Get a Vec_n_d (double)
void add_entryVec(const QString &_section, const QString &_key, const VectorT &_value)
Addition of a Vec_n_something.
bool get_entryVeci(VectorT &_val, const QString &_section, const QString &_key) const
Get a Vec_n_i (int)