"Fossies" - the Fresh Open Source Software Archive

Member "localpointer_8h.html" (3 Oct 2019, 10066 Bytes) of package /linux/misc/icu4c-65_1-docs.zip:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the project site itself.

ICU 65.1  65.1
Data Structures | Namespaces | Macros
localpointer.h File Reference

C++ API: "Smart pointers" for use with and in ICU4C C++ code. More...

#include "unicode/utypes.h"
#include <memory>

Go to the source code of this file.

Data Structures

class  icu::LocalPointerBase< T >
 "Smart pointer" base class; do not use directly: use LocalPointer etc. More...
 
class  icu::LocalPointer< T >
 "Smart pointer" class, deletes objects via the standard C++ delete operator. More...
 
class  icu::LocalArray< T >
 "Smart pointer" class, deletes objects via the C++ array delete[] operator. More...
 

Namespaces

 icu
 File coll.h.
 

Macros

#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
 "Smart pointer" definition macro, deletes objects via the closeFunction. More...
 

Detailed Description

C++ API: "Smart pointers" for use with and in ICU4C C++ code.

These classes are inspired by

but none of those provide for all of the goals for ICU smart pointers:

For details see http://site.icu-project.org/design/cpp/scoped_ptr

Definition in file localpointer.h.

Macro Definition Documentation

◆ U_DEFINE_LOCAL_OPEN_POINTER

#define U_DEFINE_LOCAL_OPEN_POINTER (   LocalPointerClassName,
  Type,
  closeFunction 
)

"Smart pointer" definition macro, deletes objects via the closeFunction.

Defines a subclass of LocalPointerBase which works just like LocalPointer<Type> except that this subclass will use the closeFunction rather than the C++ delete operator.

Usage example:

LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode));
utf8OutLength=ucasemap_utf8ToLower(csm.getAlias(),
utf8Out, (int32_t)sizeof(utf8Out),
utf8In, utf8InLength, &errorCode);
if(U_FAILURE(errorCode)) { return; } // no need to explicitly delete the UCaseMap
See also
LocalPointerBase
LocalPointer
Stable:
ICU 4.4

Definition at line 562 of file localpointer.h.