diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2011-05-03 10:40:58 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2011-05-03 13:19:29 +0200 |
commit | ea55f6042622cab5a584c692c3a9eec69cebec09 (patch) | |
tree | e36411b2fda4b9d7202700804cb42a82aad313ea /src/gui/styles | |
parent | 806e02604399924393fd4c75924de04e5d2aa7aa (diff) |
split the HexString template class out of qstylehelper
The class is used in quite a few places and has no relation
to styles. Split it out into it's own file to remove a dependency
between Gui and Widgets.
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qstylehelper_p.h | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h index 27587e30ac..6aeb71c103 100644 --- a/src/gui/styles/qstylehelper_p.h +++ b/src/gui/styles/qstylehelper_p.h @@ -59,6 +59,8 @@ // We mean it. // +#include <private/qhexstring_p.h> + QT_BEGIN_NAMESPACE class QPainter; @@ -81,37 +83,6 @@ namespace QStyleHelper int bottom = 0); } -// internal helper. Converts an integer value to an unique string token -template <typename T> - struct HexString -{ - inline HexString(const T t) - : val(t) - {} - - inline void write(QChar *&dest) const - { - const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - const char *c = reinterpret_cast<const char *>(&val); - for (uint i = 0; i < sizeof(T); ++i) { - *dest++ = hexChars[*c & 0xf]; - *dest++ = hexChars[(*c & 0xf0) >> 4]; - ++c; - } - } - const T val; -}; - -// specialization to enable fast concatenating of our string tokens to a string -template <typename T> - struct QConcatenable<HexString<T> > -{ - typedef HexString<T> type; - enum { ExactSize = true }; - static int size(const HexString<T> &) { return sizeof(T) * 2; } - static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); } - typedef QString ConvertTo; -}; QT_END_NAMESPACE |