summaryrefslogtreecommitdiff
path: root/mg_item.h
blob: 4d5bf2d9a11296a1e6d9b95d8047ca346df9e1b2 (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
/* \file mg_item.h
 * \brief A general interface to data items, currently only GiantDisc
 *
 * \version $Revision: 1.0 $
 * \date    $Date: 2004-12-07 10:10:35 +0200 (Tue, 07 Dec 2004) $
 * \author  Wolfgang Rohdewald
 * \author  Responsible author: $Author: wr $
 *
 */

#ifndef _MG_ITEM_H
#define _MG_ITEM_H
#include <string>

using namespace std;

#include "mg_listitem.h"
#include "mg_keytypes.h"
#include "mg_selection.h"

class mgSelection;

//! \brief represents a content item 
class mgItem
{
    public:
//! \brief copy constructor
//	mgItem (const mgItem* c);
	mgItem();
	virtual mgItem* Clone();
        virtual ~mgItem() {};
	bool Valid(bool Silent=false) const;
	virtual long getItemid() const { return m_itemid; }
	virtual mgListItem* getKeyItem(mgKeyTypes kt) const { return new mgListItem; }
//! \brief returns filename
        virtual string getSourceFile (bool AbsolutePath=true,bool Silent=false) const { return m_realfile; }
//! \brief returns title
        string getTitle () const { return m_title; }
//! \brief returns the name of the language
        string getLanguage () const { return m_language; }
//! \brief returns year
        int getYear () const { return m_year; }
//! \brief returns rating
        int getRating () const { return m_rating; }
//! \brief returns duration
        int getDuration () const { return m_duration; }
	virtual string getImagePath (bool AbsolutePath=true) const { return ""; }
	void setSelection(const mgSelection* sel) { m_sel=sel; }
	const mgSelection* getSelection() const { return m_sel; }

    protected:
	mutable bool m_valid;
	mutable bool m_validated;
        long m_itemid;
	string m_title;
	string m_realfile;
        int m_year;
        int m_rating;
        int m_duration;
        string m_genre_id;
        string m_genre;
        string m_language_id;
        string m_language;
	bool readable(string filename) const;
	void analyze_failure(string filename) const;
	void InitFrom(const mgItem* c);
	const mgSelection* m_sel;
};


#endif