]>
Commit | Line | Data |
---|---|---|
51004dcb A |
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 | */ | |
12 | ||
13 | #ifndef __SCRIPTSET_H__ | |
14 | #define __SCRIPTSET_H__ | |
15 | ||
16 | #include "unicode/utypes.h" | |
17 | #include "unicode/uobject.h" | |
18 | #include "unicode/uscript.h" | |
19 | ||
20 | #include "uelement.h" | |
21 | ||
22 | U_NAMESPACE_BEGIN | |
23 | ||
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(); | |
39 | ||
40 | UBool operator == (const ScriptSet &other) const; | |
41 | ScriptSet & operator = (const ScriptSet &other); | |
42 | ||
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. | |
51 | ||
52 | ScriptSet &setAll(); | |
53 | ScriptSet &resetAll(); | |
54 | int32_t countMembers() const; | |
55 | int32_t hashCode() const; | |
56 | int32_t nextSetBit(int32_t script) const; | |
57 | ||
58 | UnicodeString &displayScripts(UnicodeString &dest) const; // append script names to dest string. | |
59 | ScriptSet & parseScripts(const UnicodeString &scriptsString, UErrorCode &status); // Replaces ScriptSet contents. | |
60 | ||
61 | private: | |
62 | uint32_t bits[6]; | |
63 | }; | |
64 | ||
65 | U_NAMESPACE_END | |
66 | ||
67 | U_CAPI UBool U_EXPORT2 | |
68 | uhash_compareScriptSet(const UElement key1, const UElement key2); | |
69 | ||
70 | U_CAPI int32_t U_EXPORT2 | |
71 | uhash_hashScriptSet(const UElement key); | |
72 | ||
73 | U_CAPI void U_EXPORT2 | |
74 | uhash_deleteScriptSet(void *obj); | |
75 | ||
76 | #endif // __SCRIPTSET_H__ |