MetaAttribute.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2011, SRI International (R)
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include <map>
19 
21 
22 namespace karto
23 {
24 
28 
30  {
31  typedef std::map< karto::String, Any > Attributes;
32  Attributes m_Attributes;
33  };
34 
38 
40  : m_pPrivate(new MetaAttributePrivate())
41  {
42  }
43 
45  {
46  delete m_pPrivate;
47  }
48 
50  {
51  return m_pPrivate->m_Attributes.find(rId) != m_pPrivate->m_Attributes.end();
52  }
53 
55  {
56  MetaAttributePrivate::Attributes::const_iterator iter = m_pPrivate->m_Attributes.find(rId);
57  if (iter != m_pPrivate->m_Attributes.end())
58  {
59  return iter->second;
60  }
61 
62  return Any::Empty;
63  }
64 
65  void MetaAttribute::AddAttribute(const karto::String& rId, const Any& rValue) const
66  {
67  m_pPrivate->m_Attributes[rId] = rValue;
68  }
69 
70 }
MetaAttributePrivate * m_pPrivate
Definition: MetaAttribute.h:86
bool kt_bool
Definition: Types.h:145
Definition: Any.h:55
static const Any Empty
Definition: Any.h:191
std::map< karto::String, Any > Attributes
void AddAttribute(const karto::String &rId, const Any &rValue) const
const Any & GetAttribute(const karto::String &rId) const
Definition: Any.cpp:20
kt_bool HasAttribute(const karto::String &rId) const


nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Thu Jun 6 2019 19:20:24