2
* \file attributedata.h
3
* String representation of attribute data.
9
* Copyright (C) 2009 Urs Fleisch
11
* This file is part of Kid3.
13
* Kid3 is free software; you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation; either version 2 of the License, or
16
* (at your option) any later version.
18
* Kid3 is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* You should have received a copy of the GNU General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>.
27
#ifndef ATTRIBUTEDATA_H
28
#define ATTRIBUTEDATA_H
31
#if QT_VERSION >= 0x040000
35
/** Attribute data used e.g. by Windows Media Player. */
38
/** Attribute data types. */
40
Unknown, /**< Unknown type */
41
Utf16, /**< UTF-16 encoded, zero-terminated Unicode string */
42
Guid, /**< 128-bit GUID */
43
DWord, /**< 32-bit value little-endian */
44
Binary /**< Binary data */
52
AttributeData(Type type)
60
* @param name owner of Windows media PRIV frame
62
AttributeData(const QString& name);
73
Type getType() const { return m_type; }
76
* Convert attribute data to string.
78
* @param data byte array with data
79
* @param str result string
83
bool toString(const QByteArray& data, QString& str);
86
* Convert attribute data string to byte array.
88
* @param str string representation of data
89
* @param data result data
93
bool toByteArray(const QString& str, QByteArray& data);
96
* Check if a string represents a hexadecimal number, i.e.
97
* contains only characters 0..9, A..F.
99
* @param str string to check
100
* @param lastAllowedLetter last allowed character (normally 'F')
101
* @param additionalChars additional allowed characters
103
* @return true if string has hex format.
105
static bool isHexString(const QString& str, char lastAllowedLetter = 'F',
106
const QString additionalChars = QString());
112
#endif // ATTRIBUTEDATA_H