mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
Add const to get method
This commit is contained in:
parent
79c1edbdfb
commit
a39b33b3e9
@ -116,7 +116,7 @@ public:
|
||||
|
||||
|
||||
template<typename T>
|
||||
T get(const std::string& name)
|
||||
T get(const std::string& name) const
|
||||
/// Returns the element with the given name and tries to convert
|
||||
/// it to the template type. When the element is not found, a
|
||||
/// NotFoundException will be thrown. When the element can't be
|
||||
@ -141,7 +141,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
Element::Ptr get(const std::string& name);
|
||||
Element::Ptr get(const std::string& name) const;
|
||||
/// Returns the element with the given name.
|
||||
/// An empty element will be returned when the element is not found.
|
||||
|
||||
|
@ -59,11 +59,11 @@ Document::~Document()
|
||||
}
|
||||
|
||||
|
||||
Element::Ptr Document::get(const std::string& name)
|
||||
Element::Ptr Document::get(const std::string& name) const
|
||||
{
|
||||
Element::Ptr element;
|
||||
|
||||
ElementSet::iterator it = std::find_if(_elements.begin(), _elements.end(), ElementFindByName(name));
|
||||
ElementSet::const_iterator it = std::find_if(_elements.begin(), _elements.end(), ElementFindByName(name));
|
||||
if ( it != _elements.end() )
|
||||
{
|
||||
return *it;
|
||||
|
Loading…
Reference in New Issue
Block a user