[Test] Added tests for CUtil::SplitParams
[xbmc.git] / xbmc / guilib / TextureBundle.cpp
blob7e7417973a0979c171b13108e1df79e00de063b9
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "TextureBundle.h"
11 #include "guilib/TextureBundleXBT.h"
13 class CTexture;
15 CTextureBundle::CTextureBundle() : m_tbXBT{false}, m_useXBT{false}
19 CTextureBundle::CTextureBundle(bool useXBT) : m_tbXBT{useXBT}, m_useXBT{useXBT}
23 bool CTextureBundle::HasFile(const std::string& Filename)
25 if (m_useXBT)
27 return m_tbXBT.HasFile(Filename);
30 if (m_tbXBT.HasFile(Filename))
32 m_useXBT = true;
33 return true;
36 return false;
39 std::vector<std::string> CTextureBundle::GetTexturesFromPath(const std::string& path)
41 if (m_useXBT)
42 return m_tbXBT.GetTexturesFromPath(path);
43 else
44 return {};
47 std::optional<CTextureBundleXBT::Texture> CTextureBundle::LoadTexture(const std::string& filename)
49 if (m_useXBT)
50 return m_tbXBT.LoadTexture(filename);
51 else
52 return {};
55 std::optional<CTextureBundleXBT::Animation> CTextureBundle::LoadAnim(const std::string& filename)
57 if (m_useXBT)
58 return m_tbXBT.LoadAnim(filename);
59 else
60 return {};
63 void CTextureBundle::Close()
65 m_tbXBT.CloseBundle();
68 void CTextureBundle::SetThemeBundle(bool themeBundle)
70 m_tbXBT.SetThemeBundle(themeBundle);
73 std::string CTextureBundle::Normalize(std::string name)
75 return CTextureBundleXBT::Normalize(std::move(name));