/usr/include/x86_64-linux-gnu/zypp/Locale.h is in libzypp-dev 14.29.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | /*---------------------------------------------------------------------\
| ____ _ __ __ ___ |
| |__ / \ / / . \ . \ |
| / / \ V /| _/ _/ |
| / /__ | | | | | | |
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
/** \file zypp/Locale.h
*
*/
#ifndef ZYPP_LOCALE_H
#define ZYPP_LOCALE_H
#include <iosfwd>
#include "zypp/base/PtrTypes.h"
#include "zypp/base/Tr1hash.h"
#include "zypp/IdString.h"
#include "zypp/LanguageCode.h"
#include "zypp/CountryCode.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
class Locale;
typedef std::tr1::unordered_set<Locale> LocaleSet;
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : Locale
//
/**
* \todo migrate to IdString
*/
class Locale
{
friend std::ostream & operator<<( std::ostream & str, const Locale & obj );
public:
/** Implementation */
class Impl;
public:
/** Default ctor */
Locale();
/** Ctor taking a string. */
explicit
Locale( IdString code_r );
explicit
Locale( const std::string & code_r );
explicit
Locale( const char * code_r );
/** Ctor taking LanguageCode and optional CountryCode. */
Locale( const LanguageCode & language_r,
const CountryCode & country_r = CountryCode() );
/** Dtor */
~Locale();
public:
/** \name Locale constants. */
//@{
/** No or empty code. */
static const Locale noCode;
//@}
public:
/** */
const LanguageCode & language() const;
/** */
const CountryCode & country() const;
/** Return the locale code. */
std::string code() const;
/** Return the name made of language and country name. */
std::string name() const;
/** Return a fallback locale for this locale, when giving up, returns empty Locale() */
Locale fallback() const;
public:
/** Return the best match for \ref Locale \c requested_r within the available \c avLocales_r.
*
* If \c requested_r is nor specified or equals \ref Locale::noCode,
* \ref ZConfig::textLocale is assumed.
*
* If neither \c requested_r nor any of it's \ref fallback locales
* are available, \ref Locale::noCode is returned.
*/
static Locale bestMatch( const LocaleSet & avLocales_r, const Locale & requested_r = Locale() );
private:
/** Pointer to implementation */
RW_pointer<Impl> _pimpl;
};
///////////////////////////////////////////////////////////////////
/** \relates Locale Stream output */
inline std::ostream & operator<<( std::ostream & str, const Locale & obj )
{ return str << obj.code(); }
/** Comparison based on string value. */
//@{
/** \relates Locale */
inline bool operator==( const Locale & lhs, const Locale & rhs ) {
return( lhs.code() == rhs.code() );
}
/** \relates Locale */
inline bool operator==( const std::string & lhs, const Locale & rhs ) {
return( lhs == rhs.code() );
}
/** \relates Locale */
inline bool operator==( const Locale & lhs, const std::string & rhs ) {
return( lhs.code() == rhs );
}
/** \relates Locale */
inline bool operator!=( const Locale & lhs, const Locale & rhs ) {
return( ! operator==( lhs, rhs ) );
}
/** \relates Locale */
inline bool operator!=( const std::string & lhs, const Locale & rhs ) {
return( ! operator==( lhs, rhs ) );
}
/** \relates Locale */
inline bool operator!=( const Locale & lhs, const std::string & rhs ) {
return( ! operator==( lhs, rhs ) );
}
//@}
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
namespace std { namespace tr1 {
/** \relates ::zypp::Locale hash function */
template<> struct hash< ::zypp::Locale>
{
size_t operator()( const ::zypp::Locale & __s ) const
{ return hash<std::string>()(__s.code()); }
};
}}
///////////////////////////////////////////////////////////////////
namespace std
{ /////////////////////////////////////////////////////////////////
/** \relates zypp::Locale Default order for std::container based on code string value.*/
template<>
inline bool less<zypp::Locale>::operator()( const zypp::Locale & lhs, const zypp::Locale & rhs ) const
{ return lhs.code() < rhs.code(); }
/////////////////////////////////////////////////////////////////
} // namespace std
///////////////////////////////////////////////////////////////////
#endif // ZYPP_LOCALE_H
|