KEYPropertyMap.h Source File documentation

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

KEYPropertyMap.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libetonyek project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef KEYPROPERTYMAP_H_INCLUDED
11 #define KEYPROPERTYMAP_H_INCLUDED
12
13 #include <boost/any.hpp>
14 #include <boost/unordered_map.hpp>
15
16 namespace libetonyek
17 {
18
21 class KEYPropertyMap
22 {
23 typedef boost::unordered_map<std::string, boost::any> Map_t;
24
25 public:
28 KEYPropertyMap();
29
34 explicit KEYPropertyMap(const KEYPropertyMap *parent);
35
40 KEYPropertyMap(const KEYPropertyMap &other);
41
47 KEYPropertyMap &operator=(const KEYPropertyMap &other);
48
53 void swap(KEYPropertyMap &other);
54
59 void setParent(const KEYPropertyMap *parent);
60
71 boost::any get(const std::string &key, bool lookInParent = false) const;
72
78 void set(const std::string &key, const boost::any &value);
79
80 private:
81 Map_t m_map;
82 const KEYPropertyMap *m_parent;
83 };
84
85 }
86
87 #endif // KEYPROPERTYMAP_H_INCLUDED
88
89 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libetonyek
Definition: EtonyekDocument.cpp:40
libetonyek::KEYPropertyMap
Represents a (hierarchical) property map.
Definition: KEYPropertyMap.h:21
libetonyek::KEYPropertyMap::setParent
void setParent(const KEYPropertyMap *parent)
Set a new parent for this map.
Definition: KEYPropertyMap.cpp:47
libetonyek::KEY2Token::value
Definition: KEY2Token.h:887
libetonyek::KEYPropertyMap::Map_t
boost::unordered_map< std::string, boost::any > Map_t
Definition: KEYPropertyMap.h:23
libetonyek::KEYPropertyMap::m_map
Map_t m_map
Definition: KEYPropertyMap.h:81
libetonyek::KEYPropertyMap::m_parent
const KEYPropertyMap * m_parent
Definition: KEYPropertyMap.h:82
libetonyek::KEYPropertyMap::set
void set(const std::string &key, const boost::any &value)
Set a new value for key .
Definition: KEYPropertyMap.cpp:64
libetonyek::KEYPropertyMap::swap
void swap(KEYPropertyMap &other)
Swap the content with another map.
Definition: KEYPropertyMap.cpp:40
libetonyek::KEY1Token::key
Definition: KEY1Token.h:121
libetonyek::KEY1Token::string
Definition: KEY1Token.h:75
libetonyek::KEYPropertyMap::KEYPropertyMap
KEYPropertyMap()
Construct an empty map.
Definition: KEYPropertyMap.cpp:15
libetonyek::KEYPropertyMap::operator=
KEYPropertyMap & operator=(const KEYPropertyMap &other)
Assign the content from another map.
Definition: KEYPropertyMap.cpp:33