1 | /* $Id: QMTranslator.h 92068 2021-10-26 08:35:27Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox API translation handling class
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2014-2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef MAIN_INCLUDED_QMTranslator_h
|
---|
19 | #define MAIN_INCLUDED_QMTranslator_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | class QMTranslator_Impl;
|
---|
25 |
|
---|
26 | class QMTranslator
|
---|
27 | {
|
---|
28 | public:
|
---|
29 | QMTranslator();
|
---|
30 | virtual ~QMTranslator();
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Gets translation from loaded QM file
|
---|
34 | *
|
---|
35 | * @param pszContext QM context to look for translation
|
---|
36 | * @param pszSource Source string in one-byte encoding
|
---|
37 | * @param ppszSafeSource Where to return pointer to a safe copy of @a
|
---|
38 | * pszSource for the purpose of reverse translation.
|
---|
39 | * Will be set to NULL if @a pszSource is returned.
|
---|
40 | * @param pszDisamb Disambiguationg comment, empty by default
|
---|
41 | * @param aNum Plural form indicator.
|
---|
42 | *
|
---|
43 | * @returns Pointer to a translation (UTF-8 encoding), source string on failure.
|
---|
44 | */
|
---|
45 | const char *translate(const char *pszContext, const char *pszSource, const char **ppszSafeSource,
|
---|
46 | const char *pszDisamb = NULL, const size_t aNum = ~(size_t)0) const RT_NOEXCEPT;
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Loads and parses QM file
|
---|
50 | *
|
---|
51 | * @param pszFilename The name of the file to load
|
---|
52 | * @param hStrCache The string cache to use for storing strings.
|
---|
53 | *
|
---|
54 | * @returns VBox status code.
|
---|
55 | */
|
---|
56 | int load(const char *pszFilename, RTSTRCACHE hStrCache) RT_NOEXCEPT;
|
---|
57 |
|
---|
58 | private:
|
---|
59 | /** QMTranslator implementation.
|
---|
60 | * To separate all the code from the interface */
|
---|
61 | QMTranslator_Impl *m_impl;
|
---|
62 |
|
---|
63 | /* If copying is required, please define the following operators */
|
---|
64 | void operator=(QMTranslator &);
|
---|
65 | QMTranslator(const QMTranslator &);
|
---|
66 | };
|
---|
67 |
|
---|
68 | #endif /* !MAIN_INCLUDED_QMTranslator_h */
|
---|
69 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|