Changeset 846 for trunk/src/gui/styles/qstylehelper_p.h
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/styles/qstylehelper_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 42 42 #include <QtCore/qglobal.h> 43 43 #include <QtCore/qpoint.h> 44 #include <QtCore/qstring.h> 44 45 #include <QtGui/qpolygon.h> 46 #include <QtCore/qstringbuilder.h> 45 47 46 48 #ifndef QSTYLEHELPER_P_H … … 80 82 } 81 83 84 // internal helper. Converts an integer value to an unique string token 85 template <typename T> 86 struct HexString 87 { 88 inline HexString(const T t) 89 : val(t) 90 {} 91 92 inline void write(QChar *&dest) const 93 { 94 const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; 95 const char *c = reinterpret_cast<const char *>(&val); 96 for (uint i = 0; i < sizeof(T); ++i) { 97 *dest++ = hexChars[*c & 0xf]; 98 *dest++ = hexChars[(*c & 0xf0) >> 4]; 99 ++c; 100 } 101 } 102 const T val; 103 }; 104 105 // specialization to enable fast concatenating of our string tokens to a string 106 template <typename T> 107 struct QConcatenable<HexString<T> > 108 { 109 typedef HexString<T> type; 110 enum { ExactSize = true }; 111 static int size(const HexString<T> &) { return sizeof(T) * 2; } 112 static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); } 113 }; 114 82 115 QT_END_NAMESPACE 83 116
Note:
See TracChangeset
for help on using the changeset viewer.