libzypp: zypp/LanguageCode.h Source File

libzypp 17.38.11

LanguageCode.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_LANGUAGECODE_H
13#define ZYPP_LANGUAGECODE_H
14
15#include <iosfwd>
16#include <string>
17
18#include <zypp/IdStringType.h>
19
21namespace zypp
22{
30 class ZYPP_API LanguageCode : public IdStringType<LanguageCode>
31 {
32 public:
34 LanguageCode();
35
37 explicit LanguageCode( IdString str_r );
38
40 explicit LanguageCode( const std::string & str_r );
41
43 explicit LanguageCode( const char * str_r );
44
46 ~LanguageCode();
47
48 public:
51
52 static const LanguageCode noCode;
54 static const LanguageCode enCode;
56
57 public:
59 std::string code() const
60 { return std::string(_str); }
61
63 std::string name() const;
64
65 private:
66 friend class IdStringType<LanguageCode>;
67 IdString _str;
68 };
69} // namespace zypp
71
72 ZYPP_DEFINE_ID_HASHABLE( ::zypp::LanguageCode );
73
74#endif // ZYPP_LANGUAGECODE_H
ZYPP_DEFINE_ID_HASHABLE
#define ZYPP_DEFINE_ID_HASHABLE(C)
Define hash function for id based classes.
Definition Hash.h:26
IdStringType.h
zypp::IdString
Access to the sat-pools string space.
Definition IdString.h:55
zypp::LanguageCode
Language codes (iso639_2/iso639_1).
Definition LanguageCode.h:31
zypp::LanguageCode::code
std::string code() const
Return the language code asString.
Definition LanguageCode.h:59
zypp::LanguageCode::name
std::string name() const
Return the translated language name; if unknown the language code.
Definition LanguageCode.cc:140
zypp::LanguageCode::noCode
static const LanguageCode noCode
Empty code.
Definition LanguageCode.h:52
zypp::LanguageCode::enCode
static const LanguageCode enCode
Last resort "en".
Definition LanguageCode.h:54
zypp::LanguageCode::LanguageCode
LanguageCode()
Default Ctor: noCode.
Definition LanguageCode.cc:121
zypp::LanguageCode::_str
IdString _str
Definition LanguageCode.h:67
zypp::IdStringType< LanguageCode >::IdStringType
IdStringType()=default
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::ZYPP_API
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Definition Arch.h:173