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