Back to index

lightning-sunbird  0.9+nobinonly
Classes
icptrholder.h File Reference

C++ template classes for managing C++ pointers returned by VComponent::get_..._component, VComponent::get_..._property, ICalPropety::get_..._value. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ICPointerHolder< T >

Detailed Description

C++ template classes for managing C++ pointers returned by VComponent::get_..._component, VComponent::get_..._property, ICalPropety::get_..._value.

Author:
wyau (08/29/02)
Remarks:
VComponent::get... functions returns a C++ oject that wraps the libical implementation. It is important to note that the wrapped implementation still belongs to the orginal component. To stop memory leak, caller must delete the pointer. However, the destructor will call the appropriate free function. eg. ~VComponent calls icalcomponent_free(imp). As stated previously, imp stil belongs to the original component. To avoid freeing the wrapped "imp", caller must set the "imp" to null before deleting the pointer.

The template class relieves the burden of memory management when used as a stack based object. The class holds a pointer to the C++ Wrapper. The destructor set the imp to null before deleting the pointer.

Each C++ Wrapper instantiates a template class in it's corresponding .h file.

Usage example: VComponentTmpPtr p; // VComponentTmpPtr is an instantiation of this template for (p=component.get_first_component; p!= NULL; p=component.get_next_component) {

(C) COPYRIGHT 2001, Critical Path

Definition in file icptrholder.h.