Merge pull request #1129 from jmarshallnz/remove_smb_auth_details_in_add_source
[vuplus_xbmc] / xbmc / filesystem / VideoDatabaseDirectory / 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 VIDEODATABASEDIRECTORY
31   {
32     class CQueryParams;
33
34     typedef enum _NODE_TYPE
35     {
36       NODE_TYPE_NONE=0,
37       NODE_TYPE_MOVIES_OVERVIEW,
38       NODE_TYPE_TVSHOWS_OVERVIEW,
39       NODE_TYPE_GENRE,
40       NODE_TYPE_ACTOR,
41       NODE_TYPE_ROOT,
42       NODE_TYPE_OVERVIEW,
43       NODE_TYPE_TITLE_MOVIES,
44       NODE_TYPE_YEAR,
45       NODE_TYPE_DIRECTOR,
46       NODE_TYPE_TITLE_TVSHOWS,
47       NODE_TYPE_SEASONS,
48       NODE_TYPE_EPISODES,
49       NODE_TYPE_RECENTLY_ADDED_MOVIES,
50       NODE_TYPE_RECENTLY_ADDED_EPISODES,
51       NODE_TYPE_STUDIO,
52       NODE_TYPE_MUSICVIDEOS_OVERVIEW,
53       NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS,
54       NODE_TYPE_TITLE_MUSICVIDEOS,
55       NODE_TYPE_MUSICVIDEOS_ALBUM,
56       NODE_TYPE_SETS,
57       NODE_TYPE_COUNTRY,
58       NODE_TYPE_TAGS
59     } NODE_TYPE;
60
61     typedef struct {
62       NODE_TYPE node;
63       int       id;
64       int       label;
65     } Node;
66     
67     class CDirectoryNode
68     {
69     public:
70       static CDirectoryNode* ParseURL(const CStdString& strPath);
71       static void GetDatabaseInfo(const CStdString& strPath, CQueryParams& params);
72       virtual ~CDirectoryNode();
73
74       NODE_TYPE GetType() const;
75
76       bool GetChilds(CFileItemList& items);
77       virtual NODE_TYPE GetChildType() const;
78       virtual CStdString GetLocalizedName() const;
79
80       CDirectoryNode* GetParent() const;
81
82       bool CanCache() const;
83     protected:
84       CDirectoryNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent);
85       static CDirectoryNode* CreateNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent);
86
87       void CollectQueryParams(CQueryParams& params) const;
88
89       const CStdString& GetName() const;
90       int GetID() const;
91       void RemoveParent();
92
93       virtual bool GetContent(CFileItemList& items) const;
94
95       CStdString BuildPath() const;
96
97     private:
98       void AddQueuingFolder(CFileItemList& items) const;
99
100     private:
101       NODE_TYPE m_Type;
102       CStdString m_strName;
103       CDirectoryNode* m_pParent;
104     };
105   }
106 }
107
108
109