2020-08-11 11:10:23 +02:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
|
|
|
/*
|
|
|
|
**********************************************************************
|
|
|
|
* Copyright (c) 2002-2014, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
|
|
|
* Author: Alan Liu
|
|
|
|
* Created: November 11 2002
|
|
|
|
* Since: ICU 2.4
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
|
|
|
#ifndef _USTRENUM_H_
|
|
|
|
#define _USTRENUM_H_
|
|
|
|
|
|
|
|
#include "unicode/uenum.h"
|
|
|
|
#include "unicode/strenum.h"
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A wrapper to make a UEnumeration into a StringEnumeration. The
|
|
|
|
* wrapper adopts the UEnumeration is wraps.
|
|
|
|
*/
|
|
|
|
class U_COMMON_API UStringEnumeration : public StringEnumeration {
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Constructor. This constructor adopts its UEnumeration
|
|
|
|
* argument.
|
|
|
|
* @param uenum a UEnumeration object. This object takes
|
|
|
|
* ownership of 'uenum' and will close it in its destructor. The
|
|
|
|
* caller must not call uenum_close on 'uenum' after calling this
|
|
|
|
* constructor.
|
|
|
|
*/
|
|
|
|
UStringEnumeration(UEnumeration* uenum);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor. This closes the UEnumeration passed in to the
|
|
|
|
* constructor.
|
|
|
|
*/
|
|
|
|
virtual ~UStringEnumeration();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the number of elements that the iterator traverses.
|
|
|
|
* @param status the error code.
|
|
|
|
* @return number of elements in the iterator.
|
|
|
|
*/
|
2021-10-28 08:15:28 +02:00
|
|
|
virtual int32_t count(UErrorCode& status) const override;
|
2020-08-11 11:10:23 +02:00
|
|
|
|
2021-10-28 08:15:28 +02:00
|
|
|
virtual const char* next(int32_t *resultLength, UErrorCode& status) override;
|
2020-08-11 11:10:23 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the next element a UnicodeString*. If there are no
|
2023-05-23 02:05:01 +02:00
|
|
|
* more elements, returns nullptr.
|
2020-08-11 11:10:23 +02:00
|
|
|
* @param status the error code.
|
2023-05-23 02:05:01 +02:00
|
|
|
* @return a pointer to the string, or nullptr.
|
2020-08-11 11:10:23 +02:00
|
|
|
*/
|
2021-10-28 08:15:28 +02:00
|
|
|
virtual const UnicodeString* snext(UErrorCode& status) override;
|
2020-08-11 11:10:23 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Resets the iterator.
|
|
|
|
* @param status the error code.
|
|
|
|
*/
|
2021-10-28 08:15:28 +02:00
|
|
|
virtual void reset(UErrorCode& status) override;
|
2020-08-11 11:10:23 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
|
|
|
|
*/
|
2021-10-28 08:15:28 +02:00
|
|
|
virtual UClassID getDynamicClassID() const override;
|
2020-08-11 11:10:23 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU4C "poor man's RTTI", returns a UClassID for this ICU class.
|
|
|
|
*/
|
|
|
|
static UClassID U_EXPORT2 getStaticClassID();
|
|
|
|
|
|
|
|
static UStringEnumeration * U_EXPORT2 fromUEnumeration(
|
|
|
|
UEnumeration *enumToAdopt, UErrorCode &status);
|
|
|
|
private:
|
|
|
|
UEnumeration *uenum; // owned
|
|
|
|
};
|
|
|
|
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|