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; 50 51 typedef struct { 52 NODE_TYPE node; 53 std::string id; 54 int label; 55 } Node; 56 57 class CDirectoryNode 58 { 59 public: 60 static CDirectoryNode* ParseURL(const std::string& strPath); 61 static void GetDatabaseInfo(const std::string& strPath, CQueryParams& params); 62 virtual ~CDirectoryNode(); 63 64 NODE_TYPE GetType() const; 65 66 bool GetChilds(CFileItemList& items); 67 virtual NODE_TYPE GetChildType() const; 68 virtual std::string GetLocalizedName() const; 69 70 CDirectoryNode* GetParent() const; 71 72 std::string BuildPath() const; 73 74 virtual bool CanCache() const; 75 protected: 76 CDirectoryNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent); 77 static CDirectoryNode* CreateNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent); 78 79 void AddOptions(const std::string &options); 80 void CollectQueryParams(CQueryParams& params) const; 81 82 const std::string& GetName() const; 83 int GetID() const; 84 void RemoveParent(); 85 86 virtual bool GetContent(CFileItemList& items) const; 87 88 89 private: 90 NODE_TYPE m_Type; 91 std::string m_strName; 92 CDirectoryNode* m_pParent; 93 CUrlOptions m_options; 94 }; 95 } 96 } 97 98 99 100