summaryrefslogtreecommitdiff
path: root/include/i18nutil
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-10 15:04:39 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-11 06:55:08 +0000
commit33efbfda45a96f540f976abf3dc00ab256872af4 (patch)
treea19925f0928a93474e47b6740470d6ed79c00507 /include/i18nutil
parent265068d65b39688b8a4756dfbcd46453dd1f9b70 (diff)
convert MappingType to scoped enum
Change-Id: I1f00e1fbdb9213d0c2f30da116684b77842282f5 Reviewed-on: https://gerrit.libreoffice.org/24851 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'include/i18nutil')
-rw-r--r--include/i18nutil/casefolding.hxx38
1 files changed, 20 insertions, 18 deletions
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 <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <i18nutil/i18nutildllapi.h>
+#include <o3tl/typed_flags_set.hxx>
-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<MappingType> : is_typed_flags<MappingType, 0xff> {};
+}
-#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);
};