Fairly large overhaul of the JuK codebase to beat out a lot of the Qt 3 stuff.
[kdemultimedia.git] / kmid / songlist.h
blob07c830e1f46a608b638fcc8ce85ece1838315260
1 /* songlist.h - class SongList, which holds a list of songs (collection)
2 Copyright (C) 1997,98,99,2000 Antonio Larrosa Jimenez
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 Send comments and bug fixes to larrosa@kde.org
19 or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
21 ***************************************************************************/
22 #ifndef SONGLIST_H
23 #define SONGLIST_H
25 #include <stdio.h>
27 class SongList
29 protected:
30 int ntotal;
32 struct Song
34 int id;
35 char *name; // complete path and file name
37 Song *next;
40 Song *list;
41 Song *last;
42 Song *active;
44 Song *it; // Iterator, just a helper variable to make easy (and fast) reading
45 // all the list
47 Song *getSongid(int id);
49 void regenerateid(Song *song,int id);
51 public:
52 SongList(void);
53 SongList(SongList &src); // Copy constructor
54 ~SongList();
56 int AddSong(const char *song); // Returns the id number assigned to the song
57 void DelSong(int id);
59 int NumberOfSongs(void) { return ntotal; }
61 void setActiveSong(int id);
62 int getActiveSongID(void) {return ((active!=NULL)? (active->id ):(-1)); }
63 char *getActiveSongName(void)
65 return ((active!=NULL)? (active->name):((char *)NULL));
68 char *getName(int id); // Returns the name of the song with id id
70 void previous(void);
71 int next(void); // returns 1 if evrything is ok, and 0 if it was the last element
72 // (but leaves active the last element instead of NULL)
74 void iteratorStart(void);
75 void iteratorNext(void);
76 int iteratorAtEnd (void) {return (it==NULL);}
77 int getIteratorID(void);
78 char *getIteratorName(void);
80 void clean(void); // Clean this list
81 void copy(SongList &src); // Makes this object a copy of src (really copied)
84 #endif