Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / unotools / resmgr.hxx
blob142ec2de5b1f66c70dcf88eae8a59f539014f864
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_UNOTOOLS_RESMGR_HXX
20 #define INCLUDED_UNOTOOLS_RESMGR_HXX
22 #include <unotools/unotoolsdllapi.h>
23 #include <unotools/syslocale.hxx>
24 #include <rtl/ustring.hxx>
25 #include <string_view>
27 class LanguageTag;
29 typedef OUString (*ResHookProc)(const OUString& rStr);
31 struct UNOTOOLS_DLLPUBLIC TranslateId
33 const char* mpContext;
34 const char* mpId;
36 inline constexpr TranslateId()
37 : mpContext(nullptr), mpId(nullptr) {}
38 inline constexpr TranslateId(const char* pContext, const char* pId)
39 : mpContext(pContext), mpId(pId) {}
41 inline operator bool() const { return mpId != nullptr; }
43 bool operator==(const TranslateId& other) const;
44 inline bool operator!=(const TranslateId& other) const { return !operator==(other); }
47 struct UNOTOOLS_DLLPUBLIC TranslateNId
49 const char* mpContext;
50 const char* mpSingular;
51 const char* mpPlural;
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) {}
58 inline operator bool() const { return mpContext != nullptr; }
60 bool operator==(const TranslateNId& other) const;
61 inline bool operator!=(const TranslateNId& other) const { return !operator==(other); }
64 namespace Translate
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);
69 UNOTOOLS_DLLPUBLIC void SetReadStringHook( ResHookProc pProc );
70 UNOTOOLS_DLLPUBLIC ResHookProc GetReadStringHook();
71 UNOTOOLS_DLLPUBLIC OUString ExpandVariables(const OUString& rString);
74 #endif
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */