| 53 | } |
| 54 | |
| 55 | void ExtensionContainer::registerExtension(Base::Type extension, Extension* ext) |
| 56 | { |
| 57 | if (ext->getExtendedContainer() != this) { |
| 58 | throw Base::ValueError( |
| 59 | "ExtensionContainer::registerExtension: Extension has not this as base object"); |
| 60 | } |
| 61 | |
| 62 | // no duplicate extensions (including base classes) |
| 63 | if (hasExtension(extension)) { |
| 64 | for (const auto& entry : _extensions) { |
| 65 | if (entry.first == extension || entry.first.isDerivedFrom(extension)) { |
| 66 | _extensions.erase(entry.first); |
| 67 | break; |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | _extensions[extension] = ext; |
| 73 | } |
| 74 | |
| 75 | bool ExtensionContainer::hasExtension(Base::Type type, bool derived) const |
| 76 | { |
no test coverage detected