NOISSUE tabs -> spaces
This commit is contained in:
@@ -61,40 +61,40 @@
|
||||
// internal helper. Converts an integer value to an unique string token
|
||||
template <typename T> struct HexString
|
||||
{
|
||||
inline HexString(const T t) : val(t)
|
||||
{
|
||||
}
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
};
|
||||
|
Reference in New Issue
Block a user