20#include <com/sun/star/i18n/TransliterationType.hpp>
32 const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 )
38 OUString s1 =
folding( str1, pos1, nCount1, offset1);
39 OUString s2 =
folding( str2, pos2, nCount2, offset2);
43 sal_Int32
length = std::min(s1.getLength(), s2.getLength());
46 for ( nmatch = 0; nmatch <
length; nmatch++)
51 nMatch1 = offset1[ nmatch - 1 ] + 1;
52 nMatch2 = offset2[ nmatch - 1 ] + 1;
59 return (nmatch == s1.getLength()) && (nmatch == s2.getLength());
66 if (str1.isEmpty() || str2.isEmpty())
69 return { str1.copy(0, 1), str2.copy(0, 1) };
77 return TransliterationType::IGNORE;
91 XTransliteration& t1, XTransliteration& t2 )
93 if (str1.isEmpty() || str2.isEmpty())
97 OUString s11 = t1.transliterate( str1, 0, 1, offset );
98 OUString s12 = t1.transliterate( str2, 0, 1, offset );
99 OUString s21 = t2.transliterate( str1, 0, 1, offset );
100 OUString s22 = t2.transliterate( str2, 0, 1, offset );
102 if ( (s11 == s21) && (s12 == s22) ) {
105 return { s11, s12, s21, s22 };
114 rtl_uString * newStr = rtl_uString_alloc(
nCount);
116 const sal_Unicode * src = inStr.getStr() + startPos;
119 sal_Int32 *
p =
nullptr;
122 pOffset->realloc(
nCount );
123 p = pOffset->getArray();
133 currentChar = *src ++;
136 for (
m =
map;
m->replaceChar;
m++) {
137 if (previousChar ==
m->previousChar && currentChar ==
m->currentChar ) {
144 *dst++ =
m->replaceChar;
146 *dst++ = currentChar;
147 previousChar = *src++;
153 if (!
m->replaceChar) {
156 *dst ++ = previousChar;
157 previousChar = currentChar;
164 *dst ++ = previousChar;
170 c =
func ?
func( c) : (*table)[ c ];
180 newStr->length = sal_Int32(dst - newStr->buffer);
182 pOffset->realloc(newStr->length);
185 return OUString(newStr, SAL_NO_ACQUIRE);
191 return func ?
func( inChar) :
table ? (*table)[ inChar ] : inChar;
OUString transliterateImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > *pOffset) override
css::uno::Sequence< OUString > SAL_CALL transliterateRange(const OUString &str1, const OUString &str2) override
virtual sal_Unicode SAL_CALL transliterateChar2Char(sal_Unicode inChar) override
sal_Bool SAL_CALL equals(const OUString &str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32 &nMatch1, const OUString &str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32 &nMatch2) override
virtual OUString foldingImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > *pOffset) override
sal_Int16 SAL_CALL getType() override
i18nutil::oneToOneMapping * table
virtual OUString SAL_CALL folding(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > &offset) override final
Constant values shared between i18npool and, for example, the number formatter.