File: fsencoding.hh

package info (click to toggle)
goldendict 0.9.1~git20100719-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 8,992 kB
  • ctags: 3,672
  • sloc: cpp: 22,301; ansic: 10,244; makefile: 53; sh: 9
file content (37 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download
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
/* This file is (c) 2008-2010 Konstantin Isakov <ikm@users.berlios.de>
 * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */

#ifndef __FSENCODING_HH_INCLUDED__
#define __FSENCODING_HH_INCLUDED__

#include "wstring.hh"

/// 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;
using gd::wstring;

/// Encodes the given wide string to the system 8bit encoding.
string encode( wstring const & );

/// Encodes the given string in utf8 to the system 8bit encoding.
string encode( string const & );

/// Decodes the given 8bit-encoded string to a wide string.
wstring decode( string const & str );

/// Returns the filesystem separator (/ on Unix and clones, \ on Windows).
char separator();

/// Returns the directory part of the given filename.
string dirname( string const & );

/// Returns the name part of the given filename.
string basename( string const & );

}

#endif