18#ifndef VOTCA_TOOLS_PROPERTY_H
19#define VOTCA_TOOLS_PROPERTY_H
31#include <boost/algorithm/string/trim.hpp>
32#include <boost/format.hpp>
63 const std::string &
path)
91 const std::string &
value);
132 bool exists(
const std::string &key)
const;
134 template <
typename T>
136 T defaultvalue)
const;
146 std::vector<Property *>
Select(
const std::string &filter);
147 std::vector<const Property *>
Select(
const std::string &filter)
const;
175 template <
typename T>
202 template <
class cond>
211 template <
typename T>
216 template <
typename T>
233 typedef std::map<std::string, std::string>::const_iterator
260 template <
typename T>
263 template <
typename T>
271 std::map<std::string, std::vector<Index>>
map_;
284 std::string trimmed =
value_;
285 boost::trim(trimmed);
288 }
catch (std::runtime_error &
e) {
289 throw std::runtime_error(
"Property with name '" +
name() +
"' in path '" +
290 path() +
"' and value :" +
e.what());
296 std::map<std::string, std::string>::const_iterator it)
const {
301 s << *
this << std::endl;
302 throw std::runtime_error(s.str() +
"attribute " + it->first +
309 std::map<std::string, std::string>::const_iterator it =
322 T defaultvalue)
const {
325 result = this->
get(key).
as<T>();
327 result = defaultvalue;
334 const std::string &key, std::string defaultvalue)
const {
337 result = this->
get(key).
as<std::string>();
338 if (result.empty()) {
339 result = defaultvalue;
342 result = defaultvalue;
358 map_[prop.name()].push_back(index);
base class for all analysis tools