22 #ifndef PROGRAM_OPTIONS_MAPPED_VALUE_H_INCLUDED
23 #define PROGRAM_OPTIONS_MAPPED_VALUE_H_INCLUDED
25 #pragma warning (disable : 4786)
26 #pragma warning (disable : 4503)
33 #if defined(_MSC_VER) && _MSC_VER <= 1200
34 namespace std { using ::size_t; }
37 namespace ProgramOptions {
49 bool empty()
const {
return map_.empty(); }
50 size_t size()
const {
return map_.size(); }
51 size_t count(
const std::string& name)
const {
return map_.count(name); }
54 MapType::const_iterator it = map_.find(name);
55 if (it == map_.end()) {
61 static bool add(
ValueMap* this_,
const std::string& name,
const T* value) {
62 MapType::iterator it = this_->map_.find(name);
63 if (it == this_->map_.end()) {
64 it = this_->map_.insert(it, MapType::value_type(name,
ValueStore()));
66 if (it->second.extract_raw() != value) {
67 it->second.assimilate(const_cast<T*>(value));
74 typedef std::map<std::string, ValueStore> MapType;
85 return notify<T>(&map, &ValueMap::add<T>,
p);
89 return flag(&map, &ValueMap::add<bool>,
a);
ValueMap()
Definition: mapped_value.h:47
tuple a
Definition: pyclingo.py:6
Definition: typed_value.h:163
NotifiedValue< T > * store(ValueMap &map, typename detail::Parser< T >::type p=&string_cast< T >)
Definition: mapped_value.h:84
static bool add(ValueMap *this_, const std::string &name, const T *value)
Definition: mapped_value.h:61
size_t count(const std::string &name) const
Definition: mapped_value.h:51
A type that can hold any kind of value type.
Definition: value_store.h:40
bool empty() const
Definition: mapped_value.h:49
void clear()
Definition: mapped_value.h:52
size_t size() const
Definition: mapped_value.h:50
Type for storing anonymous values.
Definition: mapped_value.h:45
~ValueMap()
Definition: mapped_value.h:48
tuple p
Definition: server.py:49
const ValueStore & operator[](const std::string &name) const
Definition: mapped_value.h:53
Definition: typed_value.h:101
Definition: typed_value.h:36
NotifiedValue< bool > * flag(ValueMap &map, FlagAction a=store_true)
Definition: mapped_value.h:88