summaryrefslogtreecommitdiff
path: root/i18npool
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 /i18npool
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 'i18npool')
-rw-r--r--i18npool/inc/transliteration_body.hxx4
-rw-r--r--i18npool/source/characterclassification/cclass_unicode.cxx6
-rw-r--r--i18npool/source/transliteration/transliteration_body.cxx38
-rw-r--r--i18npool/source/transliteration/transliteration_caseignore.cxx2
4 files changed, 25 insertions, 25 deletions
diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx
index 01757b95f4dd..55616997cdeb 100644
--- a/i18npool/inc/transliteration_body.hxx
+++ b/i18npool/inc/transliteration_body.hxx
@@ -56,7 +56,7 @@ public:
const OUString& str2 ) throw(css::uno::RuntimeException, std::exception) override;
protected:
- sal_uInt8 nMappingType;
+ MappingType nMappingType;
};
class Transliteration_u2l : public Transliteration_body
@@ -75,7 +75,7 @@ class Transliteration_casemapping : public Transliteration_body
{
public:
Transliteration_casemapping();
- void SAL_CALL setMappingType(const sal_uInt8 rMappingType, const css::lang::Locale& rLocale );
+ void SAL_CALL setMappingType(const MappingType rMappingType, const css::lang::Locale& rLocale );
};
class Transliteration_togglecase : public Transliteration_body
diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx b/i18npool/source/characterclassification/cclass_unicode.cxx
index e9e9612f65f7..c4a8babb0a6f 100644
--- a/i18npool/source/characterclassification/cclass_unicode.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode.cxx
@@ -63,7 +63,7 @@ cclass_Unicode::toUpper( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount,
if (nCount + nPos > len)
nCount = len - nPos;
- trans->setMappingType(MappingTypeToUpper, rLocale);
+ trans->setMappingType(MappingType::ToUpper, rLocale);
return trans->transliterateString2String(Text, nPos, nCount);
}
@@ -75,7 +75,7 @@ cclass_Unicode::toLower( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount,
if (nCount + nPos > len)
nCount = len - nPos;
- trans->setMappingType(MappingTypeToLower, rLocale);
+ trans->setMappingType(MappingType::ToLower, rLocale);
return trans->transliterateString2String(Text, nPos, nCount);
}
@@ -89,7 +89,7 @@ cclass_Unicode::toTitle( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount,
if (nCount + nPos > len)
nCount = len - nPos;
- trans->setMappingType(MappingTypeToTitle, rLocale);
+ trans->setMappingType(MappingType::ToTitle, rLocale);
rtl_uString* pStr = rtl_uString_alloc(nCount);
sal_Unicode* out = pStr->buffer;
Reference< BreakIteratorImpl > xBrk(new BreakIteratorImpl(m_xContext));
diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx
index 982c80c5ac02..0470ed4ac99b 100644
--- a/i18npool/source/transliteration/transliteration_body.cxx
+++ b/i18npool/source/transliteration/transliteration_body.cxx
@@ -40,7 +40,7 @@ namespace com { namespace sun { namespace star { namespace i18n {
Transliteration_body::Transliteration_body()
{
- nMappingType = 0;
+ nMappingType = MappingType::NONE;
transliterationName = "Transliteration_body";
implementationName = "com.sun.star.i18n.Transliteration.Transliteration_body";
}
@@ -68,22 +68,22 @@ Transliteration_body::transliterateRange( const OUString& str1, const OUString&
return ostr;
}
-static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Unicode cChar )
+static MappingType lcl_getMappingTypeForToggleCase( MappingType nMappingType, sal_Unicode cChar )
{
- sal_uInt8 nRes = nMappingType;
+ MappingType nRes = nMappingType;
// take care of TOGGLE_CASE transliteration:
// nMappingType should not be a combination of flags, thuse we decide now
// which one to use.
- if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ if (nMappingType == (MappingType::LowerToUpper | MappingType::UpperToLower))
{
const sal_Int16 nType = unicode::getUnicodeType( cChar );
if (nType & 0x02 /* lower case*/)
- nRes = MappingTypeLowerToUpper;
+ nRes = MappingType::LowerToUpper;
else
{
// should also work properly for non-upper characters like white spaces, numbers, ...
- nRes = MappingTypeUpperToLower;
+ nRes = MappingType::UpperToLower;
}
}
@@ -106,8 +106,8 @@ Transliteration_body::transliterate(
for (i = 0; i < nCount; i++)
{
// take care of TOGGLE_CASE transliteration:
- sal_uInt8 nTmpMappingType = nMappingType;
- if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ MappingType nTmpMappingType = nMappingType;
+ if (nMappingType == (MappingType::LowerToUpper | MappingType::UpperToLower))
nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] );
const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType );
@@ -124,8 +124,8 @@ Transliteration_body::transliterate(
for (i = 0; i < nCount; i++)
{
// take care of TOGGLE_CASE transliteration:
- sal_uInt8 nTmpMappingType = nMappingType;
- if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ MappingType nTmpMappingType = nMappingType;
+ if (nMappingType == (MappingType::LowerToUpper | MappingType::UpperToLower))
nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] );
const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType );
@@ -164,8 +164,8 @@ Transliteration_body::transliterate(
for ( sal_Int32 i = 0; i < nCount; i++)
{
// take care of TOGGLE_CASE transliteration:
- sal_uInt8 nTmpMappingType = nMappingType;
- if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower))
+ MappingType nTmpMappingType = nMappingType;
+ if (nMappingType == (MappingType::LowerToUpper | MappingType::UpperToLower))
nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] );
const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType );
@@ -213,13 +213,13 @@ Transliteration_body::folding( const OUString& inStr, sal_Int32 startPos, sal_In
Transliteration_casemapping::Transliteration_casemapping()
{
- nMappingType = 0;
+ nMappingType = MappingType::NONE;
transliterationName = "casemapping(generic)";
implementationName = "com.sun.star.i18n.Transliteration.Transliteration_casemapping";
}
void SAL_CALL
-Transliteration_casemapping::setMappingType( const sal_uInt8 rMappingType, const Locale& rLocale )
+Transliteration_casemapping::setMappingType( const MappingType rMappingType, const Locale& rLocale )
{
nMappingType = rMappingType;
aLocale = rLocale;
@@ -227,14 +227,14 @@ Transliteration_casemapping::setMappingType( const sal_uInt8 rMappingType, const
Transliteration_u2l::Transliteration_u2l()
{
- nMappingType = MappingTypeUpperToLower;
+ nMappingType = MappingType::UpperToLower;
transliterationName = "upper_to_lower(generic)";
implementationName = "com.sun.star.i18n.Transliteration.Transliteration_u2l";
}
Transliteration_l2u::Transliteration_l2u()
{
- nMappingType = MappingTypeLowerToUpper;
+ nMappingType = MappingType::LowerToUpper;
transliterationName = "lower_to_upper(generic)";
implementationName = "com.sun.star.i18n.Transliteration.Transliteration_l2u";
}
@@ -245,14 +245,14 @@ Transliteration_togglecase::Transliteration_togglecase()
// but we take care of that problem in Transliteration_body::transliterate above
// before that value is used. There we will decide which of both is to be used on
// a per character basis.
- nMappingType = MappingTypeLowerToUpper | MappingTypeUpperToLower;
+ nMappingType = MappingType::LowerToUpper | MappingType::UpperToLower;
transliterationName = "toggle(generic)";
implementationName = "com.sun.star.i18n.Transliteration.Transliteration_togglecase";
}
Transliteration_titlecase::Transliteration_titlecase()
{
- nMappingType = MappingTypeToTitle;
+ nMappingType = MappingType::ToTitle;
transliterationName = "title(generic)";
implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase";
}
@@ -316,7 +316,7 @@ OUString SAL_CALL Transliteration_titlecase::transliterate(
Transliteration_sentencecase::Transliteration_sentencecase()
{
- nMappingType = MappingTypeToTitle; // though only to be applied to the first word...
+ nMappingType = MappingType::ToTitle; // though only to be applied to the first word...
transliterationName = "sentence(generic)";
implementationName = "com.sun.star.i18n.Transliteration.Transliteration_sentencecase";
}
diff --git a/i18npool/source/transliteration/transliteration_caseignore.cxx b/i18npool/source/transliteration/transliteration_caseignore.cxx
index 52f0cd2f21e4..e01eb1f2a71e 100644
--- a/i18npool/source/transliteration/transliteration_caseignore.cxx
+++ b/i18npool/source/transliteration/transliteration_caseignore.cxx
@@ -31,7 +31,7 @@ namespace com { namespace sun { namespace star { namespace i18n {
Transliteration_caseignore::Transliteration_caseignore()
{
- nMappingType = MappingTypeFullFolding;
+ nMappingType = MappingType::FullFolding;
moduleLoaded = (TransliterationModules)0;
transliterationName = "case ignore (generic)";
implementationName = "com.sun.star.i18n.Transliteration.Transliteration_caseignore";