2010-12-09 12:31:50 +00:00
|
|
|
/* This file is (c) 2008-2011 Konstantin Isakov <ikm@goldendict.org>
|
2009-01-28 20:55:45 +00:00
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#ifndef __FSENCODING_HH_INCLUDED__
|
|
|
|
#define __FSENCODING_HH_INCLUDED__
|
|
|
|
|
2009-04-18 17:20:12 +00:00
|
|
|
#include "wstring.hh"
|
2011-09-09 12:05:28 +00:00
|
|
|
#include <QString>
|
2009-01-28 20:55:45 +00:00
|
|
|
|
|
|
|
/// Utilities to convert a wide string or an utf8 string to the local 8bit
|
|
|
|
/// encoding of the file system, and to do other manipulations on the file
|
|
|
|
/// names.
|
|
|
|
namespace FsEncoding {
|
|
|
|
|
|
|
|
using std::string;
|
2009-04-18 17:20:12 +00:00
|
|
|
using gd::wstring;
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2011-09-09 12:05:28 +00:00
|
|
|
/// Encodes the given wide string to the utf8 encoding.
|
2009-01-28 20:55:45 +00:00
|
|
|
string encode( wstring const & );
|
|
|
|
|
|
|
|
/// Encodes the given string in utf8 to the system 8bit encoding.
|
|
|
|
string encode( string const & );
|
|
|
|
|
2011-09-09 12:05:28 +00:00
|
|
|
/// Encodes the QString to the utf8/local 8-bit encoding.
|
|
|
|
string encode( QString const & );
|
|
|
|
|
|
|
|
/// Decodes the given utf8-encoded string to a wide string.
|
2009-04-09 18:50:49 +00:00
|
|
|
wstring decode( string const & str );
|
|
|
|
|
2011-09-09 12:05:28 +00:00
|
|
|
/// Decodes the given utf8/local 8-bit string to a QString.
|
|
|
|
QString decode( const char *str );
|
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
/// Returns the filesystem separator (/ on Unix and clones, \ on Windows).
|
|
|
|
char separator();
|
|
|
|
|
|
|
|
/// Returns the directory part of the given filename.
|
|
|
|
string dirname( string const & );
|
|
|
|
|
2009-02-02 15:01:48 +00:00
|
|
|
/// Returns the name part of the given filename.
|
|
|
|
string basename( string const & );
|
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|