~neon/juk/master

« back to all changes in this revision

Viewing changes to genrelistreader.cpp

  • Committer: Scott Wheeler
  • Date: 2002-03-06 04:24:31 UTC
  • Revision ID: git-v1:3b69f66d9a122457a3603fced6161cc38e9fd639
This is a complete rewrite of the genre system to be based on XML.
Currently this just supports reading XML genre lists.

svn path=/trunk/kdemultimedia/juk/; revision=141257

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          genrelistreader.cpp  -  description
 
3
                             -------------------
 
4
    begin                : Mon Mar 4 2002
 
5
    copyright            : (C) 2002 by Scott Wheeler
 
6
    email                : scott@slackorama.net
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
#include "genrelistreader.h"
 
19
 
 
20
////////////////////////////////////////////////////////////////////////////////
 
21
// public members
 
22
////////////////////////////////////////////////////////////////////////////////
 
23
 
 
24
GenreListReader::GenreListReader(GenreList *genreList)
 
25
{
 
26
  list = genreList;
 
27
}
 
28
 
 
29
GenreListReader::~GenreListReader()
 
30
{
 
31
}
 
32
 
 
33
bool GenreListReader::startElement(const QString&, const QString&, const QString& element, const QXmlAttributes& attributes)
 
34
{
 
35
  if(element.lower() == "genre") {
 
36
    inGenreTag = true;
 
37
    if(attributes.index("id3v1") != -1)
 
38
      id3v1 = attributes.value("id3v1").toInt();
 
39
    else 
 
40
      id3v1 = 255;
 
41
  }
 
42
  else {
 
43
    id3v1 = 255;
 
44
  }
 
45
  return(true);
 
46
};
 
47
 
 
48
bool GenreListReader::endElement(const QString&, const QString&, const QString& element)
 
49
{
 
50
  if(element.lower() == "genre")
 
51
    inGenreTag = false;
 
52
  return(true);
 
53
};
 
54
  
 
55
bool GenreListReader::characters(const QString& content)
 
56
{
 
57
  if(inGenreTag) {
 
58
    list->append(Genre(content, id3v1));
 
59
  }
 
60
  return(true);
 
61
};