BibleTime
language.h
Go to the documentation of this file.
1/*********
2*
3* In the name of the Father, and of the Son, and of the Holy Spirit.
4*
5* This file is part of BibleTime's source code, https://bibletime.info/
6*
7* Copyright 1999-2025 by the BibleTime developers.
8* The BibleTime source code is licensed under the GNU General Public License
9* version 2.0.
10*
11**********/
12
13#pragma once
14
15#include <memory>
16#include <QString>
17#include <QStringList>
18
19
20class Language {
21
22public: // methods:
23
24 Language(Language &&) = delete;
25 Language(Language const &) = delete;
26 Language(QStringList abbrevs, QString englishName);
27
28 virtual ~Language();
29
30 Language & operator=(Language &&) = delete;
31 Language & operator=(Language const &) = delete;
32
33 /** \returns the first abbreviation of this language. */
34 QString const & abbrev() const { return m_abbrevs.first(); }
35
36 /** \returns the abbreviations of this language. */
37 QStringList const & abbrevs() const { return m_abbrevs; }
38
39 /** \returns the translated name of this language. */
40 virtual QString translatedName() const;
41
42 /** \returns the english name of this language. */
43 QString const & englishName() const noexcept { return m_englishName; }
44
45 /**
46 \param[in] abbrev the language abbreviation in BCP 47 format.
47 \returns a pointer to the language of the given abbreviation.
48 */
49 static std::shared_ptr<Language const> fromAbbrev(QString const & abbrev);
50
51private: // fields:
52
53 QStringList const m_abbrevs;
54 QString const m_englishName;
55
56}; /* class Language */
Language(Language &&)=delete
virtual ~Language()
Language(Language const &)=delete
QString const m_englishName
Definition language.h:54
QString const & abbrev() const
Definition language.h:34
virtual QString translatedName() const
Definition language.cpp:326
static std::shared_ptr< Language const > fromAbbrev(QString const &abbrev)
Definition language.cpp:329
QString const & englishName() const noexcept
Definition language.h:43
QStringList const & abbrevs() const
Definition language.h:37
QStringList const m_abbrevs
Definition language.h:53
Language & operator=(Language const &)=delete
Language & operator=(Language &&)=delete