Libical API Documentation 3.0
Loading...
Searching...
No Matches
Data Structures
icptrholder_cxx.h File Reference

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

Go to the source code of this file.

Data Structures

class  ICPointerHolder< T >
 

Detailed Description

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

Author
wyau (08/29/02)
Remarks
VComponent::get... functions returns a C++ object that wraps the libical implementation. It is important to note that the wrapped implementation still belongs to the original 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 still 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 its corresponding .h file.

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

(C) COPYRIGHT 2001, Critical Path

This library is free software; you can redistribute it and/or modify it under the terms of either:

The LGPL as published by the Free Software Foundation, version 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html

Or:

The Mozilla Public License Version 2.0. You may obtain a copy of the License at https://www.mozilla.org/MPL/