~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/debug/simple-event.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#ifndef SEEN_INKSCAPE_DEBUG_SIMPLE_EVENT_H
13
13
#define SEEN_INKSCAPE_DEBUG_SIMPLE_EVENT_H
14
14
 
 
15
#include <stdarg.h>
15
16
#include <vector>
 
17
#include <glib.h> // g_assert()
 
18
#include <glib/gstrfuncs.h>
 
19
#include <glib/gmessages.h>
 
20
 
16
21
#include "gc-alloc.h"
17
22
#include "debug/event.h"
18
23
 
37
42
        return _properties[property];
38
43
    }
39
44
 
 
45
    void generateChildEvents() const {}
 
46
 
40
47
protected:
41
48
    void _addProperty(Util::ptr_shared<char> name,
42
49
                      Util::ptr_shared<char> value)
52
59
    void _addProperty(char const *name, char const *value) {
53
60
        _addProperty(Util::share_string(name), Util::share_string(value));
54
61
    }
 
62
    void _addProperty(Util::ptr_shared<char> name, long value) {
 
63
        _addFormattedProperty(name, "%ld", value);
 
64
    }
 
65
    void _addProperty(char const *name, long value) {
 
66
        _addProperty(Util::share_string(name), value);
 
67
    }
55
68
 
56
69
private:
57
70
    Util::ptr_shared<char> _name;
58
71
    std::vector<PropertyPair, GC::Alloc<PropertyPair, GC::AUTO> > _properties;
 
72
 
 
73
    void _addFormattedProperty(Util::ptr_shared<char> name, char const *format, ...)
 
74
    {
 
75
        va_list args;
 
76
        va_start(args, format);
 
77
        gchar *value=g_strdup_vprintf(format, args);
 
78
        g_assert(value != NULL);
 
79
        va_end(args);
 
80
        _addProperty(name, value);
 
81
        g_free(value);
 
82
    }
59
83
};
60
84
 
61
85
}