SourceXtractorPlusPlus  0.11
Please provide a description of the project.
PropertyHolder.cpp
Go to the documentation of this file.
1 
24 
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 
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 
49  m_properties.clear();
50 }
51 
52 } // SEFramework namespace
std::unordered_map< PropertyId, std::unique_ptr< Property > > m_properties
const Property & getProperty(const PropertyId &property_id) const
Returns a reference to a Property if it is set, if not throws a PropertyNotFoundException.
Base class for all Properties. (has no actual content)
Definition: Property.h:33
bool isPropertySet(const PropertyId &property_id) const
Returns true if the property is set.
T move(T... args)
STL class.
Identifier used to set and retrieve properties.
Definition: PropertyId.h:40
void setProperty(std::unique_ptr< Property > property, const PropertyId &property_id)
Sets a property, overwriting it if necessary.
An exception indicating that a Property was not available and could not be computed on demand...