summaryrefslogtreecommitdiffstats
path: root/kmid/slman.h
blob: f1da57c0c99891a4bd4ac327cc571428458ee795 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*  slman.h  - SongList Manager, which holds a set of collections (SongLists) 
    Copyright (C) 1997,98,99,2000  Antonio Larrosa Jimenez

    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.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

    Send comments and bug fixes to larrosa@kde.org
    or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain

***************************************************************************/
#ifndef SLMAN_H
#define SLMAN_H

#include "songlist.h"

class SLManager
{
protected:
int ntotal;

struct SongListNode
   {
   int id;
   char *name;
   SongList *SL;
   
   SongListNode *next;
   };
SongListNode *list;
SongList *tempsl;

char *getNotUsedName(void);
int nameUsed(const char *name);
void regenerateid(SongListNode *sl,int id);

public:
SLManager();
SLManager(SLManager &src);  // Copy constructor
~SLManager();

int createCollection(const char *name=NULL); // Returns the id associated to the 
                           // new collection
                           // -1 if name already is used and Collection was
                           //  not created

void deleteCollection(int id);
void changeCollectionName(int id, const char *newname);

SongList *getCollection(int id);
SongList *getCollection(const char *name);
const char *getCollectionName(int id);

int numberOfCollections(void) {return ntotal;};

void loadConfig(const char *filename);
void saveConfig(const char *filename);

SongList *createTemporaryCollection(void);
SongList *getTemporaryCollection(void) {return tempsl;};

};

#endif