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

« back to all changes in this revision

Viewing changes to kid3/genres.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 genres.h
3
 
 * Alphabetical list of genres.
4
 
 *
5
 
 * \b Project: Kid3
6
 
 * \author Urs Fleisch
7
 
 * \date 9 Jan 2003
8
 
 *
9
 
 * Copyright (C) 2003-2007  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 GENRES_H
28
 
#define GENRES_H
29
 
 
30
 
class QString;
31
 
 
32
 
/** Alphabetically sorted list of genres, conversion to/from genre numbers */
33
 
class Genres {
34
 
public:
35
 
        /**
36
 
         * Get name assigned to genre number.
37
 
         *
38
 
         * @param num genre number
39
 
         *
40
 
         * @return name, empty string for unknown number.
41
 
         */
42
 
        static const char* getName(int num);
43
 
 
44
 
        /**
45
 
         * Get the index in the alphabethically sorted list from the genre number.
46
 
         *
47
 
         * @param num genre number
48
 
         *
49
 
         * @return index, 0 for unknown number.
50
 
         */
51
 
        static int getIndex(int num);
52
 
 
53
 
        /**
54
 
         * Get the genre number from a string containing a genre text.
55
 
         *
56
 
         * @param str string with genre
57
 
         *
58
 
         * @return genre number, 255 for unknown index.
59
 
         */
60
 
        static int getNumber(const QString& str);
61
 
 
62
 
        /**
63
 
         * Get a name string from a string with a number or a name.
64
 
         * ID3v2 genres can be stored as "9", "(9)", "(9)Metal" or "Metal".
65
 
         *
66
 
         * @param str genre string.
67
 
         */
68
 
        static QString getNameString(const QString& str);
69
 
 
70
 
        /**
71
 
         * Get a number representation of a genre name if possible.
72
 
         *
73
 
         * @param str         string with genre name
74
 
         * @param parentheses true to put the number in parentheses
75
 
         *
76
 
         * @return genre string.
77
 
         */
78
 
        static QString getNumberString(const QString& str, bool parentheses);
79
 
 
80
 
        /** Number of genres */
81
 
#if defined _WIN32 || defined WIN32
82
 
        enum { count = 148 };
83
 
#else
84
 
        static const int count = 148;
85
 
#endif
86
 
        /**
87
 
         * Pointer to alphabetic list of genres.
88
 
         * NULL terminated, to be used in combo box.
89
 
         */
90
 
        static const char** s_strList;
91
 
 
92
 
 private:
93
 
        /**
94
 
         * Alphabetic list of genres, starts with unknown (empty) entry.
95
 
         *
96
 
         * 125: Last ID3v1, 142: WinAmp 1.91, 145: WinAmp 1.92, 255: unknown
97
 
         */
98
 
        static const char* s_genre[Genres::count + 3];
99
 
        /**
100
 
         * s_genreNum[n] gives the number of the n-th genre
101
 
         * in the alphabetically sorted list.
102
 
         */
103
 
        static const unsigned char s_genreNum[Genres::count + 1];
104
 
};
105
 
 
106
 
#endif /* GENRES_H */