File: class.h

package info (click to toggle)
kdevelop 4%3A24.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 71,888 kB
  • sloc: cpp: 290,869; python: 3,626; javascript: 3,518; sh: 1,316; ansic: 703; xml: 401; php: 95; lisp: 66; makefile: 31; sed: 12
file content (83 lines) | stat: -rw-r--r-- 2,566 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{% load kdev_filters %}
{% include "license_header_cpp.txt" %}


{% with namespaces|join:"_"|default:"___"|add:"_"|cut:"____"|upper as uc_prefix %}
{% with namespaces|join:"_"|default:"___"|add:"_"|cut:"____"|lower as lc_prefix %}
{% with namespaces|join:"" as prefix %}
{% with prefix|add:name as full_name %}

/* inclusion guard */
#ifndef __{{ uc_prefix }}{{ name|upper }}_H__
#define __{{ uc_prefix }}{{ name|upper }}_H__


#include <glib-object.h>
/*
 * Potentially, include other headers on which this header depends.
 */


/*
 * Type macros.
 */
#define {{ uc_prefix }}TYPE_{{ name|upper }}                  ({{ lc_prefix }}{{ name|lower }}_get_type ())
#define {{ uc_prefix }}{{ name|upper }}(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), {{ uc_prefix }}TYPE_{{ name|upper }}, {{ full_name }}))
#define {{ uc_prefix }}IS_{{ name|upper }}(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), {{ uc_prefix }}TYPE_{{ name|upper }}))
#define {{ uc_prefix }}{{ name|upper }}_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), {{ uc_prefix }}TYPE_{{ name|upper }}, {{ full_name }}Class))
#define {{ uc_prefix }}IS_{{ name|upper }}_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), {{ uc_prefix }}TYPE_{{ name|upper }}))
#define {{ uc_prefix }}{{ name|upper }}_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), {{ uc_prefix }}TYPE_{{ name|upper }}, {{ full_name }}Class))


typedef struct _{{ full_name }}       {{ full_name }};
typedef struct _{{ full_name }}Class   {{ full_name }}Class;


struct _{{ full_name }}
{
  GObject parent_instance;


  /* instance members */
  {% for m in members %}
  {{ m.type }} {{ m.name }};
  {% endfor %}
};


struct _{{ full_name }}Class
{
  GObjectClass parent_class;

  /* class members */
  {% for f in functions %}
  {% if f.isVirtual %}
    {% with f.arguments as arguments %}
    {{ f.returnType|default:"void" }} (*{{ f.name }}) ({{ full_name }}* self{% if arguments %}, {% include "arguments_types_names.txt" %}{% endif %});
    {% endwith %}
  {% endif %}
  {% endfor %}

};


/* used by {{ uc_prefix }}TYPE_{{ name|upper }} */
GType {{ lc_prefix }}{{ name|lower }}_get_type (void);


/*
 * Method definitions.
 */
{% for f in functions %}
{% with f.arguments as arguments %}
{{ f.returnType|default:"void" }} {{ lc_prefix }}{{ name|lower }}_{{ f.name }}({{ full_name }}* self{% if arguments %}, {% include "arguments_types_names.txt" %}{% endif %});
{% endwith %}
{% endfor %}


#endif /* __{{ uc_prefix }}{{ name|upper }}_H__ */

{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}