os/textandloc/fontservices/textshaperplugin/IcuSource/common/ustrenum.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
**********************************************************************
sl@0
     3
* Copyright (c) 2002-2004, International Business Machines
sl@0
     4
* Corporation and others.  All Rights Reserved.
sl@0
     5
**********************************************************************
sl@0
     6
* Author: Alan Liu
sl@0
     7
* Created: November 11 2002
sl@0
     8
* Since: ICU 2.4
sl@0
     9
**********************************************************************
sl@0
    10
*/
sl@0
    11
#ifndef _USTRENUM_H_
sl@0
    12
#define _USTRENUM_H_
sl@0
    13
sl@0
    14
#include "unicode/uenum.h"
sl@0
    15
#include "unicode/strenum.h"
sl@0
    16
sl@0
    17
/**
sl@0
    18
 * Given a StringEnumeration, wrap it in a UEnumeration.  The
sl@0
    19
 * StringEnumeration is adopted; after this call, the caller must not
sl@0
    20
 * delete it (regardless of error status).
sl@0
    21
 */
sl@0
    22
U_CAPI UEnumeration* U_EXPORT2
sl@0
    23
uenum_openStringEnumeration(StringEnumeration* adopted, UErrorCode* ec);
sl@0
    24
sl@0
    25
/**
sl@0
    26
 * Given an array of const char* strings (invariant chars only),
sl@0
    27
 * return a UEnumeration.  Must have strings[i] != 0 for i in
sl@0
    28
 * 0..count-1.
sl@0
    29
 */
sl@0
    30
U_CAPI UEnumeration* U_EXPORT2
sl@0
    31
uenum_openCharStringsEnumeration(const char** strings, int32_t count,
sl@0
    32
                                 UErrorCode* ec);
sl@0
    33
sl@0
    34
//----------------------------------------------------------------------
sl@0
    35
U_NAMESPACE_BEGIN
sl@0
    36
sl@0
    37
/**
sl@0
    38
 * A wrapper to make a UEnumeration into a StringEnumeration.  The
sl@0
    39
 * wrapper adopts the UEnumeration is wraps.
sl@0
    40
 */
sl@0
    41
class U_COMMON_API UStringEnumeration : public StringEnumeration {
sl@0
    42
sl@0
    43
public:
sl@0
    44
    /**
sl@0
    45
     * Constructor.  This constructor adopts its UEnumeration
sl@0
    46
     * argument.
sl@0
    47
     * @param uenum a UEnumeration object.  This object takes
sl@0
    48
     * ownership of 'uenum' and will close it in its destructor.  The
sl@0
    49
     * caller must not call uenum_close on 'uenum' after calling this
sl@0
    50
     * constructor.
sl@0
    51
     */
sl@0
    52
    UStringEnumeration(UEnumeration* uenum);
sl@0
    53
sl@0
    54
    /**
sl@0
    55
     * Destructor.  This closes the UEnumeration passed in to the
sl@0
    56
     * constructor.
sl@0
    57
     */
sl@0
    58
    virtual ~UStringEnumeration();
sl@0
    59
sl@0
    60
    /**
sl@0
    61
     * Return the number of elements that the iterator traverses.
sl@0
    62
     * @param status the error code.
sl@0
    63
     * @return number of elements in the iterator.
sl@0
    64
     */
sl@0
    65
    virtual int32_t count(UErrorCode& status) const;
sl@0
    66
sl@0
    67
    /**
sl@0
    68
     * Returns the next element a UnicodeString*.  If there are no
sl@0
    69
     * more elements, returns NULL.
sl@0
    70
     * @param status the error code.
sl@0
    71
     * @return a pointer to the string, or NULL.
sl@0
    72
     */
sl@0
    73
    virtual const UnicodeString* snext(UErrorCode& status);
sl@0
    74
sl@0
    75
    /**
sl@0
    76
     * Resets the iterator.
sl@0
    77
     * @param status the error code.
sl@0
    78
     */
sl@0
    79
    virtual void reset(UErrorCode& status);
sl@0
    80
sl@0
    81
    /**
sl@0
    82
     * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
sl@0
    83
     */
sl@0
    84
    virtual UClassID getDynamicClassID() const;
sl@0
    85
sl@0
    86
    /**
sl@0
    87
     * ICU4C "poor man's RTTI", returns a UClassID for this ICU class.
sl@0
    88
     */
sl@0
    89
    static UClassID U_EXPORT2 getStaticClassID();
sl@0
    90
sl@0
    91
private:
sl@0
    92
    UEnumeration *uenum; // owned
sl@0
    93
};
sl@0
    94
sl@0
    95
U_NAMESPACE_END
sl@0
    96
sl@0
    97
#endif
sl@0
    98