027_extends.c
Go to the documentation of this file.
1 // objective: test the \extends, \implements, \memberof, \private, and \public commands
2 // check: struct_object.xml
3 // check: struct_vehicle.xml
4 // check: struct_car.xml
5 // check: struct_truck.xml
6 
7 /**
8  * \file
9  */
10 
11 typedef struct Object Object; //!< Object type
12 typedef struct Vehicle Vehicle; //!< Vehicle type
13 typedef struct Car Car; //!< Car type
14 typedef struct Truck Truck; //!< Truck type
15 
16 /*!
17  * Base object class.
18  */
19 struct Object
20 {
21  int ref; //!< \private Reference count.
22 };
23 
24 
25 /*!
26  * Increments object reference count by one.
27  * \public \memberof Object
28  */
29 static Object * objRef(Object *obj);
30 
31 
32 /*!
33  * Decrements object reference count by one.
34  * \public \memberof Object
35  */
36 static Object * objUnref(Object *obj);
37 
38 
39 /*!
40  * Vehicle class.
41  * \extends Object
42  */
43 struct Vehicle
44 {
45  Object base; //!< \protected Base class.
46 };
47 
48 
49 /*!
50  * Starts the vehicle.
51  * \public \memberof Vehicle
52  */
53 void vehicleStart(Vehicle *obj);
54 
55 
56 /*!
57  * Stops the vehicle.
58  * \public \memberof Vehicle
59  */
60 void vehicleStop(Vehicle *obj);
61 
62 
63 /*!
64  * Car class.
65  * \implements Vehicle
66  */
67 struct Car
68 {
69  Vehicle base; //!< \protected Base class.
70 };
71 
72 
73 /*!
74  * Truck class.
75  * \implements Vehicle
76  */
77 struct Truck
78 {
79  Vehicle base; //!< \protected Base class.
80 };
81 
82 
83 /*!
84  * Main function.
85  *
86  * Ref vehicleStart(), objRef(), objUnref().
87  */
88 int main(void)
89 {
90  Car c;
91  vehicleStart((Vehicle*) &c);
92 }
93 
int main(void)
Definition: 027_extends.c:88
Definition: manual.c:37
int ref
Reference count.
Definition: manual.c:15
Definition: manual.c:71
Definition: manual.c:61
static Object * objUnref(Object *obj)
static Object * objRef(Object *obj)
Definition: manual.c:13