-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtreeitem.hpp
52 lines (38 loc) · 1009 Bytes
/
treeitem.hpp
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
#ifndef TREEITEM_HPP
#define TREEITEM_HPP
#include <QtCore/QString>
#include <QtCore/QList>
#include<ostream>
#include <odb/core.hxx>
#include <odb/database.hxx>
#pragma db object no_id polymorphic pointer(*)
class TreeItem
{
public:
enum ItemTypes
{
BASE=0, library, artist, album, track
};
QList<TreeItem*> Children;
//Wyświetlanie w QT zależy od parenta
#pragma db transient
TreeItem* Parent;
TreeItem(TreeItem* parent=NULL);
TreeItem(const TreeItem& other);
virtual TreeItem* Copy() const=0;
virtual ~TreeItem();
int Row() const;
virtual QString QData() const;
virtual bool Persist(odb::database& db);
virtual void Erase(odb::database& db);
virtual void Update(odb::database& db);
virtual ItemTypes ItemType() const;
TreeItem& operator=(const TreeItem& other);
friend std::ostream& operator<<(std::ostream& out, const TreeItem& item); //COUT
protected:
friend class odb::access;
#pragma db id auto
unsigned int id;
private:
};
#endif