diff options
Diffstat (limited to 'project2/xmlObjectLoader.cpp')
| -rw-r--r-- | project2/xmlObjectLoader.cpp | 16 | 
1 files changed, 11 insertions, 5 deletions
diff --git a/project2/xmlObjectLoader.cpp b/project2/xmlObjectLoader.cpp index aa1873b..4b291da 100644 --- a/project2/xmlObjectLoader.cpp +++ b/project2/xmlObjectLoader.cpp @@ -1,5 +1,6 @@  #include "xmlObjectLoader.h"  #include "exceptions.h" +#include "logger.h"  #include <stdio.h>  unsigned int LoaderBase::depth = 0; @@ -23,7 +24,7 @@ LoaderBase::~LoaderBase()  }  void -LoaderBase::collectAll(const xmlpp::Element * node, bool childrenOnly) const +LoaderBase::collectAll(const xmlpp::Element * node, bool childrenOnly, UnsupportedHandling uh) const  {  	if (!node) {  		return; @@ -47,24 +48,29 @@ LoaderBase::collectAll(const xmlpp::Element * node, bool childrenOnly) const  			throw NotSupported(name);  		}  		if (stored < created) { -			throw NotSupported(name); +			if (uh == ErrorOnUnsupported) { +				throw NotSupported(name); +			} +			else if (uh == WarnOnUnsupported) { +				Logger()->messagef(LOG_WARNING, "'%s' unsupported in this location", name.c_str()); +			}  		}  	}  	if (created == 0 && (recursive || childrenOnly)) {  		BOOST_FOREACH(const xmlpp::Node * child, node->get_children()) { -			collectAll(dynamic_cast<const xmlpp::Element *>(child), false); +			collectAll(dynamic_cast<const xmlpp::Element *>(child), false, uh);  		}  	}  	depth -= 1;  }  void -LoaderBase::collectAll(const CommonObjects * co, const xmlpp::Element * node, bool childrenOnly) const +LoaderBase::collectAll(const CommonObjects * co, const xmlpp::Element * node, bool childrenOnly, UnsupportedHandling uh) const  {  	if (depth != 0) {  		throw std::logic_error("Cannot set CommonObjects in subloader");  	} -	collectAll(node, childrenOnly); +	collectAll(node, childrenOnly, uh);  	BOOST_FOREACH(SourceObjectPtr o, loadedObjects) {  		o->loadComplete(co);  	}  | 
