LibreOffice Module unotools (master) 1
intlwrapper.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_UNOTOOLS_INTLWRAPPER_HXX
21#define INCLUDED_UNOTOOLS_INTLWRAPPER_HXX
22
25#include <com/sun/star/uno/Reference.h>
26
28#include <memory>
29#include <optional>
30
31namespace com::sun::star::uno { class XComponentContext; }
32
34
52{
53private:
55 css::uno::Reference< css::uno::XComponentContext > m_xContext;
56
57 std::unique_ptr<LocaleDataWrapper> pLocaleData;
58 std::optional<CollatorWrapper> moCollator;
59 std::optional<CollatorWrapper> moCaseCollator;
60
61 void ImplNewLocaleData() const;
62 void ImplNewCollator( bool bCaseSensitive ) const;
63
64public:
65 IntlWrapper(LanguageTag aLanguageTag);
67
69 {
70 if ( !pLocaleData )
71 ImplNewLocaleData();
72 return pLocaleData.get();
73 }
76 {
77 if ( !moCollator )
78 ImplNewCollator( false );
79 return &*moCollator;
80 }
83 {
84 if ( !moCaseCollator )
85 ImplNewCollator( true );
86 return &*moCaseCollator;
87 }
88};
89
90#endif // INCLUDED_UNOTOOLS_INTLWRAPPER_HXX
91
92/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
A wrapper of I18N wrappers.
Definition: intlwrapper.hxx:52
const LocaleDataWrapper * getLocaleData() const
Definition: intlwrapper.hxx:68
std::optional< CollatorWrapper > moCollator
Definition: intlwrapper.hxx:58
std::unique_ptr< LocaleDataWrapper > pLocaleData
Definition: intlwrapper.hxx:57
LanguageTag maLanguageTag
Definition: intlwrapper.hxx:54
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: intlwrapper.hxx:55
const CollatorWrapper * getCollator() const
case insensitive collator, simple IGNORE_CASE
Definition: intlwrapper.hxx:75
const CollatorWrapper * getCaseCollator() const
case sensitive collator
Definition: intlwrapper.hxx:82
std::optional< CollatorWrapper > moCaseCollator
Definition: intlwrapper.hxx:59
This class can be accessed without locking because we load all of the data in the constructor.
#define UNOTOOLS_DLLPUBLIC