Merge branch 'container_foldername'
[vuplus_xbmc] / xbmc / filesystem / MusicDatabaseDirectory / DirectoryNode.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2008 Team XBMC
4  *      http://www.xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, write to
18  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19  *  http://www.gnu.org/copyleft/gpl.html
20  *
21  */
22
23
24 #include "utils/StdString.h"
25
26 class CFileItemList;
27
28 namespace XFILE
29 {
30   namespace MUSICDATABASEDIRECTORY
31   {
32     class CQueryParams;
33
34     typedef enum _NODE_TYPE
35     {
36       NODE_TYPE_NONE=0,
37       NODE_TYPE_ROOT,
38       NODE_TYPE_OVERVIEW,
39       NODE_TYPE_TOP100,
40       NODE_TYPE_GENRE,
41       NODE_TYPE_ARTIST,
42       NODE_TYPE_ALBUM,
43       NODE_TYPE_ALBUM_RECENTLY_ADDED,
44       NODE_TYPE_ALBUM_RECENTLY_ADDED_SONGS,
45       NODE_TYPE_ALBUM_RECENTLY_PLAYED,
46       NODE_TYPE_ALBUM_RECENTLY_PLAYED_SONGS,
47       NODE_TYPE_ALBUM_TOP100,
48       NODE_TYPE_ALBUM_TOP100_SONGS,
49       NODE_TYPE_ALBUM_COMPILATIONS,
50       NODE_TYPE_ALBUM_COMPILATIONS_SONGS,
51       NODE_TYPE_SONG,
52       NODE_TYPE_SONG_TOP100,
53       NODE_TYPE_YEAR,
54       NODE_TYPE_YEAR_ALBUM,
55       NODE_TYPE_YEAR_SONG,
56       NODE_TYPE_SINGLES
57     } NODE_TYPE;
58
59     typedef struct {
60       NODE_TYPE node;
61       int       id;
62       int       label;
63     } Node;
64
65     class CDirectoryNode
66     {
67     public:
68       static CDirectoryNode* ParseURL(const CStdString& strPath);
69       static void GetDatabaseInfo(const CStdString& strPath, CQueryParams& params);
70       virtual ~CDirectoryNode();
71
72       NODE_TYPE GetType() const;
73
74       bool GetChilds(CFileItemList& items);
75       virtual NODE_TYPE GetChildType() const;
76       virtual CStdString GetLocalizedName() const;
77
78       CDirectoryNode* GetParent() const;
79       bool CanCache() const;
80
81     protected:
82       CDirectoryNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent);
83       static CDirectoryNode* CreateNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent);
84
85       void CollectQueryParams(CQueryParams& params) const;
86
87       const CStdString& GetName() const;
88       int GetID() const;
89       void RemoveParent();
90
91       virtual bool GetContent(CFileItemList& items) const;
92
93       CStdString BuildPath() const;
94
95     private:
96       void AddQueuingFolder(CFileItemList& items) const;
97
98     private:
99       NODE_TYPE m_Type;
100       CStdString m_strName;
101       CDirectoryNode* m_pParent;
102     };
103   }
104 }
105
106