diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-17 18:32:14 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-17 18:32:14 +0100 |
commit | 26d2236c89017d5f9f31b90ec02600744aa5ad0f (patch) | |
tree | 8757276c902f35e0dc58e23ffaec2c7e782614a1 /src/core/resource | |
parent | 2da3efbf053e12861c9184c3f8bd014fae245773 (diff) |
Do not bother with to many type checks if we indicate that "all types are allowed". Fixes part of the issues with bug #77
Diffstat (limited to 'src/core/resource')
-rw-r--r-- | src/core/resource/ResourceRequest.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/resource/ResourceRequest.cpp b/src/core/resource/ResourceRequest.cpp index 357f413..5e5bff3 100644 --- a/src/core/resource/ResourceRequest.cpp +++ b/src/core/resource/ResourceRequest.cpp @@ -152,6 +152,10 @@ bool ResourceRequest::deduce(Registry ®istry, Logger &logger) { bool ok = true; + // Check whether all node types are supported here -- this is indicated by + // supportedTypes containing the extremely general "Node" type. + bool supportsAllNodes = supportedTypes.count(&RttiTypes::Node) > 0U; + // Make sure the given file name is not empty if (path.empty()) { logger.error("Filename may not be empty"); @@ -227,7 +231,8 @@ bool ResourceRequest::deduce(Registry ®istry, Logger &logger) logger.error(std::string("Cannot parse files of type \"") + mimetype + std::string("\"")); ok = false; - } else if (!Rtti::setIsOneOf(supportedTypes, parserTypes)) { + } else if (!supportsAllNodes && + !Rtti::setIsOneOf(supportedTypes, parserTypes)) { logger.error(std::string("Resource of type \"") + mimetype + std::string("\" cannot be included here!")); ok = false; @@ -245,8 +250,7 @@ bool ResourceRequest::deduce(Registry ®istry, Logger &logger) std::string("\" cannot be included here")); ok = false; } - } else if (supportedTypes.size() != 1 || - *supportedTypes.begin() != &RttiTypes::Node) { + } else if (!supportsAllNodes) { logger.warning(std::string( "Ambiguous resource relationship, consider " "specifying one of ") + |