diff options
Diffstat (limited to 'xbmc/addons/PluginSource.cpp')
| -rw-r--r-- | xbmc/addons/PluginSource.cpp | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/xbmc/addons/PluginSource.cpp b/xbmc/addons/PluginSource.cpp deleted file mode 100644 index a5729cf..0000000 --- a/xbmc/addons/PluginSource.cpp +++ /dev/null | |||
| @@ -1,96 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2013 Team XBMC | ||
| 3 | * http://xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | #include "PluginSource.h" | ||
| 21 | #include "AddonManager.h" | ||
| 22 | #include "utils/StringUtils.h" | ||
| 23 | |||
| 24 | using namespace std; | ||
| 25 | |||
| 26 | namespace ADDON | ||
| 27 | { | ||
| 28 | |||
| 29 | CPluginSource::CPluginSource(const AddonProps &props) | ||
| 30 | : CAddon(props) | ||
| 31 | { | ||
| 32 | std::string provides; | ||
| 33 | InfoMap::const_iterator i = Props().extrainfo.find("provides"); | ||
| 34 | if (i != Props().extrainfo.end()) | ||
| 35 | provides = i->second; | ||
| 36 | SetProvides(provides); | ||
| 37 | } | ||
| 38 | |||
| 39 | CPluginSource::CPluginSource(const cp_extension_t *ext) | ||
| 40 | : CAddon(ext) | ||
| 41 | { | ||
| 42 | std::string provides; | ||
| 43 | if (ext) | ||
| 44 | { | ||
| 45 | provides = CAddonMgr::Get().GetExtValue(ext->configuration, "provides"); | ||
| 46 | if (!provides.empty()) | ||
| 47 | Props().extrainfo.insert(make_pair("provides", provides)); | ||
| 48 | } | ||
| 49 | SetProvides(provides); | ||
| 50 | } | ||
| 51 | |||
| 52 | AddonPtr CPluginSource::Clone() const | ||
| 53 | { | ||
| 54 | return AddonPtr(new CPluginSource(*this)); | ||
| 55 | } | ||
| 56 | |||
| 57 | void CPluginSource::SetProvides(const std::string &content) | ||
| 58 | { | ||
| 59 | if (!content.empty()) | ||
| 60 | { | ||
| 61 | vector<string> provides = StringUtils::Split(content, ' '); | ||
| 62 | for (vector<string>::const_iterator i = provides.begin(); i != provides.end(); ++i) | ||
| 63 | { | ||
| 64 | Content content = Translate(*i); | ||
| 65 | if (content != UNKNOWN) | ||
| 66 | m_providedContent.insert(content); | ||
| 67 | } | ||
| 68 | } | ||
| 69 | if (Type() == ADDON_SCRIPT && m_providedContent.empty()) | ||
| 70 | m_providedContent.insert(EXECUTABLE); | ||
| 71 | } | ||
| 72 | |||
| 73 | CPluginSource::Content CPluginSource::Translate(const std::string &content) | ||
| 74 | { | ||
| 75 | if (content == "audio") | ||
| 76 | return CPluginSource::AUDIO; | ||
| 77 | else if (content == "image") | ||
| 78 | return CPluginSource::IMAGE; | ||
| 79 | else if (content == "executable") | ||
| 80 | return CPluginSource::EXECUTABLE; | ||
| 81 | else if (content == "video") | ||
| 82 | return CPluginSource::VIDEO; | ||
| 83 | else | ||
| 84 | return CPluginSource::UNKNOWN; | ||
| 85 | } | ||
| 86 | |||
| 87 | bool CPluginSource::IsType(TYPE type) const | ||
| 88 | { | ||
| 89 | return ((type == ADDON_VIDEO && Provides(VIDEO)) | ||
| 90 | || (type == ADDON_AUDIO && Provides(AUDIO)) | ||
| 91 | || (type == ADDON_IMAGE && Provides(IMAGE)) | ||
| 92 | || (type == ADDON_EXECUTABLE && Provides(EXECUTABLE))); | ||
| 93 | } | ||
| 94 | |||
| 95 | } /*namespace ADDON*/ | ||
| 96 | |||
