Blame tests/upstream-test-suite/027_extends.c

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