forked from xcore/tool_axe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PeripheralDescriptor.cpp
37 lines (31 loc) · 1.04 KB
/
PeripheralDescriptor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2011, Richard Osborne, All rights reserved
// This software is freely distributable under a derivative of the
// University of Illinois/NCSA Open Source License posted in
// LICENSE.txt and at <http://github.xcore.com/>
#include "PeripheralDescriptor.h"
PropertyDescriptor &PeripheralDescriptor::
addProperty(const PropertyDescriptor &p)
{
return properties.insert(std::make_pair(p.getName(), p)).first->second;
}
const PropertyDescriptor *PeripheralDescriptor::
getProperty(const std::string &name) const
{
std::map<std::string,PropertyDescriptor>::const_iterator it =
properties.find(name);
if (it == properties.end())
return 0;
return &it->second;
}
PropertyDescriptor PropertyDescriptor::integerProperty(const std::string &name)
{
return PropertyDescriptor(INTEGER, name);
}
PropertyDescriptor PropertyDescriptor::stringProperty(const std::string &name)
{
return PropertyDescriptor(STRING, name);
}
PropertyDescriptor PropertyDescriptor::portProperty(const std::string &name)
{
return PropertyDescriptor(PORT, name);
}