Code

Explicit child events and formatted properties.
[inkscape.git] / src / debug / event.h
1 /*
2  * Inkscape::Debug::Event - event for debug tracing
3  *
4  * Authors:
5  *   MenTaLguY <mental@rydia.net>
6  *
7  * Copyright (C) 2005 MenTaLguY
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #ifndef SEEN_INKSCAPE_DEBUG_EVENT_H
13 #define SEEN_INKSCAPE_DEBUG_EVENT_H
15 #include <utility>
16 #include "util/share.h"
18 namespace Inkscape {
20 namespace Debug {
22 class Event {
23 public:
24     virtual ~Event() {}
26     enum Category {
27         CORE=0,
28         XML,
29         SPOBJECT,
30         DOCUMENT,
31         REFCOUNT,
32         EXTENSION,
33         FINALIZERS,
34         INTERACTION,
35         CONFIGURATION,
36         OTHER
37     };
38     enum { N_CATEGORIES=OTHER+1 };
40     struct PropertyPair {
41     public:
42         PropertyPair() {}
43         PropertyPair(Util::ptr_shared<char> n, Util::ptr_shared<char> v)
44         : name(n), value(v) {}
45         PropertyPair(char const *n, Util::ptr_shared<char> v)
46         : name(Util::share_string(n)), value(v) {}
47         PropertyPair(Util::ptr_shared<char> n, char const *v)
48         : name(n), value(Util::share_string(v)) {}
49         PropertyPair(char const *n, char const *v)
50         : name(Util::share_string(n)),
51           value(Util::share_string(v)) {}
53         Util::ptr_shared<char> name;
54         Util::ptr_shared<char> value;
55     };
57     static Category category() { return OTHER; }
59     virtual Util::ptr_shared<char> name() const=0;
60     virtual unsigned propertyCount() const=0;
61     virtual PropertyPair property(unsigned property) const=0;
63     virtual void generateChildEvents() const=0;
64 };
66 }
68 }
70 #endif
71 /*
72   Local Variables:
73   mode:c++
74   c-file-style:"stroustrup"
75   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
76   indent-tabs-mode:nil
77   fill-column:99
78   End:
79 */
80 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :