-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxml_parser.h
65 lines (55 loc) · 1.66 KB
/
xml_parser.h
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
#ifndef XML_PARSER_H
#define XML_PARSER_H
#include "stable.h"
#include "xml_bus.h"
#include "xml_data.h"
#include "master.h"
class Xml_Parser
{
template <typename T1, typename T2>
struct less_second {
typedef QPair<T1, T2> type;
bool operator ()(type const& a, type const& b) const {
return a.second < b.second;
}
};
struct AlbumData
{
QStringList album;
QStringList artist;
QStringList year;
QStringList id;
};
public:
Xml_Parser();
QMap<QString, QStringList> GetAllAlbums();
QList<QPair<int, QString>> GetAllArtist();
QMap<int, QString> GetAllSong();
QList<int> GetAlbumsByArtist(int ID);
QList<int> GetSongsByAlbum(int ID);
QString GetArtistNameByID(int ID);
QString GetAlbumNameByID(int ID);
QString GetSongPathByID(int ID);
int GetAllAlbumsCount();
int GetAllArtistsCount();
int GetAllSongsCount();
int GetAllSongsCountByAlbum(int ID);
int GetAllAlbumsCountByArtist(int ID);
void GetSongsInPlaylist(Master &list);
void GetAlbumsInPlaylist(Master &list);
void Init();
void SavePlaylist();
void SaveChoosenFolder(QString path);
void AddToDom(QString title, QString artist, QString album, QString path, uint year);
void LoadData(QString path);
void sortMap(QMap<QString, QStringList> &map);
void quicksort(int leftIdx, int rightIdx, AlbumData &data);
void swap(int leftIdx, int rightIdx, AlbumData &data);
int divide(int leftIdx, int rightIdx, AlbumData &data);
private:
QDomElement root;
unsigned int albID;
unsigned int artID;
unsigned int songID;
};
#endif // XML_PARSER_H