1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/CountryCode.h
12 #ifndef ZYPP_COUNTRYCODE_H
13 #define ZYPP_COUNTRYCODE_H
18 #include "zypp/IdStringType.h"
20 ///////////////////////////////////////////////////////////////////
23 ///////////////////////////////////////////////////////////////////
24 /// \class CountryCode
25 /// \brief Country codes (iso3166-1-alpha-2).
27 /// In fact the class will not prevent to use a non iso country code.
28 /// Just a warning will appear in the log.
29 ///////////////////////////////////////////////////////////////////
30 class CountryCode : public IdStringType<CountryCode>
33 /** Default Ctor: \ref noCode */
36 /** Ctor from string. */
37 explicit CountryCode( IdString str_r );
39 /** Ctor from string. */
40 explicit CountryCode( const std::string & str_r );
42 /** Ctor from string. */
43 explicit CountryCode( const char * str_r );
50 /** \name CountryCode constants. */
53 static const CountryCode noCode;
57 /** Return the country code asString. */
58 std::string code() const
59 { return std::string(_str); }
61 /** Return the translated country name; if unknown the country code. */
62 std::string name() const;
65 friend class IdStringType<CountryCode>;
69 ///////////////////////////////////////////////////////////////////
71 ///////////////////////////////////////////////////////////////////
73 ZYPP_DEFINE_ID_HASHABLE( ::zypp::CountryCode );
75 #endif // ZYPP_COUNTRYCODE_H