intl/icu/source/i18n/scriptset.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /*
michael@0 2 **********************************************************************
michael@0 3 * Copyright (C) 2013, International Business Machines
michael@0 4 * Corporation and others. All Rights Reserved.
michael@0 5 **********************************************************************
michael@0 6 *
michael@0 7 * scriptset.h
michael@0 8 *
michael@0 9 * created on: 2013 Jan 7
michael@0 10 * created by: Andy Heninger
michael@0 11 */
michael@0 12
michael@0 13 #ifndef __SCRIPTSET_H__
michael@0 14 #define __SCRIPTSET_H__
michael@0 15
michael@0 16 #include "unicode/utypes.h"
michael@0 17 #include "unicode/uobject.h"
michael@0 18 #include "unicode/uscript.h"
michael@0 19
michael@0 20 #include "uelement.h"
michael@0 21
michael@0 22 U_NAMESPACE_BEGIN
michael@0 23
michael@0 24 //-------------------------------------------------------------------------------
michael@0 25 //
michael@0 26 // ScriptSet - A bit set representing a set of scripts.
michael@0 27 //
michael@0 28 // This class was originally used exclusively with script sets appearing
michael@0 29 // as part of the spoof check whole script confusable binary data. Its
michael@0 30 // use has since become more general, but the continued use to wrap
michael@0 31 // prebuilt binary data does constrain the design.
michael@0 32 //
michael@0 33 //-------------------------------------------------------------------------------
michael@0 34 class U_I18N_API ScriptSet: public UMemory {
michael@0 35 public:
michael@0 36 ScriptSet();
michael@0 37 ScriptSet(const ScriptSet &other);
michael@0 38 ~ScriptSet();
michael@0 39
michael@0 40 UBool operator == (const ScriptSet &other) const;
michael@0 41 ScriptSet & operator = (const ScriptSet &other);
michael@0 42
michael@0 43 UBool test(UScriptCode script, UErrorCode &status) const;
michael@0 44 ScriptSet &Union(const ScriptSet &other);
michael@0 45 ScriptSet &set(UScriptCode script, UErrorCode &status);
michael@0 46 ScriptSet &reset(UScriptCode script, UErrorCode &status);
michael@0 47 ScriptSet &intersect(const ScriptSet &other);
michael@0 48 ScriptSet &intersect(UScriptCode script, UErrorCode &status);
michael@0 49 UBool intersects(const ScriptSet &other) const; // Sets contain at least one script in commmon.
michael@0 50 UBool contains(const ScriptSet &other) const; // All set bits in other are also set in this.
michael@0 51
michael@0 52 ScriptSet &setAll();
michael@0 53 ScriptSet &resetAll();
michael@0 54 int32_t countMembers() const;
michael@0 55 int32_t hashCode() const;
michael@0 56 int32_t nextSetBit(int32_t script) const;
michael@0 57
michael@0 58 UnicodeString &displayScripts(UnicodeString &dest) const; // append script names to dest string.
michael@0 59 ScriptSet & parseScripts(const UnicodeString &scriptsString, UErrorCode &status); // Replaces ScriptSet contents.
michael@0 60
michael@0 61 private:
michael@0 62 uint32_t bits[6];
michael@0 63 };
michael@0 64
michael@0 65 U_NAMESPACE_END
michael@0 66
michael@0 67 U_CAPI UBool U_EXPORT2
michael@0 68 uhash_compareScriptSet(const UElement key1, const UElement key2);
michael@0 69
michael@0 70 U_CAPI int32_t U_EXPORT2
michael@0 71 uhash_hashScriptSet(const UElement key);
michael@0 72
michael@0 73 U_CAPI void U_EXPORT2
michael@0 74 uhash_deleteScriptSet(void *obj);
michael@0 75
michael@0 76 #endif // __SCRIPTSET_H__

mercurial