SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEFramework
src
lib
Property
PropertyHolder.cpp
Go to the documentation of this file.
1
23
#include "
SEFramework/Property/PropertyHolder.h
"
24
25
#include "
SEFramework/Property/PropertyNotFoundException.h
"
26
27
namespace
SourceXtractor
{
28
29
const
Property
&
PropertyHolder::getProperty
(
const
PropertyId
&
property_id
)
const
{
30
auto
iter =
m_properties
.find(
property_id
);
31
if
(iter !=
m_properties
.end()) {
32
// Returns the property if it is found
33
return
*iter->second;
34
}
else
{
35
// If we don't have that property throws an exception
36
throw
PropertyNotFoundException
(
property_id
);
37
}
38
}
39
40
void
PropertyHolder::setProperty
(
std::unique_ptr<Property>
property
,
const
PropertyId
&
property_id
) {
41
m_properties
[
property_id
] =
std::move
(
property
);
42
}
43
44
bool
PropertyHolder::isPropertySet
(
const
PropertyId
&
property_id
)
const
{
45
return
m_properties
.find(
property_id
) !=
m_properties
.end();
46
}
47
48
void
PropertyHolder::clear
() {
49
m_properties
.clear();
50
}
51
52
}
// SEFramework namespace
PropertyHolder.h
PropertyNotFoundException.h
SourceXtractor::PropertyHolder::isPropertySet
bool isPropertySet(const PropertyId &property_id) const
Returns true if the property is set.
Definition
PropertyHolder.cpp:44
SourceXtractor::PropertyHolder::clear
void clear()
Definition
PropertyHolder.cpp:48
SourceXtractor::PropertyHolder::getProperty
const Property & getProperty(const PropertyId &property_id) const
Returns a reference to a Property if it is set, if not throws a PropertyNotFoundException.
Definition
PropertyHolder.cpp:29
SourceXtractor::PropertyHolder::setProperty
void setProperty(std::unique_ptr< Property > property, const PropertyId &property_id)
Sets a property, overwriting it if necessary.
Definition
PropertyHolder.cpp:40
SourceXtractor::PropertyHolder::m_properties
std::unordered_map< PropertyId, std::unique_ptr< Property > > m_properties
Definition
PropertyHolder.h:72
SourceXtractor::PropertyId
Identifier used to set and retrieve properties.
Definition
PropertyId.h:40
SourceXtractor::PropertyNotFoundException
An exception indicating that a Property was not available and could not be computed on demand.
Definition
PropertyNotFoundException.h:36
SourceXtractor::Property
Base class for all Properties. (has no actual content)
Definition
Property.h:33
std::function
std::move
T move(T... args)
SourceXtractor
Definition
Aperture.h:30
Generated by
1.10.0