From 33efbfda45a96f540f976abf3dc00ab256872af4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 10 May 2016 15:04:39 +0200 Subject: convert MappingType to scoped enum Change-Id: I1f00e1fbdb9213d0c2f30da116684b77842282f5 Reviewed-on: https://gerrit.libreoffice.org/24851 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/i18nutil/casefolding.hxx | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'include/i18nutil') diff --git a/include/i18nutil/casefolding.hxx b/include/i18nutil/casefolding.hxx index 091a7109f1f9..5ddb208ea566 100644 --- a/include/i18nutil/casefolding.hxx +++ b/include/i18nutil/casefolding.hxx @@ -24,23 +24,25 @@ #include #include #include +#include -namespace com { namespace sun { namespace star { namespace i18n { - -#define MappingTypeLowerToUpper (1 << 0) // Upper to Lower mapping -#define MappingTypeUpperToLower (1 << 1) // Lower to Upper mapping -#define MappingTypeToUpper (1 << 2) // to Upper mapping -#define MappingTypeToLower (1 << 3) // to Lower mapping -#define MappingTypeToTitle (1 << 4) // to Title mapping -#define MappingTypeSimpleFolding (1 << 5) // Simple Case Folding -#define MappingTypeFullFolding (1 << 6) // Full Case Folding -#define MappingTypeMask (MappingTypeLowerToUpper|MappingTypeUpperToLower|\ - MappingTypeToUpper|MappingTypeToLower|MappingTypeToTitle|\ - MappingTypeSimpleFolding|MappingTypeFullFolding) - -#define ValueTypeNotValue (1 << 7) // Value field is an address +enum class MappingType { + NONE = 0x00, + LowerToUpper = 0x01, // Upper to Lower mapping + UpperToLower = 0x02, // Lower to Upper mapping + ToUpper = 0x04, // to Upper mapping + ToLower = 0x08, // to Lower mapping + ToTitle = 0x10, // to Title mapping + SimpleFolding = 0x20, // Simple Case Folding + FullFolding = 0x40, // Full Case Folding + CasedLetterMask = LowerToUpper | UpperToLower | ToUpper | ToLower | ToTitle | SimpleFolding | FullFolding, // for final sigmar + NotValue = 0x80, // Value field is an address +}; +namespace o3tl { + template<> struct typed_flags : is_typed_flags {}; +} -#define CasedLetter (MappingTypeMask) // for final sigmar +namespace com { namespace sun { namespace star { namespace i18n { struct Value { @@ -70,9 +72,9 @@ struct MappingElement class I18NUTIL_DLLPUBLIC casefolding { public: - static Mapping& getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale& aLocale, sal_uInt8 nMappingType) throw (css::uno::RuntimeException); - static Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale& aLocale, sal_uInt8 nMappingType) throw (css::uno::RuntimeException); - static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, css::lang::Locale& aLocale,sal_uInt8 nMappingtype, TransliterationModules moduleLoaded) throw (css::uno::RuntimeException); + static Mapping& getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale& aLocale, MappingType nMappingType) throw (css::uno::RuntimeException); + static Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale& aLocale, MappingType nMappingType) throw (css::uno::RuntimeException); + static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, css::lang::Locale& aLocale, MappingType nMappingtype, TransliterationModules moduleLoaded) throw (css::uno::RuntimeException); }; -- cgit