kodi
Resource.h
1 /*
2  * Copyright (C) 2014-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 "addons/Addon.h"
12 #include "utils/URIUtils.h"
13 
14 #include <memory>
15 
16 namespace ADDON
17 {
18 
19 class CResource : public CAddon
20 {
21 public:
22  ~CResource() override = default;
23 
24  virtual bool IsAllowed(const std::string &file) const = 0;
25 
26  virtual std::string GetFullPath(const std::string &filePath) const
27  {
28  return URIUtils::AddFileToFolder(GetResourcePath(), filePath);
29  }
30 
31 protected:
32  explicit CResource(const AddonInfoPtr& addonInfo, AddonType addonType)
33  : CAddon(addonInfo, addonType)
34  {
35  }
36 
37  std::string GetResourcePath() const
38  {
39  return URIUtils::AddFileToFolder(Path(), "resources");
40  }
41 };
42 
43 }
Definition: Resource.h:19
Definition: Addon.cpp:39
Definition: Addon.h:34