Code

make Debug::SimpleEvent more convenient
[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         OTHER
35     };
36     enum { N_CATEGORIES=OTHER+1 };
38     struct PropertyPair {
39     public:
40         PropertyPair() {}
41         PropertyPair(Util::ptr_shared<char> n, Util::ptr_shared<char> v)
42         : name(n), value(v) {}
43         PropertyPair(char const *n, Util::ptr_shared<char> v)
44         : name(Util::share_string(n)), value(v) {}
45         PropertyPair(Util::ptr_shared<char> n, char const *v)
46         : name(n), value(Util::share_string(v)) {}
47         PropertyPair(char const *n, char const *v)
48         : name(Util::share_string(n)),
49           value(Util::share_string(v)) {}
51         Util::ptr_shared<char> name;
52         Util::ptr_shared<char> value;
53     };
55     static Category category() { return OTHER; }
57     virtual Util::ptr_shared<char> name() const=0;
58     virtual unsigned propertyCount() const=0;
59     virtual PropertyPair property(unsigned property) const=0;
60 };
62 }
64 }
66 #endif
67 /*
68   Local Variables:
69   mode:c++
70   c-file-style:"stroustrup"
71   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
72   indent-tabs-mode:nil
73   fill-column:99
74   End:
75 */
76 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :