2 * Copyright (C) 2005-2021 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.
9 #include "PVRCachedImage.h"
11 #include "TextureDatabase.h"
12 #include "utils/StringUtils.h"
13 #include "utils/log.h"
17 CPVRCachedImage::CPVRCachedImage(const std::string
& owner
) : m_owner(owner
)
21 CPVRCachedImage::CPVRCachedImage(const std::string
& clientImage
, const std::string
& owner
)
22 : m_clientImage(clientImage
), m_owner(owner
)
27 bool CPVRCachedImage::operator==(const CPVRCachedImage
& right
) const
29 return (this == &right
) || (m_clientImage
== right
.m_clientImage
&&
30 m_localImage
== right
.m_localImage
&& m_owner
== right
.m_owner
);
33 bool CPVRCachedImage::operator!=(const CPVRCachedImage
& right
) const
35 return !(*this == right
);
38 void CPVRCachedImage::SetClientImage(const std::string
& image
)
40 if (StringUtils::StartsWith(image
, "image://"))
42 CLog::LogF(LOGERROR
, "Not allowed to call this method with an image URL");
48 CLog::LogF(LOGERROR
, "Empty owner");
52 m_clientImage
= image
;
56 void CPVRCachedImage::SetOwner(const std::string
& owner
)
65 void CPVRCachedImage::UpdateLocalImage()
67 if (m_clientImage
.empty())
70 m_localImage
= CTextureUtils::GetWrappedImageURL(m_clientImage
, m_owner
);