kodi
DirectoryNode.h
1 /*
2  * Copyright (C) 2016-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "utils/UrlOptions.h"
12 
13 #include <string>
14 
15 class CFileItemList;
16 
17 namespace XFILE
18 {
19  namespace VIDEODATABASEDIRECTORY
20  {
21  class CQueryParams;
22 
23  typedef enum _NODE_TYPE
24  {
25  NODE_TYPE_NONE = 0,
26  NODE_TYPE_MOVIES_OVERVIEW,
27  NODE_TYPE_TVSHOWS_OVERVIEW,
28  NODE_TYPE_GENRE,
29  NODE_TYPE_ACTOR,
30  NODE_TYPE_ROOT,
31  NODE_TYPE_OVERVIEW,
32  NODE_TYPE_TITLE_MOVIES,
33  NODE_TYPE_YEAR,
34  NODE_TYPE_DIRECTOR,
35  NODE_TYPE_TITLE_TVSHOWS,
36  NODE_TYPE_SEASONS,
37  NODE_TYPE_EPISODES,
38  NODE_TYPE_RECENTLY_ADDED_MOVIES,
39  NODE_TYPE_RECENTLY_ADDED_EPISODES,
40  NODE_TYPE_STUDIO,
41  NODE_TYPE_MUSICVIDEOS_OVERVIEW,
42  NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS,
43  NODE_TYPE_TITLE_MUSICVIDEOS,
44  NODE_TYPE_MUSICVIDEOS_ALBUM,
45  NODE_TYPE_SETS,
46  NODE_TYPE_COUNTRY,
47  NODE_TYPE_TAGS,
48  NODE_TYPE_INPROGRESS_TVSHOWS,
49  NODE_TYPE_VIDEOVERSIONS
50  } NODE_TYPE;
51 
52  typedef struct {
53  NODE_TYPE node;
54  std::string id;
55  int label;
56  } Node;
57 
59  {
60  public:
61  static CDirectoryNode* ParseURL(const std::string& strPath);
62  static void GetDatabaseInfo(const std::string& strPath, CQueryParams& params);
63  virtual ~CDirectoryNode();
64 
65  NODE_TYPE GetType() const;
66 
67  bool GetChilds(CFileItemList& items);
68  virtual NODE_TYPE GetChildType() const;
69  virtual std::string GetLocalizedName() const;
70  void CollectQueryParams(CQueryParams& params) const;
71 
72  CDirectoryNode* GetParent() const;
73 
74  std::string BuildPath() const;
75 
76  virtual bool CanCache() const;
77  protected:
78  CDirectoryNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent);
79  static CDirectoryNode* CreateNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent);
80 
81  void AddOptions(const std::string& options);
82 
83  const std::string& GetName() const;
84  int GetID() const;
85  void RemoveParent();
86 
87  virtual bool GetContent(CFileItemList& items) const;
88 
89 
90  private:
91  NODE_TYPE m_Type;
92  std::string m_strName;
93  CDirectoryNode* m_pParent;
94  CUrlOptions m_options;
95  };
96  }
97 }
98 
99 
100 
Definition: Scraper.h:41
Represents a list of files.
Definition: FileItem.h:702
Definition: DirectoryNode.h:58
Definition: DirectoryNode.h:52
Definition: UrlOptions.h:16