1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/TranslatedText.h
12 #ifndef ZYPP_TRANSLATEDTEXT_H
13 #define ZYPP_TRANSLATEDTEXT_H
21 #include "zypp/base/PtrTypes.h"
22 #include "zypp/Locale.h"
24 ///////////////////////////////////////////////////////////////////
26 { /////////////////////////////////////////////////////////////////
28 ///////////////////////////////////////////////////////////////////
30 // CLASS NAME : TranslatedText
32 /** Class that represent a text and multiple translations.
36 friend std::ostream & operator<<( std::ostream & str, const TranslatedText & obj );
47 TranslatedText(const std::string &text, const Locale &lang = Locale());
50 TranslatedText(const std::list<std::string> &text, const Locale &lang = Locale());
54 /** true if the text have no translations for any language */
57 /** static default empty translated text */
58 static const TranslatedText notext;
62 /** Synonym for \ref text */
63 std::string asString( const Locale &lang = Locale() ) const
64 { return text(lang); }
66 std::string text( const Locale &lang = Locale() ) const;
67 std::set<Locale> locales() const;
69 void setText( const std::string &text, const Locale &lang = Locale());
70 void setText( const std::list<std::string> &text, const Locale &lang = Locale());
72 Locale detectLanguage() const;
75 /** Pointer to implementation */
76 RWCOW_pointer<Impl> _pimpl;
78 ///////////////////////////////////////////////////////////////////
80 /** \relates TranslatedText Stream output */
81 inline std::ostream & operator<<( std::ostream & str, const TranslatedText & obj )
82 { return str << obj.asString(); }
84 /////////////////////////////////////////////////////////////////
86 ///////////////////////////////////////////////////////////////////
87 #endif // ZYPP_TRANSLATEDTEXT_H