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-2021 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 
20 class Language {
21 
22 public: // 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 
51 private: // fields:
52 
53  QStringList const m_abbrevs;
54  QString const m_englishName;
55 
56 }; /* class Language */
Language & operator=(Language &&)=delete
Language(Language &&)=delete
static std::shared_ptr< Language const > fromAbbrev(QString const &abbrev)
Definition: language.cpp:329
virtual ~Language()
Language(Language const &)=delete
QString const m_englishName
Definition: language.h:54
QString const & englishName() const noexcept
Definition: language.h:43
QString const & abbrev() const
Definition: language.h:34
virtual QString translatedName() const
Definition: language.cpp:326
QStringList const & abbrevs() const
Definition: language.h:37
Language & operator=(Language const &)=delete
QStringList const m_abbrevs
Definition: language.h:53