~ubuntu-branches/ubuntu/wily/kid3/wily-proposed

« back to all changes in this revision

Viewing changes to kid3/attributedata.h

  • Committer: Package Import Robot
  • Author(s): Ana Beatriz Guerrero Lopez, Patrick Matthäi, Ana Beatriz Guerrero Lopez
  • Date: 2011-11-13 16:34:13 UTC
  • mfrom: (1.1.13) (2.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20111113163413-5y0anlc4dqf511uh
Tags: 2.0.1-1
* New upstream release.

[ Patrick Matthäi ]
* Adjust build system.
* Add build dependency xsltproc.

[ Ana Beatriz Guerrero Lopez ]
* Some more adjustments to the build system taken from upstream's deb/
* directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * \file attributedata.h
3
 
 * String representation of attribute data.
4
 
 *
5
 
 * \b Project: Kid3
6
 
 * \author Urs Fleisch
7
 
 * \date 28 Mar 2009
8
 
 *
9
 
 * Copyright (C) 2009  Urs Fleisch
10
 
 *
11
 
 * This file is part of Kid3.
12
 
 *
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.
17
 
 *
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.
22
 
 *
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/>.
25
 
 */
26
 
 
27
 
#ifndef ATTRIBUTEDATA_H
28
 
#define ATTRIBUTEDATA_H
29
 
 
30
 
#include <qstring.h>
31
 
#if QT_VERSION >= 0x040000
32
 
#include <QByteArray>
33
 
#endif
34
 
 
35
 
/** Attribute data used e.g. by Windows Media Player. */
36
 
class AttributeData {
37
 
public:
38
 
        /** Attribute data types. */
39
 
        enum Type {
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 */
45
 
        };
46
 
 
47
 
        /**
48
 
         * Constructor.
49
 
         *
50
 
         * @param type type
51
 
         */
52
 
        AttributeData(Type type)
53
 
        {
54
 
                m_type = type;
55
 
        }
56
 
 
57
 
        /**
58
 
         * Constructor.
59
 
         *
60
 
         * @param name owner of Windows media PRIV frame
61
 
         */
62
 
        AttributeData(const QString& name);
63
 
 
64
 
        /**
65
 
         * Destructor.
66
 
         */
67
 
        ~AttributeData() {}
68
 
 
69
 
        /**
70
 
         * Get type.
71
 
         * @return type.
72
 
         */
73
 
        Type getType() const { return m_type; }
74
 
 
75
 
        /**
76
 
         * Convert attribute data to string.
77
 
         *
78
 
         * @param data byte array with data
79
 
         * @param str  result string
80
 
         *
81
 
         * @return true if ok.
82
 
         */
83
 
        bool toString(const QByteArray& data, QString& str);
84
 
 
85
 
        /**
86
 
         * Convert attribute data string to byte array.
87
 
         *
88
 
         * @param str  string representation of data
89
 
         * @param data result data
90
 
         *
91
 
         * @return true if ok.
92
 
         */
93
 
        bool toByteArray(const QString& str, QByteArray& data);
94
 
 
95
 
        /**
96
 
         * Check if a string represents a hexadecimal number, i.e.
97
 
         * contains only characters 0..9, A..F.
98
 
         *
99
 
         * @param str string to check
100
 
         * @param lastAllowedLetter last allowed character (normally 'F')
101
 
         * @param additionalChars additional allowed characters
102
 
         *
103
 
         * @return true if string has hex format.
104
 
         */
105
 
        static bool isHexString(const QString& str, char lastAllowedLetter = 'F',
106
 
                                const QString additionalChars = QString());
107
 
 
108
 
private:
109
 
        Type m_type;
110
 
};
111
 
 
112
 
#endif // ATTRIBUTEDATA_H