00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /* 00003 * This file is part of the libetonyek project. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 */ 00009 00010 #ifndef KEYPROPERTYMAP_H_INCLUDED 00011 #define KEYPROPERTYMAP_H_INCLUDED 00012 00013 #include <boost/any.hpp> 00014 #include <boost/unordered_map.hpp> 00015 00016 namespace libetonyek 00017 { 00018 00021 class KEYPropertyMap 00022 { 00023 typedef boost::unordered_map<std::string, boost::any> Map_t; 00024 00025 public: 00028 KEYPropertyMap(); 00029 00034 explicit KEYPropertyMap(const KEYPropertyMap *parent); 00035 00040 KEYPropertyMap(const KEYPropertyMap &other); 00041 00047 KEYPropertyMap &operator=(const KEYPropertyMap &other); 00048 00053 void swap(KEYPropertyMap &other); 00054 00059 void setParent(const KEYPropertyMap *parent); 00060 00071 boost::any get(const std::string &key, bool lookInParent = false) const; 00072 00078 void set(const std::string &key, const boost::any &value); 00079 00080 private: 00081 Map_t m_map; 00082 const KEYPropertyMap *m_parent; 00083 }; 00084 00085 } 00086 00087 #endif // KEYPROPERTYMAP_H_INCLUDED 00088 00089 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */