diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2010-09-08 18:17:21 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2010-09-08 18:17:21 (GMT) |
commit | 690d926ac444243611cd875fb84fabb4e6db2cf2 (patch) | |
tree | c8ef84056b295071f9a9207ffea5393c6cf4ad4d /src/FbTk/FbString.hh | |
parent | 1e8fe2bc14856fa16508686a28a85e72cb0e422c (diff) | |
download | fluxbox_pavel-690d926ac444243611cd875fb84fabb4e6db2cf2.zip fluxbox_pavel-690d926ac444243611cd875fb84fabb4e6db2cf2.tar.bz2 |
introduced FbTk::BidiString
a 'BidiString' holds both the logical content and the visual reordered
version of the content of a string. this helps to reduce the number of
calls to reorder the string before drawing it (as introduced in the patch
from Ken Bloom) and to be more consistent in menus and textboxes (drawing
cursors and underlining text).
Diffstat (limited to 'src/FbTk/FbString.hh')
-rw-r--r-- | src/FbTk/FbString.hh | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/FbTk/FbString.hh b/src/FbTk/FbString.hh index e1a5dc5..55798e5 100644 --- a/src/FbTk/FbString.hh +++ b/src/FbTk/FbString.hh | |||
@@ -36,6 +36,25 @@ namespace FbTk { | |||
36 | // (or just plain whatever for now if no utf-8 available) | 36 | // (or just plain whatever for now if no utf-8 available) |
37 | typedef std::string FbString; | 37 | typedef std::string FbString; |
38 | 38 | ||
39 | class BiDiString { | ||
40 | |||
41 | public: | ||
42 | |||
43 | BiDiString(const FbString& logical = FbString()); | ||
44 | |||
45 | const FbString& logical() const { return m_logical; } | ||
46 | const FbString& visual() const; | ||
47 | |||
48 | const FbString& setLogical(const FbString& logical); | ||
49 | |||
50 | private: | ||
51 | FbString m_logical; | ||
52 | #ifdef HAVE_FRIBIDI | ||
53 | mutable FbString m_visual; | ||
54 | mutable bool m_visual_dirty; | ||
55 | #endif | ||
56 | }; | ||
57 | |||
39 | namespace FbStringUtil { | 58 | namespace FbStringUtil { |
40 | 59 | ||
41 | void init(); | 60 | void init(); |
@@ -52,11 +71,6 @@ std::string FbStrToX(const FbString &src); | |||
52 | FbString LocaleStrToFb(const std::string &src); | 71 | FbString LocaleStrToFb(const std::string &src); |
53 | std::string FbStrToLocale(const FbString &src); | 72 | std::string FbStrToLocale(const FbString &src); |
54 | 73 | ||
55 | #ifdef HAVE_FRIBIDI | ||
56 | /// Make Bidi | ||
57 | FbString BidiLog2Vis (const FbString& src); | ||
58 | #endif | ||
59 | |||
60 | bool haveUTF8(); | 74 | bool haveUTF8(); |
61 | 75 | ||
62 | } // namespace FbStringUtil | 76 | } // namespace FbStringUtil |
@@ -70,23 +84,14 @@ public: | |||
70 | ~StringConvertor(); | 84 | ~StringConvertor(); |
71 | 85 | ||
72 | bool setSource(const std::string &encoding); | 86 | bool setSource(const std::string &encoding); |
73 | void reset() { | 87 | void reset(); |
74 | #ifdef HAVE_ICONV | ||
75 | if (m_iconv != ((iconv_t)-1)) | ||
76 | iconv_close(m_iconv); | ||
77 | m_iconv = ((iconv_t)(-1)); | ||
78 | #endif | ||
79 | } | ||
80 | 88 | ||
81 | std::string recode(const std::string &src); | 89 | FbString recode(const FbString &src); |
82 | 90 | ||
83 | private: | 91 | private: |
84 | #ifdef HAVE_ICONV | 92 | #ifdef HAVE_ICONV |
85 | iconv_t m_iconv; | 93 | iconv_t m_iconv; |
86 | #else | ||
87 | int m_iconv; | ||
88 | #endif | 94 | #endif |
89 | |||
90 | std::string m_destencoding; | 95 | std::string m_destencoding; |
91 | }; | 96 | }; |
92 | 97 | ||