summaryrefslogtreecommitdiff
path: root/muggle-plugin/sh_dummy_content.h
blob: 7f79498a46edc53b0f4701613405814366cd6eb1 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*******************************************************************/
/*! \file  dummy_content.h
 * \brief  Dummy Data Objects for testing Muggle
 ******************************************************************** 
 * \version $Revision: 1.3 $
 * \date    $Date: 2004/02/02 22:48:04 $
 * \author  Ralf Klueber, Lars von Wedel, Andreas Kellner
 * \author  file owner: $Author: MountainMan $
 * 
 * Declares main classes of for content items and interfaces to SQL databases
 *
 *******************************************************************/
/* makes sur we dont use parse the same declarations twice */
#ifndef _DUMMY_CONTENT_H
#define _DUMMY_CONTENT_H
using namespace std;
#include <string>
#include <list>
#include <vector>

#include "mg_content_interface.h"

// non-member function
int DummyInitDatabase(MYSQL *db);
vector<string> *DummyGetStoredPlaylists(MYSQL db);
/*! 
 *******************************************************************
 * \class DummyTrack
 *
 * \brief represents a a single track 
 * DUMMY
 ********************************************************************/
class  DummyTrack : public mgContentItem
{

private:
     MYSQL m_db;        

  // content fields
  string m_artist;
  string m_title;
  string m_mp3file;
  string m_album;
  string m_genre; 
  int m_year; 
  int m_rating;
  int m_length;

 
 public:
 
   /* constructor */
  DummyTrack(){ m_uniqID = -1;} // creates invalid item
  DummyTrack(int sqlIdentifier, MYSQL dbase);

  DummyTrack(const DummyTrack&);

  /* destructor */
  ~DummyTrack();
  
  virtual mgContentItem::contentType getContentType()
    {return mgContentItem::GD_AUDIO;}
  virtual mgMediaPlayer getPlayer(){return mgMediaPlayer();}

  /* data acess */
  //virtual functions of the base class 
  virtual string getSourceFile();
  virtual string getTitle();
  virtual string getLabel(int col);
  virtual string getDescription();
  virtual string getGenre();
  virtual int getRating();

  // additional class-specific functions
  string getArtist();
  string getAlbum();
  int getYear();
  int getDuration();

  /* data manipulation */
  void setTitle(string new_title);
  void setArtist(string new_artist);
  void setAlbum(string new_album);
  void setGenre(string new_genre);
  void setYear(int new_rating);
  void setRating(int new_rating);
  
  bool writeData();
  static DummyTrack UNDEFINED;
 
};

class DummyTracklist : public mgTracklist
{
 public:
    DummyTracklist(MYSQL db_handle, string restrictions);
};

/*! 
 *******************************************************************
 * \class GdTracklist
 *
 * \brief represents a playlist, i.e. an ordered collection of tracks
 ********************************************************************/
class  DummyPlaylist : public mgPlaylist
{	  
  private:
     int m_sqlId; /* -1 means: not valid */
     string m_author;
     MYSQL m_db;        
  private:
     void createDummyPlaylist(int strt);
  public:
     
     
     /*==== constructors ====*/
     DummyPlaylist(string listname, MYSQL db_handle);
     /* opens existing or creates empty playlist */
     
     DummyPlaylist(unsigned int sql_identifier, MYSQL db_handle);
     /* construct  from the db by internal id*/
  
     /*==== destructor ====*/
     ~DummyPlaylist();
     
     int getPlayTime();
     /* returns the total duration of all songs in the list in seconds */

     int getPlayTimeRemaining();
     /* returns the duration of all remaining songs in the list in seconds */
     
     bool storePlaylist();
};
/*! 
 *******************************************************************
 * \class mgSelectionTreeNode
 ********************************************************************/
class  DummyTreeNode : public mgSelectionTreeNode {

private:
    MYSQL m_db;           // underlying db
    
public:

    /*==== constructors ====*/
    DummyTreeNode(MYSQL db, int view);
    DummyTreeNode(mgSelectionTreeNode* parent, 
		  string id, string label, string restriction); 

    /*==== destructor ====*/
    ~DummyTreeNode();

    // compute children o^xn the fly 
    virtual bool isLeafNode();  
    virtual bool expand();  

    virtual vector<mgContentItem*>* getTracks();
    virtual mgContentItem* getSingleTrack();
};

/* -------------------- begin CVS log ---------------------------------
 * $Log: sh_dummy_content.h,v $
 * Revision 1.3  2004/02/02 22:48:04  MountainMan
 *  added CVS $Log
 *
 *
 * --------------------- end CVS log ----------------------------------
 */

#endif  /* END  _CONTENT_INTERFACE_H */