diff options
Diffstat (limited to 'src/FbTk/FbString.hh')
-rw-r--r-- | src/FbTk/FbString.hh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/FbTk/FbString.hh b/src/FbTk/FbString.hh new file mode 100644 index 0000000..371d4e9 --- /dev/null +++ b/src/FbTk/FbString.hh | |||
@@ -0,0 +1,62 @@ | |||
1 | // FbString.hh for fluxbox | ||
2 | // Copyright (c) 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) | ||
3 | // Copyright (c) 2006 Simon Bowden (rathnor at fluxbox dot org) | ||
4 | // | ||
5 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | // copy of this software and associated documentation files (the "Software"), | ||
7 | // to deal in the Software without restriction, including without limitation | ||
8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
9 | // and/or sell copies of the Software, and to permit persons to whom the | ||
10 | // Software is furnished to do so, subject to the following conditions: | ||
11 | // | ||
12 | // The above copyright notice and this permission notice shall be included in | ||
13 | // all copies or substantial portions of the Software. | ||
14 | // | ||
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
21 | // DEALINGS IN THE SOFTWARE. | ||
22 | |||
23 | //$Id$ | ||
24 | |||
25 | #ifndef FBTK_FBSTRING_HH | ||
26 | #define FBTK_FBSTRING_HH | ||
27 | |||
28 | #include <string> | ||
29 | |||
30 | namespace FbTk { | ||
31 | |||
32 | // Use this type for things converted to our internal encoding (UTF-8) | ||
33 | // (or just plain whatever for now if no utf-8 available) | ||
34 | typedef std::string FbString; | ||
35 | |||
36 | namespace FbStringUtil { | ||
37 | |||
38 | void init(); | ||
39 | void shutdown(); | ||
40 | |||
41 | /// Stuff to handle strings in different encodings | ||
42 | /// Rule: Only hardcode-initialise FbStrings as ascii (7bit) characters | ||
43 | |||
44 | // NOTE: X "STRING" types are defined (ICCCM) as ISO Latin-1 encoding | ||
45 | FbString XStrToFb(const std::string &src); | ||
46 | std::string FbStrToX(const FbString &src); | ||
47 | |||
48 | /// Handle thislocale string encodings (strings coming from userspace) | ||
49 | FbString LocaleStrToFb(const std::string &src); | ||
50 | std::string FbStrToLocale(const FbString &src); | ||
51 | |||
52 | // essentially NO-OP | ||
53 | inline FbString UTF8StrToFb(const std::string &src) { return src; } | ||
54 | inline std::string FbStrToUTF8(const FbString &src) { return src; } | ||
55 | |||
56 | bool haveUTF8(); | ||
57 | |||
58 | } // namespace FbStringUtil | ||
59 | } // namespace FbTk | ||
60 | |||
61 | #endif // FBTK_FBSTRING_HH | ||
62 | |||