strenum.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*
* Copyright (C) 2002-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
*/
#ifndef STRENUM_H
#define STRENUM_H
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#include "unicode/uobject.h"
#include "unicode/unistr.h"
U_NAMESPACE_BEGIN
class U_COMMON_API StringEnumeration : public UObject {
public:
virtual ~StringEnumeration();
virtual StringEnumeration *clone() const;
virtual int32_t count(UErrorCode& status) const = 0;
virtual const char* next(int32_t *resultLength, UErrorCode& status);
virtual const char16_t* unext(int32_t *resultLength, UErrorCode& status);
virtual const UnicodeString* snext(UErrorCode& status);
virtual void reset(UErrorCode& status) = 0;
virtual bool operator==(const StringEnumeration& that)const;
virtual bool operator!=(const StringEnumeration& that)const;
protected:
UnicodeString unistr;
char charsBuffer[32];
char *chars;
int32_t charsCapacity;
StringEnumeration();
void ensureCharsCapacity(int32_t capacity, UErrorCode &status);
UnicodeString *setChars(const char *s, int32_t length, UErrorCode &status);
};
U_NAMESPACE_END
#endif /* U_SHOW_CPLUSPLUS_API */
/* STRENUM_H */
#endif
icu::StringEnumeration
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:61
icu::StringEnumeration::setChars
UnicodeString * setChars(const char *s, int32_t length, UErrorCode &status)
Converts s to Unicode and sets unistr to the result.
icu::StringEnumeration::charsCapacity
int32_t charsCapacity
Capacity of chars, for use with default implementations and subclasses.
Definition: strenum.h:233
icu::StringEnumeration::chars
char * chars
char * buffer for use with default implementations and subclasses.
Definition: strenum.h:228
icu::StringEnumeration::StringEnumeration
StringEnumeration()
Default constructor for use with default implementations and subclasses.
icu::StringEnumeration::unext
virtual const char16_t * unext(int32_t *resultLength, UErrorCode &status)
icu::StringEnumeration::ensureCharsCapacity
void ensureCharsCapacity(int32_t capacity, UErrorCode &status)
Ensures that chars is at least as large as the requested capacity.
icu::StringEnumeration::unistr
UnicodeString unistr
UnicodeString field for use with default implementations and subclasses.
Definition: strenum.h:217
icu::StringEnumeration::count
virtual int32_t count(UErrorCode &status) const =0
icu::StringEnumeration::clone
virtual StringEnumeration * clone() const
Clone this object, an instance of a subclass of StringEnumeration.
icu::StringEnumeration::next
virtual const char * next(int32_t *resultLength, UErrorCode &status)
icu::StringEnumeration::~StringEnumeration
virtual ~StringEnumeration()
Destructor.
icu::StringEnumeration::snext
virtual const UnicodeString * snext(UErrorCode &status)
icu::StringEnumeration::reset
virtual void reset(UErrorCode &status)=0
icu::StringEnumeration::operator==
virtual bool operator==(const StringEnumeration &that) const
Compares this enumeration to other to check if both are equal.
icu::StringEnumeration::operator!=
virtual bool operator!=(const StringEnumeration &that) const
Compares this enumeration to other to check if both are not equal.
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
unistr.h
C++ API: Unicode String.
uobject.h
C++ API: Common ICU base class UObject.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
Definition: utypes.h:300