SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
PropertyHolder.cpp
Go to the documentation of this file.
1
22
24
26
27namespace SourceXtractor {
28
29const 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
41 m_properties[property_id] = std::move(property);
42}
43
44bool PropertyHolder::isPropertySet(const PropertyId& property_id) const {
45 return m_properties.find(property_id) != m_properties.end();
46}
47
49 m_properties.clear();
50}
51
52} // SEFramework namespace
bool isPropertySet(const PropertyId &property_id) const
Returns true if the property is set.
const Property & getProperty(const PropertyId &property_id) const
Returns a reference to a Property if it is set, if not throws a PropertyNotFoundException.
void setProperty(std::unique_ptr< Property > property, const PropertyId &property_id)
Sets a property, overwriting it if necessary.
std::unordered_map< PropertyId, std::unique_ptr< Property > > m_properties
Identifier used to set and retrieve properties.
Definition PropertyId.h:40
An exception indicating that a Property was not available and could not be computed on demand.
Base class for all Properties. (has no actual content).
Definition Property.h:33
T move(T... args)