Main Page   Class Hierarchy   Compound List   File List   Header Files   Sources   Compound Members   File Members  

uniset.h

This is the verbatim text of the uniset.h include file.
/*
**********************************************************************
* Copyright © {1999}, International Business Machines Corporation and others. All Rights Reserved.
**********************************************************************
*   Date        Name        Description
*   10/20/99    alan        Creation.
**********************************************************************
*/

#ifndef UNICODESET_H
#define UNICODESET_H

#include "unicode/unifilt.h"
#include "unicode/utypes.h"
#include "unicode/unistr.h"

class ParsePosition;
class SymbolTable;
class TransliterationRuleParser;
class TransliterationRule;

class U_I18N_API UnicodeSet : public UnicodeFilter {

    int32_t len; // length of list used; 0 <= len <= capacity
    int32_t capacity; // capacity of list
    int32_t bufferCapacity; // capacity of buffer
    UChar32* list; // MUST be terminated with HIGH
    UChar32* buffer; // internal buffer, may be NULL

#ifndef HPUX
    static const UChar32 HIGH; // HIGH > all valid values. 110000 for codepoints
#endif
    static const UChar32 LOW; // LOW <= all valid values. ZERO for codepoints

    static const int32_t START_EXTRA; // initial storage. Must be >= 0
    static const int32_t GROW_EXTRA; // extra amount for growth. Must be >= 0

    static const UnicodeString CATEGORY_NAMES;

    static UnicodeSet* CATEGORY_CACHE;

    static const UnicodeString CATEGORY_CLOSE;
    
    // More special characters...
    static const UChar SET_OPEN;
    static const UChar SET_CLOSE;
    static const UChar HYPHEN;
    static const UChar COMPLEMENT;
    static const UChar COLON;
    static const UChar BACKSLASH;
    static const UChar INTERSECTION;
    static const UChar UPPER_U;
    
public:

    static const UChar32 MIN_VALUE;

    static const UChar32 MAX_VALUE;

    //----------------------------------------------------------------
    // Constructors &c
    //----------------------------------------------------------------

public:

    UnicodeSet();

    UnicodeSet(UChar32 start, UChar32 end);

    UnicodeSet(const UnicodeString& pattern,
               UErrorCode& status);

    UnicodeSet(int8_t category, UErrorCode& status);

    UnicodeSet(const UnicodeSet& o);

    virtual ~UnicodeSet();

    UnicodeSet& operator=(const UnicodeSet& o);

    virtual UBool operator==(const UnicodeSet& o) const;

    UBool operator!=(const UnicodeSet& o) const;

    virtual UnicodeFilter* clone() const;

    virtual int32_t hashCode(void) const;

    //----------------------------------------------------------------
    // Public API
    //----------------------------------------------------------------

    void set(UChar32 start, UChar32 end);

    virtual void applyPattern(const UnicodeString& pattern,
                              UErrorCode& status);

    virtual UnicodeString& toPattern(UnicodeString& result) const;

    virtual int32_t size(void) const;

    virtual UBool isEmpty(void) const;

    virtual UBool contains(UChar32 start, UChar32 end) const;

    virtual UBool contains(UChar32 c) const;

    virtual UBool contains(UChar c) const;

    virtual void add(UChar32 start, UChar32 end);

    void add(UChar32 c);

    virtual void retain(UChar32 start, UChar32 end);


    void retain(UChar32 c);

    virtual void remove(UChar32 start, UChar32 end);

    void remove(UChar32 c);

    virtual void complement(void);

    virtual void complement(UChar32 start, UChar32 end);


    void complement(UChar32 c);

    virtual UBool containsAll(const UnicodeSet& c) const;

    virtual void addAll(const UnicodeSet& c);

    virtual void retainAll(const UnicodeSet& c);

    virtual void removeAll(const UnicodeSet& c);

    virtual void complementAll(const UnicodeSet& c);

    virtual void clear(void);

    virtual int32_t getRangeCount(void) const;

    virtual UChar32 getRangeStart(int32_t index) const;

    virtual UChar32 getRangeEnd(int32_t index) const;

    virtual void compact();

private:

    //----------------------------------------------------------------
    // RuleBasedTransliterator support
    //----------------------------------------------------------------

    friend class TransliterationRuleParser;
    friend class TransliterationRule;

    UnicodeSet(const UnicodeString& pattern, ParsePosition& pos,
               const SymbolTable& symbols,
               UErrorCode& status);

    UBool containsIndexValue(uint8_t v) const;

private:

    //----------------------------------------------------------------
    // Implementation: Pattern parsing
    //----------------------------------------------------------------

    void applyPattern(const UnicodeString& pattern,
                      ParsePosition& pos,
                      const SymbolTable* symbols,
                      UErrorCode& status);

    //----------------------------------------------------------------
    // Implementation: Generation of pairs for Unicode categories
    //----------------------------------------------------------------

    void applyCategory(const UnicodeString& catName,
                       UErrorCode& status);

    static const UnicodeSet& getCategorySet(int8_t cat);

    //----------------------------------------------------------------
    // Implementation: Utility methods
    //----------------------------------------------------------------

    static UChar charAfter(const UnicodeString& str, int32_t i);

    void ensureCapacity(int32_t newLen);
    
    void ensureBufferCapacity(int32_t newLen);
    
    void swapBuffers(void);

    static const UChar HEX[16];
    
    static void _toPat(UnicodeString& buf, UChar32 c);

    //----------------------------------------------------------------
    // Implementation: Fundamental operators
    //----------------------------------------------------------------

    void exclusiveOr(const UChar32* other, int32_t otherLen, int8_t polarity);
        
    void add(const UChar32* other, int32_t otherLen, int8_t polarity);
            
    void retain(const UChar32* other, int32_t otherLen, int8_t polarity);
};

inline UBool UnicodeSet::operator!=(const UnicodeSet& o) const {
        return !operator==(o);
}

#endif

Generated at Mon Jun 5 12:53:28 2000 for ICU1.5 by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999