summaryrefslogtreecommitdiffstats
path: root/src/debug
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2007-05-10 01:18:27 +0000
committermental <mental@users.sourceforge.net>2007-05-10 01:18:27 +0000
commitb730b746fbcffea00aba591d78213379b4b1dbd6 (patch)
tree1e697f6731387ca00dce3dcd021f544acb54cf42 /src/debug
parentadd configuration event type (diff)
downloadinkscape-b730b746fbcffea00aba591d78213379b4b1dbd6.tar.gz
inkscape-b730b746fbcffea00aba591d78213379b4b1dbd6.zip
Explicit child events and formatted properties.
(bzr r2991)
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/event.h2
-rw-r--r--src/debug/logger.cpp2
-rw-r--r--src/debug/simple-event.h20
3 files changed, 24 insertions, 0 deletions
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<char> 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 <stdarg.h>
#include <vector>
+#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<char> name,
Util::ptr_shared<char> 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<char> 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<char> _name;
std::vector<PropertyPair, GC::Alloc<PropertyPair, GC::AUTO> > _properties;
+
+ void _addFormattedProperty(Util::ptr_shared<char> 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);
+ }
};
}