From: mental Date: Thu, 10 May 2007 01:18:27 +0000 (+0000) Subject: Explicit child events and formatted properties. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=614db94556e6d94da2eb9ca82f3f90593d78e35b;p=inkscape.git Explicit child events and formatted properties. --- diff --git a/src/debug/event.h b/src/debug/event.h index 9a6954707..ad56751fc 100644 --- a/src/debug/event.h +++ b/src/debug/event.h @@ -59,6 +59,8 @@ public: virtual Util::ptr_shared name() const=0; virtual unsigned propertyCount() const=0; virtual PropertyPair property(unsigned property) const=0; + + virtual void generateChildEvents() const=0; }; } diff --git a/src/debug/logger.cpp b/src/debug/logger.cpp index 5d62f9a88..4bd0a3b08 100644 --- a/src/debug/logger.cpp +++ b/src/debug/logger.cpp @@ -170,6 +170,8 @@ void Logger::_start(Event const &event) { tag_stack().push_back(name); empty_tag = true; + + event.generateChildEvents(); } void Logger::_skip() { diff --git a/src/debug/simple-event.h b/src/debug/simple-event.h index ce803b1ce..115c1e2f4 100644 --- a/src/debug/simple-event.h +++ b/src/debug/simple-event.h @@ -12,7 +12,9 @@ #ifndef SEEN_INKSCAPE_DEBUG_SIMPLE_EVENT_H #define SEEN_INKSCAPE_DEBUG_SIMPLE_EVENT_H +#include #include +#include "glib/gstrfuncs.h" #include "gc-alloc.h" #include "debug/event.h" @@ -37,6 +39,8 @@ public: return _properties[property]; } + void generateChildEvents() const {} + protected: void _addProperty(Util::ptr_shared name, Util::ptr_shared value) @@ -52,10 +56,26 @@ protected: void _addProperty(char const *name, char const *value) { _addProperty(Util::share_string(name), Util::share_string(value)); } + void _addProperty(Util::ptr_shared name, unsigned long value) { + _addFormattedProperty(name, "%ul", value); + } + void _addProperty(char const *name, unsigned long value) { + _addProperty(Util::share_string(name), value); + } private: Util::ptr_shared _name; std::vector > _properties; + + void _addFormattedProperty(Util::ptr_shared name, char const *format, ...) + { + va_list args; + va_start(args, format); + gchar *value=g_strdup_vprintf(format, args); + va_end(args); + _addProperty(name, value); + g_free(value); + } }; }