10#ifndef IWORKPROPERTYMAP_H_INCLUDED
11#define IWORKPROPERTYMAP_H_INCLUDED
13#include <unordered_map>
16#include <boost/any.hpp>
32 typedef std::unordered_map<IWORKPropertyID_t, boost::any>
Map_t;
85 template<
class Property>
86 bool has(
bool lookInParent =
false)
const
88 for (
const IWORKPropertyMap *map =
this; map; map = lookInParent ? map->m_parent :
nullptr)
91 if (map->m_map.end() != it)
92 return !it->second.empty();
97 template<
class Property>
98 bool clears(
bool lookInParent =
false)
const
100 for (
const IWORKPropertyMap *map =
this; map; map = lookInParent ? map->m_parent :
nullptr)
103 if (map->m_map.end() != it)
104 return it->second.empty();
118 template<
class Property>
121 for (
const IWORKPropertyMap *map =
this; map; map = lookInParent ? map->m_parent :
nullptr)
124 if (map->m_map.end() != it)
126 if (!it->second.empty())
127 return boost::any_cast<const typename IWORKPropertyInfo<Property>::ValueType &>(it->second);
138 template<
class Property>
149 template<
class Property>
Definition IWORKPropertyMap.h:29
std::unordered_map< IWORKPropertyID_t, boost::any > Map_t
Definition IWORKPropertyMap.h:32
void collectStyles(std::vector< const IWORKStyle * > &styles) const
Add the styles that the properties of this map hold, not looking in the parent map.
Definition IWORKPropertyMap.cpp:55
bool has(bool lookInParent=false) const
Check for the presence of a property.
Definition IWORKPropertyMap.h:86
Map_t m_map
Definition IWORKPropertyMap.h:156
IWORKPropertyMap & operator=(const IWORKPropertyMap &other)
Assign the content from another map.
Definition IWORKPropertyMap.cpp:36
void put(const typename IWORKPropertyInfo< Property >::ValueType &value)
Insert a new value for key key.
Definition IWORKPropertyMap.h:139
const IWORKPropertyMap * m_parent
Definition IWORKPropertyMap.h:157
void setParent(const IWORKPropertyMap *parent)
Set a new parent for this map.
Definition IWORKPropertyMap.cpp:50
IWORKPropertyMap()
Construct an empty map.
Definition IWORKPropertyMap.cpp:18
void clear()
Clear property.
Definition IWORKPropertyMap.h:150
const IWORKPropertyInfo< Property >::ValueType & get(bool lookInParent=false) const
Retrieve the value of a property.
Definition IWORKPropertyMap.h:119
bool clears(bool lookInParent=false) const
Definition IWORKPropertyMap.h:98
void swap(IWORKPropertyMap &other)
Swap the content with another map.
Definition IWORKPropertyMap.cpp:43
@ value
Definition IWORKToken.h:631
@ styles
Definition IWORKToken.h:423
Definition IWORKBezierElement.cpp:21
Definition IWORKPropertyInfo.h:22