genrelist.h 1.83 KB
Newer Older
1 2 3 4 5
/***************************************************************************
                          genrelist.h  -  description
                             -------------------
    begin                : Sun Mar 3 2002
    copyright            : (C) 2002 by Scott Wheeler
6
    email                : wheeler@kde.org
7
***************************************************************************/
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef GENRELIST_H
#define GENRELIST_H

#include <qvaluelist.h>
#include <qstring.h>
#include <qvaluevector.h>

#include "genre.h"

27
class GenreList : public QValueList<Genre>
28 29
{
public:
30
    GenreList(bool createIndex = false);
31 32
    GenreList(const QString &file, bool createIndex = false);
    virtual ~GenreList();
33

34 35
    void load(const QString &file);
    QString name(int ID3v1);
36 37 38
    /**
     * Do a "reverse" lookup.  Given an ID3v1 genre name, find the index.
     */
39
    int findIndex(const QString &item);
40 41

private:
42 43
    QValueVector<QString> index;
    bool hasIndex;
44 45 46 47 48
    /** 
     * This is used for creating a mapping between ID3v1 genre numbers and the
     * name that is associated with those genres.  There is no reason that this
     * should be called for GenreLists other than the ID3v1 GenreList. 
     */
49
    void initializeIndex();
50 51 52
};

#endif