intl/icu/source/common/ustrenum.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /*
     2 **********************************************************************
     3 * Copyright (c) 2002-2012, International Business Machines
     4 * Corporation and others.  All Rights Reserved.
     5 **********************************************************************
     6 * Author: Alan Liu
     7 * Created: November 11 2002
     8 * Since: ICU 2.4
     9 **********************************************************************
    10 */
    11 #ifndef _USTRENUM_H_
    12 #define _USTRENUM_H_
    14 #include "unicode/uenum.h"
    15 #include "unicode/strenum.h"
    17 //----------------------------------------------------------------------
    18 U_NAMESPACE_BEGIN
    20 /**
    21  * A wrapper to make a UEnumeration into a StringEnumeration.  The
    22  * wrapper adopts the UEnumeration is wraps.
    23  */
    24 class U_COMMON_API UStringEnumeration : public StringEnumeration {
    26 public:
    27     /**
    28      * Constructor.  This constructor adopts its UEnumeration
    29      * argument.
    30      * @param uenum a UEnumeration object.  This object takes
    31      * ownership of 'uenum' and will close it in its destructor.  The
    32      * caller must not call uenum_close on 'uenum' after calling this
    33      * constructor.
    34      */
    35     UStringEnumeration(UEnumeration* uenum);
    37     /**
    38      * Destructor.  This closes the UEnumeration passed in to the
    39      * constructor.
    40      */
    41     virtual ~UStringEnumeration();
    43     /**
    44      * Return the number of elements that the iterator traverses.
    45      * @param status the error code.
    46      * @return number of elements in the iterator.
    47      */
    48     virtual int32_t count(UErrorCode& status) const;
    50     virtual const char* next(int32_t *resultLength, UErrorCode& status);
    52     /**
    53      * Returns the next element a UnicodeString*.  If there are no
    54      * more elements, returns NULL.
    55      * @param status the error code.
    56      * @return a pointer to the string, or NULL.
    57      */
    58     virtual const UnicodeString* snext(UErrorCode& status);
    60     /**
    61      * Resets the iterator.
    62      * @param status the error code.
    63      */
    64     virtual void reset(UErrorCode& status);
    66     /**
    67      * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
    68      */
    69     virtual UClassID getDynamicClassID() const;
    71     /**
    72      * ICU4C "poor man's RTTI", returns a UClassID for this ICU class.
    73      */
    74     static UClassID U_EXPORT2 getStaticClassID();
    76 private:
    77     UEnumeration *uenum; // owned
    78 };
    80 U_NAMESPACE_END
    82 #endif

mercurial