File indexing completed on 2024-05-12 04:37:33
0001 {% load kdev_filters %} 0002 {% include "license_header_cpp.txt" %} 0003 0004 0005 #include "{{ output_file_header }}" 0006 0007 {% with namespaces|join:"_"|default:"___"|add:"_"|cut:"____"|upper as uc_prefix %} 0008 {% with namespaces|join:"_"|default:"___"|add:"_"|cut:"____"|lower as lc_prefix %} 0009 {% with namespaces|join:"" as prefix %} 0010 {% with prefix|add:name as full_name %} 0011 0012 /* 0013 * forward definitions 0014 */ 0015 G_DEFINE_TYPE ({{ full_name }}, {{ lc_prefix }}{{ name|lower }}, G_TYPE_OBJECT); 0016 0017 /* 0018 /* forward declarations of default virtual methods 0019 */ 0020 0021 {% for f in functions %} 0022 {% if f.isVirtual %} 0023 {% with f.arguments as arguments %} 0024 {{ f.returnType|default:"void" }} {{ lc_prefix }}{{ name|lower }}_real_{{ f.name }}({{ full_name }}* self{% if arguments %}, {% include "arguments_types_names.txt" %}{% endif %}); 0025 {% endwith %} 0026 {% endif %} 0027 {% endfor %} 0028 0029 static void 0030 {{ lc_prefix }}{{ name|lower }}_dispose (GObject *gobject) 0031 { 0032 {{ full_name }} *self = {{ uc_prefix }}{{ name|upper }} (gobject); 0033 0034 0035 /* 0036 * In dispose, you are supposed to free all types referenced from this 0037 * object which might themselves hold a reference to self. Generally, 0038 * the most simple solution is to unref all members on which you own a 0039 * reference. 0040 */ 0041 0042 0043 /* Chain up to the parent class */ 0044 G_OBJECT_CLASS ({{ lc_prefix }}{{ name|lower }}_parent_class)->dispose (gobject); 0045 } 0046 0047 0048 static void 0049 {{ lc_prefix }}{{ name|lower }}_finalize (GObject *gobject) 0050 { 0051 {{ full_name }} *self = {{ uc_prefix }}{{ name|upper }} (gobject); 0052 0053 0054 /* Chain up to the parent class */ 0055 G_OBJECT_CLASS ({{ lc_prefix }}{{ name|lower }}_parent_class)->finalize (gobject); 0056 } 0057 0058 0059 static void 0060 {{ lc_prefix }}{{ name|lower }}_init ({{ full_name }} *self) 0061 { 0062 /* initialize all public and private members to reasonable default values. */ 0063 0064 0065 /* Default implementations for virtual methods 0066 * For pure-virtual functions, set these to NULL 0067 */ 0068 {% for f in functions %} 0069 {% if f.isVirtual %} 0070 klass->{{ f.name }} = {{ lc_prefix }}{{ name|lower }}_real_{{ f.name }}; 0071 {% endif %} 0072 {% endfor %} 0073 } 0074 0075 {% for f in functions %} 0076 {% with f.arguments as arguments %} 0077 {{ f.returnType|default:"void" }} {{ lc_prefix }}{{ name|lower }}_{{ f.name }}({{ full_name }}* self{% if arguments %}, {% include "arguments_types_names.txt" %}{% endif %}) 0078 { 0079 g_return_if_fail ({{ uc_prefix }}IS_{{ name|upper }} (self)); 0080 0081 {% if f.isVirtual %} 0082 {{ uc_prefix }}{{ name|upper }}_GET_CLASS (self)->{{ f.name }} (self{% if arguments %}, {% include "arguments_names.txt" %}{% endif %}); 0083 {% endif %} 0084 0085 } 0086 0087 {% if f.isVirtual %} 0088 {{ f.returnType|default:"void" }} {{ lc_prefix }}{{ name|lower }}_real_{{ f.name }}({{ full_name }}* self{% if arguments %}, {% include "arguments_types_names.txt" %}{% endif %}) 0089 { 0090 /* Default implementation for the virtual method {{ f.name }} */ 0091 } 0092 {% endif %} 0093 {% endwith %} 0094 {% endfor %} 0095 0096 {% endwith %} 0097 {% endwith %} 0098 {% endwith %} 0099 {% endwith %}