]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/utf8.h
picking up branches/tmp/sh/qt4-port/, merging it with trunk
[duncan/yast2-qt4.git] / src / utf8.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       utf8.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef utf8_h
21 #define utf8_h
22
23 #include <qstring.h>
24 #include <string>
25
26
27 inline QString fromUTF8( const std::string & str )
28 {
29     return QString::fromUtf8(str.c_str() );
30 }
31
32
33 inline std::string toUTF8( const QString & str )
34 {
35     if ( str.isEmpty() )
36         return std::string( "" );
37     else
38         return std::string( str.utf8().data() );
39 }
40
41 #endif // utf8_h