1// Aseprite UI Library
2// Copyright (C) 2001-2015 David Capello
3//
4// This file is released under the terms of the MIT license.
5// Read LICENSE.txt for more information.
6
7#ifdef HAVE_CONFIG_H
8#include "config.h"
9#endif
10
11#include "ui/component.h"
12#include "ui/property.h"
13
14namespace ui {
15
16Component::Component()
17{
18}
19
20Component::~Component()
21{
22}
23
24PropertyPtr Component::getProperty(const std::string& name) const
25{
26 auto it = m_properties.find(name);
27 if (it != m_properties.end())
28 return it->second;
29 else
30 return PropertyPtr();
31}
32
33void Component::setProperty(PropertyPtr property)
34{
35 m_properties[property->getName()] = property;
36}
37
38bool Component::hasProperty(const std::string& name) const
39{
40 return (m_properties.find(name) != m_properties.end());
41}
42
43void Component::removeProperty(const std::string& name)
44{
45 Properties::iterator it = m_properties.find(name);
46 if (it != m_properties.end())
47 m_properties.erase(it);
48}
49
50const Component::Properties& Component::getProperties() const
51{
52 return m_properties;
53}
54
55} // namespace ui
56