Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/i18npool/source/transliteration/transliteration_commonclass.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#include <transliteration_commonclass.hxx>
21
#include <cppuhelper/supportsservice.hxx>
22
23
using namespace ::com::sun::star::uno;
24
using namespace ::com::sun::star::i18n;
25
using namespace ::com::sun::star::lang;
26
27
namespace i18npool {
28
29
transliteration_commonclass::transliteration_commonclass()
30
2.09M
{
31
2.09M
    transliterationName = "";
32
2.09M
    implementationName = "";
33
2.09M
}
34
35
OUString SAL_CALL transliteration_commonclass::getName()
36
0
{
37
0
    return OUString::createFromAscii(transliterationName);
38
0
}
39
40
void SAL_CALL transliteration_commonclass::loadModule( TransliterationModules /*modName*/, const Locale& rLocale )
41
0
{
42
0
    aLocale = rLocale;
43
0
}
44
45
46
void SAL_CALL
47
transliteration_commonclass::loadModuleNew( const Sequence < TransliterationModulesNew >& /*modName*/, const Locale& /*rLocale*/ )
48
0
{
49
0
    throw RuntimeException();
50
0
}
51
52
53
void SAL_CALL
54
transliteration_commonclass::loadModuleByImplName( const OUString& /*implName*/, const Locale& /*rLocale*/ )
55
0
{
56
0
    throw RuntimeException();
57
0
}
58
59
void SAL_CALL
60
transliteration_commonclass::loadModulesByImplNames(const Sequence< OUString >& /*modNamelist*/, const Locale& /*rLocale*/)
61
0
{
62
0
    throw RuntimeException();
63
0
}
64
65
Sequence< OUString > SAL_CALL
66
transliteration_commonclass::getAvailableModules( const Locale& /*rLocale*/, sal_Int16 /*sType*/ )
67
0
{
68
0
    throw RuntimeException();
69
0
}
70
71
sal_Int32 SAL_CALL
72
transliteration_commonclass::compareSubstring(
73
        const OUString& str1, sal_Int32 off1, sal_Int32 len1,
74
        const OUString& str2, sal_Int32 off2, sal_Int32 len2)
75
0
{
76
0
    Sequence <sal_Int32> offset1(2*len1);
77
0
    Sequence <sal_Int32> offset2(2*len2);
78
79
0
    OUString in_str1 = transliterate(str1, off1, len1, offset1);
80
0
    OUString in_str2 = transliterate(str2, off2, len2, offset2);
81
0
    sal_Int32 strlen1 = in_str1.getLength();
82
0
    sal_Int32 strlen2 = in_str2.getLength();
83
0
    const sal_Unicode* unistr1 = in_str1.getStr();
84
0
    const sal_Unicode* unistr2 = in_str2.getStr();
85
86
0
    while (strlen1 && strlen2)
87
0
    {
88
0
        sal_Int32 ret = *unistr1 - *unistr2;
89
0
        if (ret)
90
0
            return ret;
91
92
0
        unistr1++;
93
0
        unistr2++;
94
0
        strlen1--;
95
0
        strlen2--;
96
0
    }
97
0
    return strlen1 - strlen2;
98
0
}
99
100
sal_Int32 SAL_CALL
101
transliteration_commonclass::compareString( const OUString& str1, const OUString& str2 )
102
0
{
103
0
    return compareSubstring(str1, 0, str1.getLength(), str2, 0, str2.getLength());
104
0
}
105
106
OUString SAL_CALL
107
transliteration_commonclass::transliterateString2String( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount )
108
134M
{
109
134M
    return transliterateImpl(inStr, startPos, nCount, nullptr);
110
134M
}
111
112
OUString SAL_CALL
113
transliteration_commonclass::transliterateChar2String( sal_Unicode inChar )
114
0
{
115
0
    return transliteration_commonclass::transliterateString2String(OUString(&inChar, 1), 0, 1);
116
0
}
117
118
OUString SAL_CALL transliteration_commonclass::getImplementationName()
119
0
{
120
0
    return OUString::createFromAscii(implementationName);
121
0
}
122
123
sal_Bool SAL_CALL transliteration_commonclass::supportsService(const OUString& rServiceName)
124
0
{
125
0
    return cppu::supportsService(this, rServiceName);
126
0
}
127
128
Sequence< OUString > SAL_CALL transliteration_commonclass::getSupportedServiceNames()
129
0
{
130
0
    return { u"com.sun.star.i18n.Transliteration.l10n"_ustr };
131
0
}
132
133
}
134
135
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */