xbmc
AddonsDirectory.h
1 /*
2  * Copyright (C) 2005-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 "IDirectory.h"
12 
13 #include <memory>
14 #include <vector>
15 
16 class CFileItem;
17 class CFileItemList;
18 class CURL;
19 typedef std::shared_ptr<CFileItem> CFileItemPtr;
20 
21 namespace ADDON
22 {
23 class IAddon;
24 using VECADDONS = std::vector<std::shared_ptr<IAddon>>;
25 } // namespace ADDON
26 
27 namespace XFILE
28 {
29 
35  {
36  public:
37  CAddonsDirectory(void);
38  ~CAddonsDirectory(void) override;
39  bool GetDirectory(const CURL& url, CFileItemList &items) override;
40  bool Create(const CURL& url) override { return true; }
41  bool Exists(const CURL& url) override { return true; }
42  bool AllowAll() const override { return true; }
43 
49  static bool GetScriptsAndPlugins(const std::string &content, ADDON::VECADDONS &addons);
50 
56  static bool GetScriptsAndPlugins(const std::string &content, CFileItemList &items);
57 
58  static void GenerateAddonListing(const CURL& path,
59  const ADDON::VECADDONS& addons,
60  CFileItemList& items,
61  const std::string& label);
62  static CFileItemPtr FileItemFromAddon(const std::shared_ptr<ADDON::IAddon>& addon,
63  const std::string& path,
64  bool folder = false);
65 
67  static bool IsRepoDirectory(const CURL& path);
68 
69  private:
70  bool GetSearchResults(const CURL& path, CFileItemList &items);
71  };
72 }
Interface to the directory on a file system.
Definition: IDirectory.h:50
Definition: Scraper.h:41
std::shared_ptr< CFileItem > CFileItemPtr
A shared pointer to CFileItem.
Definition: FileItem.h:680
bool AllowAll() const override
Whether to allow all files/folders to be listed.
Definition: AddonsDirectory.h:42
Represents a list of files.
Definition: FileItem.h:713
Definition: URL.h:20
bool Create(const CURL &url) override
Create the directory.
Definition: AddonsDirectory.h:40
Definition: Addon.cpp:39
Get access to shares and it&#39;s directories.
Definition: AddonsDirectory.h:34
Represents a file on a share.
Definition: FileItem.h:102
bool Exists(const CURL &url) override
Check for directory existence.
Definition: AddonsDirectory.h:41