diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-04-12 22:37:18 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-04-12 22:37:18 +0000 |
| commit | fbb85064cfaaf03cc09bacedb16a8561f61f2b3d (patch) | |
| tree | e2a26a8e4fbbcfd1180522452d7b4db23408d39d /src/sp-object.cpp | |
| parent | various little changes (diff) | |
| download | inkscape-fbb85064cfaaf03cc09bacedb16a8561f61f2b3d.tar.gz inkscape-fbb85064cfaaf03cc09bacedb16a8561f61f2b3d.zip | |
Added prefPaths to contexts; modified SPFactory
(bzr r11608.1.94)
Diffstat (limited to 'src/sp-object.cpp')
| -rw-r--r-- | src/sp-object.cpp | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/sp-object.cpp b/src/sp-object.cpp index dc9b1a2e5..363a05579 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -214,24 +214,24 @@ public: -#include <stdexcept> -#include <exception> - -void log_exception(std::exception_ptr exception) { - try { - std::rethrow_exception(exception); - } catch (const std::exception& e) { - std::cerr << "Caught Exception of type " << std::string(typeid(e).name()) << '\n'; - std::cerr << "Message: " << std::string(e.what()) << '\n'; - - try { - std::rethrow_if_nested(e); - } catch (...) { - std::cerr << "Inner Exception: \n"; - log_exception(std::current_exception()); - } - } -} +//#include <stdexcept> +//#include <exception> +// +//void log_exception(std::exception_ptr exception) { +// try { +// std::rethrow_exception(exception); +// } catch (const std::exception& e) { +// std::cerr << "Caught Exception of type " << std::string(typeid(e).name()) << '\n'; +// std::cerr << "Message: " << std::string(e.what()) << '\n'; +// +// try { +// std::rethrow_if_nested(e); +// } catch (...) { +// std::cerr << "Inner Exception: \n"; +// log_exception(std::current_exception()); +// } +// } +//} @@ -628,7 +628,9 @@ void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) SPObject* object = this; try { - SPObject* ochild = SPFactory::instance().createObject(*child); + const std::string typeString = NodeTraits::getTypeString(*child); + + SPObject* ochild = SPFactory::instance().createObject(typeString); SPObject *prev = ref ? object->get_child_by_repr(ref) : NULL; object->attach(ochild, prev); @@ -636,7 +638,8 @@ void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) ochild->invoke_build(object->document, child, object->cloned); } catch (const SPFactory::TypeNotRegistered& e) { - log_exception(std::current_exception()); + //log_exception(std::current_exception()); + g_warning("TypeNotRegistered exception: %s", e.what()); } } @@ -693,13 +696,16 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) { // } try { - SPObject* child = SPFactory::instance().createObject(*rchild); + const std::string typeString = NodeTraits::getTypeString(*rchild); + + SPObject* child = SPFactory::instance().createObject(typeString); object->attach(child, object->lastChild()); sp_object_unref(child, NULL); child->invoke_build(document, rchild, object->cloned); } catch (const SPFactory::TypeNotRegistered& e) { - log_exception(std::current_exception()); + //log_exception(std::current_exception()); + g_warning("TypeNotRegistered exception: %s", e.what()); } } } |
