blob: 2fecb5ac11c37b31dc7244625ede52c03e2912b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*
* Copyright (C) 2017-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "PhysicalTopology.h"
#include "games/controllers/ControllerDefinitions.h"
#include "utils/XMLUtils.h"
#include "utils/log.h"
#include <utility>
using namespace KODI;
using namespace GAME;
CPhysicalTopology::CPhysicalTopology(bool bProvidesInput, std::vector<CPhysicalPort> ports)
: m_bProvidesInput(bProvidesInput), m_ports(std::move(ports))
{
}
void CPhysicalTopology::Reset()
{
CPhysicalTopology defaultTopology;
*this = std::move(defaultTopology);
}
bool CPhysicalTopology::Deserialize(const TiXmlElement* pElement)
{
Reset();
if (pElement == nullptr)
return false;
m_bProvidesInput = (XMLUtils::GetAttribute(pElement, LAYOUT_XML_ATTR_PROVIDES_INPUT) != "false");
for (const TiXmlElement* pChild = pElement->FirstChildElement(); pChild != nullptr;
pChild = pChild->NextSiblingElement())
{
if (pChild->ValueStr() == LAYOUT_XML_ELM_PORT)
{
CPhysicalPort port;
if (port.Deserialize(pChild))
m_ports.emplace_back(std::move(port));
}
else
{
CLog::Log(LOGDEBUG, "Unknown physical topology tag: <{}>", pChild->ValueStr());
}
}
return true;
}
|