nss: upgrade to release 3.73
[LibreOffice.git] / include / i18nutil / searchopt.hxx
blob56bfaa3f87a648f2dfe56ac193bdc5cabac19dd8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_I18NUTIL_SEARCHOPT_HXX
20 #define INCLUDED_I18NUTIL_SEARCHOPT_HXX
22 #include <sal/types.h>
23 #include <com/sun/star/lang/Locale.hpp>
24 #include <com/sun/star/util/SearchAlgorithms.hpp>
25 #include <com/sun/star/util/SearchOptions2.hpp>
26 #include <i18nutil/transliteration.hxx>
28 namespace i18nutil
31 /**
32 * This is a wrapper around com::sun::star::util::SearchOptions
33 * but using the more type-safe TransliterationFlags enum.
35 struct SAL_WARN_UNUSED SearchOptions {
36 css::util::SearchAlgorithms algorithmType;
37 sal_Int32 searchFlag;
38 OUString searchString;
39 OUString replaceString;
40 css::lang::Locale Locale;
41 sal_Int32 changedChars;
42 sal_Int32 deletedChars;
43 sal_Int32 insertedChars;
44 TransliterationFlags transliterateFlags;
46 SearchOptions& operator=(css::util::SearchOptions const & other)
48 algorithmType = other.algorithmType;
49 searchFlag = other.searchFlag;
50 searchString = other.searchString;
51 replaceString = other.replaceString;
52 Locale = other.Locale;
53 changedChars = other.changedChars;
54 deletedChars = other.deletedChars;
55 insertedChars = other.insertedChars;
56 transliterateFlags = static_cast<TransliterationFlags>(other.transliterateFlags);
57 return *this;
60 SearchOptions()
61 : algorithmType(::css::util::SearchAlgorithms_ABSOLUTE)
62 , searchFlag(0)
63 , searchString()
64 , replaceString()
65 , Locale()
66 , changedChars(0)
67 , deletedChars(0)
68 , insertedChars(0)
69 , transliterateFlags(TransliterationFlags::NONE)
73 SearchOptions(const css::util::SearchAlgorithms& algorithmType_, const sal_Int32 searchFlag_,
74 const OUString& searchString_, const OUString& replaceString_,
75 const css::lang::Locale& Locale_,
76 const sal_Int32 changedChars_, const sal_Int32 deletedChars_, const sal_Int32 insertedChars_,
77 const TransliterationFlags& transliterateFlags_)
78 : algorithmType(algorithmType_)
79 , searchFlag(searchFlag_)
80 , searchString(searchString_)
81 , replaceString(replaceString_)
82 , Locale(Locale_)
83 , changedChars(changedChars_)
84 , deletedChars(deletedChars_)
85 , insertedChars(insertedChars_)
86 , transliterateFlags(transliterateFlags_)
91 /**
92 * This is a wrapper around com::sun::star::util::SearchOptions and SearchOptions2,
93 * but using the more type-safe TransliterationFlags enum.
95 struct SAL_WARN_UNUSED SearchOptions2 : public SearchOptions {
97 sal_Int16 AlgorithmType2;
98 sal_Int32 WildcardEscapeCharacter;
100 SearchOptions2& operator=(css::util::SearchOptions2 const & other)
102 SearchOptions::operator=(other);
103 AlgorithmType2 = other.AlgorithmType2;
104 WildcardEscapeCharacter = other.WildcardEscapeCharacter;
105 return *this;
109 css::util::SearchOptions2 toUnoSearchOptions2() const
111 return css::util::SearchOptions2(algorithmType, searchFlag,
112 searchString, replaceString,
113 Locale,
114 changedChars, deletedChars, insertedChars,
115 static_cast<sal_Int32>(transliterateFlags),
116 AlgorithmType2, WildcardEscapeCharacter);
119 SearchOptions2()
120 : SearchOptions()
121 , AlgorithmType2(0)
122 , WildcardEscapeCharacter(0)
125 SearchOptions2(const css::util::SearchAlgorithms& algorithmType_, const sal_Int32 searchFlag_,
126 const OUString& searchString_, const OUString& replaceString_,
127 const css::lang::Locale& Locale_,
128 const sal_Int32 changedChars_, const sal_Int32 deletedChars_, const sal_Int32 insertedChars_,
129 const TransliterationFlags& transliterateFlags_,
130 const sal_Int16 AlgorithmType2_, const sal_Int32 WildcardEscapeCharacter_)
131 : SearchOptions(algorithmType_, searchFlag_, searchString_, replaceString_, Locale_, changedChars_, deletedChars_, insertedChars_, transliterateFlags_)
132 , AlgorithmType2(AlgorithmType2_)
133 , WildcardEscapeCharacter(WildcardEscapeCharacter_)
137 }; // namespace
139 #endif
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */