1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/scriptset.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,76 @@ 1.4 +/* 1.5 +********************************************************************** 1.6 +* Copyright (C) 2013, International Business Machines 1.7 +* Corporation and others. All Rights Reserved. 1.8 +********************************************************************** 1.9 +* 1.10 +* scriptset.h 1.11 +* 1.12 +* created on: 2013 Jan 7 1.13 +* created by: Andy Heninger 1.14 +*/ 1.15 + 1.16 +#ifndef __SCRIPTSET_H__ 1.17 +#define __SCRIPTSET_H__ 1.18 + 1.19 +#include "unicode/utypes.h" 1.20 +#include "unicode/uobject.h" 1.21 +#include "unicode/uscript.h" 1.22 + 1.23 +#include "uelement.h" 1.24 + 1.25 +U_NAMESPACE_BEGIN 1.26 + 1.27 +//------------------------------------------------------------------------------- 1.28 +// 1.29 +// ScriptSet - A bit set representing a set of scripts. 1.30 +// 1.31 +// This class was originally used exclusively with script sets appearing 1.32 +// as part of the spoof check whole script confusable binary data. Its 1.33 +// use has since become more general, but the continued use to wrap 1.34 +// prebuilt binary data does constrain the design. 1.35 +// 1.36 +//------------------------------------------------------------------------------- 1.37 +class U_I18N_API ScriptSet: public UMemory { 1.38 + public: 1.39 + ScriptSet(); 1.40 + ScriptSet(const ScriptSet &other); 1.41 + ~ScriptSet(); 1.42 + 1.43 + UBool operator == (const ScriptSet &other) const; 1.44 + ScriptSet & operator = (const ScriptSet &other); 1.45 + 1.46 + UBool test(UScriptCode script, UErrorCode &status) const; 1.47 + ScriptSet &Union(const ScriptSet &other); 1.48 + ScriptSet &set(UScriptCode script, UErrorCode &status); 1.49 + ScriptSet &reset(UScriptCode script, UErrorCode &status); 1.50 + ScriptSet &intersect(const ScriptSet &other); 1.51 + ScriptSet &intersect(UScriptCode script, UErrorCode &status); 1.52 + UBool intersects(const ScriptSet &other) const; // Sets contain at least one script in commmon. 1.53 + UBool contains(const ScriptSet &other) const; // All set bits in other are also set in this. 1.54 + 1.55 + ScriptSet &setAll(); 1.56 + ScriptSet &resetAll(); 1.57 + int32_t countMembers() const; 1.58 + int32_t hashCode() const; 1.59 + int32_t nextSetBit(int32_t script) const; 1.60 + 1.61 + UnicodeString &displayScripts(UnicodeString &dest) const; // append script names to dest string. 1.62 + ScriptSet & parseScripts(const UnicodeString &scriptsString, UErrorCode &status); // Replaces ScriptSet contents. 1.63 + 1.64 + private: 1.65 + uint32_t bits[6]; 1.66 +}; 1.67 + 1.68 +U_NAMESPACE_END 1.69 + 1.70 +U_CAPI UBool U_EXPORT2 1.71 +uhash_compareScriptSet(const UElement key1, const UElement key2); 1.72 + 1.73 +U_CAPI int32_t U_EXPORT2 1.74 +uhash_hashScriptSet(const UElement key); 1.75 + 1.76 +U_CAPI void U_EXPORT2 1.77 +uhash_deleteScriptSet(void *obj); 1.78 + 1.79 +#endif // __SCRIPTSET_H__