Public Member Functions

Cairo::Device::Lock Class Reference

A convenience class for acquiring a Device object in an exception-safe manner. More...

List of all members.

Public Member Functions

 Lock (const RefPtr< Device >& device)
 Create a new Device lock for device.
 Lock (const Lock& other)
 ~Lock ()

Detailed Description

A convenience class for acquiring a Device object in an exception-safe manner.

The device is automatically acquired when a Lock object is created and released when the Lock object is destroyed. For example:

 void
 my_device_modifying_function (const RefPtr<Device>& device)
 {
   // Ensure the device is properly reset
   device->flush();

   Device::Lock lock(device);
   // Do the custom operations on the device here.
   // But do not call any Cairo functions that might acquire devices.

 } // device is automatically released at the end of the function scope

Constructor & Destructor Documentation

Cairo::Device::Lock::Lock ( const RefPtr< Device >&  device)

Create a new Device lock for device.

Cairo::Device::Lock::Lock ( const Lock other)
Cairo::Device::Lock::~Lock ( )

The documentation for this class was generated from the following file: