os/textandloc/fontservices/textshaperplugin/IcuSource/common/ustrenum.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/common/ustrenum.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,98 @@
     1.4 +/*
     1.5 +**********************************************************************
     1.6 +* Copyright (c) 2002-2004, International Business Machines
     1.7 +* Corporation and others.  All Rights Reserved.
     1.8 +**********************************************************************
     1.9 +* Author: Alan Liu
    1.10 +* Created: November 11 2002
    1.11 +* Since: ICU 2.4
    1.12 +**********************************************************************
    1.13 +*/
    1.14 +#ifndef _USTRENUM_H_
    1.15 +#define _USTRENUM_H_
    1.16 +
    1.17 +#include "unicode/uenum.h"
    1.18 +#include "unicode/strenum.h"
    1.19 +
    1.20 +/**
    1.21 + * Given a StringEnumeration, wrap it in a UEnumeration.  The
    1.22 + * StringEnumeration is adopted; after this call, the caller must not
    1.23 + * delete it (regardless of error status).
    1.24 + */
    1.25 +U_CAPI UEnumeration* U_EXPORT2
    1.26 +uenum_openStringEnumeration(StringEnumeration* adopted, UErrorCode* ec);
    1.27 +
    1.28 +/**
    1.29 + * Given an array of const char* strings (invariant chars only),
    1.30 + * return a UEnumeration.  Must have strings[i] != 0 for i in
    1.31 + * 0..count-1.
    1.32 + */
    1.33 +U_CAPI UEnumeration* U_EXPORT2
    1.34 +uenum_openCharStringsEnumeration(const char** strings, int32_t count,
    1.35 +                                 UErrorCode* ec);
    1.36 +
    1.37 +//----------------------------------------------------------------------
    1.38 +U_NAMESPACE_BEGIN
    1.39 +
    1.40 +/**
    1.41 + * A wrapper to make a UEnumeration into a StringEnumeration.  The
    1.42 + * wrapper adopts the UEnumeration is wraps.
    1.43 + */
    1.44 +class U_COMMON_API UStringEnumeration : public StringEnumeration {
    1.45 +
    1.46 +public:
    1.47 +    /**
    1.48 +     * Constructor.  This constructor adopts its UEnumeration
    1.49 +     * argument.
    1.50 +     * @param uenum a UEnumeration object.  This object takes
    1.51 +     * ownership of 'uenum' and will close it in its destructor.  The
    1.52 +     * caller must not call uenum_close on 'uenum' after calling this
    1.53 +     * constructor.
    1.54 +     */
    1.55 +    UStringEnumeration(UEnumeration* uenum);
    1.56 +
    1.57 +    /**
    1.58 +     * Destructor.  This closes the UEnumeration passed in to the
    1.59 +     * constructor.
    1.60 +     */
    1.61 +    virtual ~UStringEnumeration();
    1.62 +
    1.63 +    /**
    1.64 +     * Return the number of elements that the iterator traverses.
    1.65 +     * @param status the error code.
    1.66 +     * @return number of elements in the iterator.
    1.67 +     */
    1.68 +    virtual int32_t count(UErrorCode& status) const;
    1.69 +
    1.70 +    /**
    1.71 +     * Returns the next element a UnicodeString*.  If there are no
    1.72 +     * more elements, returns NULL.
    1.73 +     * @param status the error code.
    1.74 +     * @return a pointer to the string, or NULL.
    1.75 +     */
    1.76 +    virtual const UnicodeString* snext(UErrorCode& status);
    1.77 +
    1.78 +    /**
    1.79 +     * Resets the iterator.
    1.80 +     * @param status the error code.
    1.81 +     */
    1.82 +    virtual void reset(UErrorCode& status);
    1.83 +
    1.84 +    /**
    1.85 +     * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
    1.86 +     */
    1.87 +    virtual UClassID getDynamicClassID() const;
    1.88 +
    1.89 +    /**
    1.90 +     * ICU4C "poor man's RTTI", returns a UClassID for this ICU class.
    1.91 +     */
    1.92 +    static UClassID U_EXPORT2 getStaticClassID();
    1.93 +
    1.94 +private:
    1.95 +    UEnumeration *uenum; // owned
    1.96 +};
    1.97 +
    1.98 +U_NAMESPACE_END
    1.99 +
   1.100 +#endif
   1.101 +