Logo Search packages:      
Sourcecode: icu version File versions  Download package

StringEnumeration Class Reference

#include <strenum.h>

Inheritance diagram for StringEnumeration:

UObject UMemory TransliteratorRegistry::Enumeration UStringEnumeration

List of all members.

Detailed Description

Base class for 'pure' C++ implementations of uenum api. Adds a method that returns the next UnicodeString since in C++ this can be a common storage format for strings.

The model is that the enumeration is over strings maintained by a 'service.' At any point, the service might change, invalidating the enumerator (though this is expected to be rare). The iterator returns an error if this has occurred. Lack of the error is no guarantee that the service didn't change immediately after the call, so the returned string still might not be 'valid' on subsequent use.

Strings may take the form of const char*, const UChar*, or const UnicodeString*. The type you get is determine by the variant of 'next' that you call. In general the StringEnumeration is optimized for one of these types, but all StringEnumerations can return all types. Returned strings are each terminated with a NUL. Depending on the service data, they might also include embedded NUL characters, so API is provided to optionally return the true length, counting the embedded NULs but not counting the terminating NUL.

The pointers returned by next, unext, and snext become invalid upon any subsequent call to the enumeration's destructor, next, unext, snext, or reset.

ICU 2.8 adds some default implementations and helper functions for subclasses.

ICU 2.4

Definition at line 55 of file strenum.h.

Public Member Functions

virtual StringEnumerationclone () const
virtual int32_t count (UErrorCode &status) const =0
virtual UClassID getDynamicClassID () const =0
virtual const char * next (int32_t *resultLength, UErrorCode &status)
virtual UBool operator!= (const StringEnumeration &that) const
virtual UBool operator== (const StringEnumeration &that) const
virtual void reset (UErrorCode &status)=0
virtual const UnicodeStringsnext (UErrorCode &status)=0
virtual const UChar * unext (int32_t *resultLength, UErrorCode &status)
virtual ~StringEnumeration ()

Static Public Member Functions

static void U_EXPORT2 operator delete (void *, void *) U_NO_THROW
static void U_EXPORT2 operator delete (void *p) U_NO_THROW
static void U_EXPORT2 operator delete[] (void *p) U_NO_THROW
static void *U_EXPORT2 operator new (size_t, void *ptr) U_NO_THROW
static void *U_EXPORT2 operator new (size_t size) U_NO_THROW
static void *U_EXPORT2 operator new[] (size_t size) U_NO_THROW

Protected Member Functions

void ensureCharsCapacity (int32_t capacity, UErrorCode &status)
UnicodeStringsetChars (const char *s, int32_t length, UErrorCode &status)
 StringEnumeration ()

Protected Attributes

char * chars
char charsBuffer [32]
int32_t charsCapacity
UnicodeString unistr

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

Generated by  Doxygen 1.6.0   Back to index