Blame testing/027_extends.c

Packit Service 50c9f2
// objective: test the \extends, \implements, \memberof, \private, and \public commands
Packit Service 50c9f2
// check: struct_object.xml
Packit Service 50c9f2
// check: struct_vehicle.xml
Packit Service 50c9f2
// check: struct_car.xml
Packit Service 50c9f2
// check: struct_truck.xml
Packit Service 50c9f2
Packit Service 50c9f2
/**
Packit Service 50c9f2
 * \file 
Packit Service 50c9f2
 */
Packit Service 50c9f2
Packit Service 50c9f2
typedef struct Object Object;   //!< Object type
Packit Service 50c9f2
typedef struct Vehicle Vehicle; //!< Vehicle type
Packit Service 50c9f2
typedef struct Car Car;         //!< Car type
Packit Service 50c9f2
typedef struct Truck Truck;     //!< Truck type
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
 * Base object class.
Packit Service 50c9f2
 */
Packit Service 50c9f2
struct Object
Packit Service 50c9f2
{
Packit Service 50c9f2
  int ref;    //!< \private Reference count.
Packit Service 50c9f2
};
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
 * Increments object reference count by one.
Packit Service 50c9f2
 * \public \memberof Object
Packit Service 50c9f2
 */
Packit Service 50c9f2
static Object * objRef(Object *obj);
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
 * Decrements object reference count by one.
Packit Service 50c9f2
 * \public \memberof Object
Packit Service 50c9f2
 */
Packit Service 50c9f2
static Object * objUnref(Object *obj);
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
 * Vehicle class.
Packit Service 50c9f2
 * \extends Object
Packit Service 50c9f2
 */
Packit Service 50c9f2
struct Vehicle
Packit Service 50c9f2
{
Packit Service 50c9f2
  Object base;    //!< \protected Base class.
Packit Service 50c9f2
};
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
 * Starts the vehicle.
Packit Service 50c9f2
 * \public \memberof Vehicle
Packit Service 50c9f2
 */
Packit Service 50c9f2
void vehicleStart(Vehicle *obj);
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
 * Stops the vehicle.
Packit Service 50c9f2
 * \public \memberof Vehicle
Packit Service 50c9f2
 */
Packit Service 50c9f2
void vehicleStop(Vehicle *obj);
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
 * Car class.
Packit Service 50c9f2
 * \implements Vehicle
Packit Service 50c9f2
 */
Packit Service 50c9f2
struct Car
Packit Service 50c9f2
{
Packit Service 50c9f2
  Vehicle base;    //!< \protected Base class.
Packit Service 50c9f2
};
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
 * Truck class.
Packit Service 50c9f2
 * \implements Vehicle
Packit Service 50c9f2
 */
Packit Service 50c9f2
struct Truck
Packit Service 50c9f2
{
Packit Service 50c9f2
  Vehicle base;    //!< \protected Base class.
Packit Service 50c9f2
};
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
/*!
Packit Service 50c9f2
 * Main function.
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * Ref vehicleStart(), objRef(), objUnref().
Packit Service 50c9f2
 */
Packit Service 50c9f2
int main(void)
Packit Service 50c9f2
{
Packit Service 50c9f2
  Car c;
Packit Service 50c9f2
  vehicleStart((Vehicle*) &c);
Packit Service 50c9f2
}
Packit Service 50c9f2