LibreOffice Module unotools (master) 1
resmgr.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#ifndef INCLUDED_UNOTOOLS_RESMGR_HXX
20#define INCLUDED_UNOTOOLS_RESMGR_HXX
21
24#include <rtl/ustring.hxx>
25#include <string_view>
26
27class LanguageTag;
28
29typedef OUString (*ResHookProc)(const OUString& rStr);
30
32{
33 const char* mpContext;
34 const char* mpId;
35
36 inline constexpr TranslateId()
37 : mpContext(nullptr), mpId(nullptr) {}
38 inline constexpr TranslateId(const char* pContext, const char* pId)
39 : mpContext(pContext), mpId(pId) {}
40
41 inline operator bool() const { return mpId != nullptr; }
42
43 bool operator==(const TranslateId& other) const;
44 inline bool operator!=(const TranslateId& other) const { return !operator==(other); }
45};
46
48{
49 const char* mpContext;
50 const char* mpSingular;
51 const char* mpPlural;
52
53 inline TranslateNId()
54 : mpContext(nullptr), mpSingular(nullptr), mpPlural(nullptr) {}
55 inline TranslateNId(const char* pContext, const char* pSingular, const char* pPlural)
56 : mpContext(pContext), mpSingular(pSingular), mpPlural(pPlural) {}
57
58 inline operator bool() const { return mpContext != nullptr; }
59
60 bool operator==(const TranslateNId& other) const;
61 inline bool operator!=(const TranslateNId& other) const { return !operator==(other); }
62};
63
64namespace Translate
65{
66 UNOTOOLS_DLLPUBLIC std::locale Create(std::string_view aPrefixName, const LanguageTag& rLocale = SvtSysLocale().GetUILanguageTag());
67 UNOTOOLS_DLLPUBLIC OUString get(TranslateId sContextAndId, const std::locale &loc);
68 UNOTOOLS_DLLPUBLIC OUString nget(TranslateNId aContextSingularPlural, int n, const std::locale &loc);
71 UNOTOOLS_DLLPUBLIC OUString ExpandVariables(const OUString& rString);
72}
73
74#endif
75
76/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvtSysLocale provides a refcounted single instance of an application wide LocaleDataWrapper and <type...
Definition: syslocale.hxx:44
OUString nget(TranslateNId aContextSingularPlural, int n, const std::locale &loc)
Definition: resmgr.cxx:236
ResHookProc GetReadStringHook()
Definition: resmgr.cxx:273
std::locale Create(std::string_view aPrefixName, const LanguageTag &rLocale)
Definition: resmgr.cxx:125
OUString ExpandVariables(const OUString &rString)
Definition: resmgr.cxx:261
OUString get(TranslateId sContextAndId, const std::locale &loc)
Definition: resmgr.cxx:211
void SetReadStringHook(ResHookProc pProc)
Definition: resmgr.cxx:268
bool operator==(const SharedUNOComponent< INTERFACE, COMPONENT > &_rLHS, const css::uno::Reference< INTERFACE > &_rRHS)
OUString(* ResHookProc)(const OUString &rStr)
Definition: resmgr.hxx:29
ParserContextSharedPtr mpContext
bool operator!=(const TranslateId &other) const
Definition: resmgr.hxx:44
const char * mpId
Definition: resmgr.hxx:34
const char * mpContext
Definition: resmgr.hxx:33
constexpr TranslateId()
Definition: resmgr.hxx:36
constexpr TranslateId(const char *pContext, const char *pId)
Definition: resmgr.hxx:38
const char * mpPlural
Definition: resmgr.hxx:51
TranslateNId(const char *pContext, const char *pSingular, const char *pPlural)
Definition: resmgr.hxx:55
TranslateNId()
Definition: resmgr.hxx:53
const char * mpSingular
Definition: resmgr.hxx:50
bool operator!=(const TranslateNId &other) const
Definition: resmgr.hxx:61
const char * mpContext
Definition: resmgr.hxx:49
#define UNOTOOLS_DLLPUBLIC