File: classes.vala

package info (click to toggle)
vala 0.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,756 kB
  • ctags: 12,353
  • sloc: ansic: 116,516; sh: 9,897; yacc: 1,218; makefile: 837; xml: 657; lex: 285
file content (137 lines) | stat: -rw-r--r-- 3,875 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
using GLib;

[Compact]
class CompactClass {
	public int field;
}

[Compact]
class CompactClassWithDestructor {
	~CompactClassWithDestructor () {
		stdout.printf ("~CompactClassWithDestructor\n");
	}

	/* FIXME bug 533977 */
	public char dummy;
}

class DerivedClass : CompactClass {
}

[Compact]
public class PublicClass {
	public int field;
}

[Compact]
abstract class AbstractClass {
	public int field;
}

[Compact]
class ClassWithCreationMethod {
	public ClassWithCreationMethod () {
		stdout.printf ("ClassWithCreationMethod\n");
	}

	public int field;
}

[Compact]
class ClassWithNamedCreationMethod {
	public ClassWithNamedCreationMethod.named () {
		stdout.printf ("ClassWithNamedCreationMethod\n");
	}

	public int field;
}

class SimpleGTypeInstanceClass {
}

class DerivedGTypeInstanceClass : SimpleGTypeInstanceClass {
}

public class PublicGTypeInstanceClass {
}

class GTypeInstanceClassWithCreationMethod {
	public GTypeInstanceClassWithCreationMethod () {
		stdout.printf ("GTypeInstanceClassWithCreationMethod\n");
	}
}

class GTypeInstanceClassWithNamedCreationMethod {
	public GTypeInstanceClassWithNamedCreationMethod.named () {
		stdout.printf ("GTypeInstanceClassWithNamedCreationMethod\n");
	}
}

class SimpleGObjectClass : Object {
}

class DerivedGObjectClass : SimpleGObjectClass {
}

public class PublicGObjectClass : Object {
}

abstract class AbstractGObjectClass : Object {
}

class GObjectClassWithCreationMethod : Object {
	public GObjectClassWithCreationMethod () {
	}
}

class GObjectClassWithNamedCreationMethod : Object {
	public GObjectClassWithNamedCreationMethod.named () {
	}
}

void main () {
	stdout.printf ("Classes Test:\n");

	stdout.printf ("new CompactClass ()\n");
	var compact_class = new CompactClass ();
	stdout.printf ("new DerivedClass ()\n");
	var derived_class = new DerivedClass ();
	stdout.printf ("new PublicClass ()\n");
	var public_class = new PublicClass ();
	stdout.printf ("new ClassWithCreationMethod ()\n");
	var class_with_creation_method = new ClassWithCreationMethod ();
	stdout.printf ("new ClassWithNamedCreationMethod ()\n");
	var class_with_named_creation_method = new ClassWithNamedCreationMethod.named ();
	stdout.printf ("new CompactClassWithDestructor ()\n");
	var compact_class_with_destructor = new CompactClassWithDestructor ();
	compact_class_with_destructor = null;

	stdout.printf ("new SimpleGTypeInstanceClass ()\n");
	var simple_gtypeinstance_class = new SimpleGTypeInstanceClass ();
	stdout.printf ("new DerivedGTypeInstanceClass ()\n");
	var derived_gtypeinstance_class = new DerivedGTypeInstanceClass ();
	stdout.printf ("new PublicGTypeInstanceClass ()\n");
	var public_gtypeinstance_class = new PublicGTypeInstanceClass ();
	stdout.printf ("new GTypeInstanceClassWithCreationMethod ()\n");
	var gtypeinstance_class_with_creation_method = new GTypeInstanceClassWithCreationMethod ();
	stdout.printf ("new GTypeInstanceClassWithNamedCreationMethod ()\n");
	var gtypeinstance_class_with_named_creation_method = new GTypeInstanceClassWithNamedCreationMethod.named ();

	stdout.printf ("new SimpleGObjectClass ()\n");
	var simple_gobject_class = new SimpleGObjectClass ();
	stdout.printf ("new DerivedGObjectClass ()\n");
	var derived_gobject_class = new DerivedGObjectClass ();
	stdout.printf ("new PublicGObjectClass ()\n");
	var public_gobject_class = new PublicGObjectClass ();
	stdout.printf ("new GObjectClassWithCreationMethod ()\n");
	var gobject_class_with_creation_method = new GObjectClassWithCreationMethod ();
	stdout.printf ("new GObjectClassWithNamedCreationMethod ()\n");
	var gobject_class_with_named_creation_method = new GObjectClassWithNamedCreationMethod.named ();

	stdout.printf ("new CompactClass () { field = 1 }\n");
	compact_class = new CompactClass () { field = 1 };
	stdout.printf ("compact_class.field = %d\n", compact_class.field);

	stdout.printf (".\n");
}