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() )
178 QStringList list = eIter->second.split(
';',QString::SkipEmptyParts);
184 if ( list.size() != dim ) {
185 std::cerr <<
"Differet size when reading Vector" << std::endl;
190 for (
int i = 0 ; i < dim; ++i) {
192 _val[i] = (
typename VectorT::value_type) list[i].toFloat(&tmpOk);
202 template <
typename VectorT >
206 const QString & _key,
215 for (
int j = 0; j < dim; ++j)
216 list += QString::number( _value[j] ) +
";";
223 template <
typename VectorT >
227 const QString & _section,
228 const QString & _key )
const 230 SectionMap::const_iterator sIter;
231 EntryMap::const_iterator eIter;
240 if( (eIter = sIter->second.find( _key )) == sIter->second.end() )
243 QStringList list = eIter->second.split(
';',QString::SkipEmptyParts);
250 for (
int i = 0 ; i < list.size(); )
252 if ( list[i].isEmpty() )
256 std::vector<double> tmp;
258 for (
int j = 0; j < dim; ++j)
261 tmp.push_back( list[i].toDouble(&tmpOk) );
266 for (
int j = 0; j < dim; ++j)
267 vec[j] = (
typename VectorT::value_type)(tmp[j]);
279 template <
typename VectorT >
283 const QString & _section,
284 const QString & _key )
const 286 SectionMap::const_iterator sIter;
287 EntryMap::const_iterator eIter;
296 if( (eIter = sIter->second.find( _key )) == sIter->second.end() )
299 QStringList list = eIter->second.split(
';',QString::SkipEmptyParts);
306 for (
int i = 0 ; i < list.size(); )
308 if ( list[i].isEmpty() )
312 std::vector<double> tmp;
314 for (
int j = 0; j < dim; ++j)
317 tmp.push_back( list[i].toFloat(&tmpOk) );
322 for (
int j = 0; j < dim; ++j)
323 vec[j] = (
typename VectorT::value_type)(tmp[j]);
335 template <
typename VectorT >
339 const QString & _section,
340 const QString & _key )
const 342 SectionMap::const_iterator sIter;
343 EntryMap::const_iterator eIter;
352 if( (eIter = sIter->second.find( _key )) == sIter->second.end() )
355 QStringList list = eIter->second.split(
';',QString::SkipEmptyParts);
362 for (
int i = 0 ; i < list.size(); )
364 if ( list[i].isEmpty() )
368 std::vector<double> tmp;
370 for (
int j = 0; j < dim; ++j)
373 tmp.push_back( list[i].toInt(&tmpOk) );
378 for (
int j = 0; j < dim; ++j)
379 vec[j] = (
typename VectorT::value_type)(tmp[j]);
392 template <
typename VectorT >
396 const QString & _key,
397 const std::vector< VectorT > & _value)
400 typename std::vector< VectorT >::const_iterator viter;
404 for(viter = _value.begin();viter!=_value.end();++viter)
406 for (
int i = 0; i < tmp.dim(); ++i)
407 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)