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.
9 #include "AddonExtensions.h"
11 #include "utils/StringUtils.h"
13 using namespace ADDON
;
15 bool SExtValue::asBoolean() const
17 return StringUtils::EqualsNoCase(str
, "true");
20 const SExtValue
CAddonExtensions::GetValue(const std::string
& id
) const
22 for (const auto& values
: m_values
)
24 for (const auto& value
: values
.second
)
26 if (value
.first
== id
)
33 const EXT_VALUES
& CAddonExtensions::GetValues() const
38 const CAddonExtensions
* CAddonExtensions::GetElement(const std::string
& id
) const
40 for (const auto& child
: m_children
)
42 if (child
.first
== id
)
49 const EXT_ELEMENTS
CAddonExtensions::GetElements(const std::string
& id
) const
54 EXT_ELEMENTS children
;
55 for (const auto& child
: m_children
)
57 if (child
.first
== id
)
58 children
.emplace_back(child
.first
, child
.second
);
63 void CAddonExtensions::Insert(const std::string
& id
, const std::string
& value
)
66 extension
.emplace_back(id
, SExtValue(value
));
67 m_values
.emplace_back(id
, extension
);