Unify and fix group handling in geofeaturegroups

This commit is contained in:
Stefan Tröger
2017-02-08 07:08:45 +01:00
committed by wmayer
parent c3a9d43143
commit fd62ef30f3
16 changed files with 121 additions and 147 deletions

View File

@@ -68,11 +68,11 @@ void ExtensionContainer::registerExtension(Base::Type extension, Extension* ext)
_extensions[extension] = ext;
}
bool ExtensionContainer::hasExtension(Base::Type t) const {
bool ExtensionContainer::hasExtension(Base::Type t, bool derived) const {
//check for the exact type
bool found = _extensions.find(t) != _extensions.end();
if(!found) {
if(!found && derived) {
//and for types derived from it, as they can be cast to the extension
for(auto entry : _extensions) {
if(entry.first.isDerivedFrom(t))
@@ -94,10 +94,10 @@ bool ExtensionContainer::hasExtension(const std::string& name) const {
}
Extension* ExtensionContainer::getExtension(Base::Type t) const {
Extension* ExtensionContainer::getExtension(Base::Type t, bool derived) const {
auto result = _extensions.find(t);
if(result == _extensions.end()) {
if((result == _extensions.end()) && derived) {
//we need to check for derived types
for(auto entry : _extensions) {
if(entry.first.isDerivedFrom(t))