Debian Codegraph @

xbmc/guilib/guiinfo/GUIInfoBool.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #include "guilib/guiinfo/GUIInfoBool.h"
10
11 #include "GUIInfoManager.h"
12 #include "ServiceBroker.h"
13 #include "guilib/GUIComponent.h"
14
15 using namespace KODI::GUILIB::GUIINFO;
16
17 CGUIInfoBool::CGUIInfoBool(bool value)
18 {
19 m_value = value;
20 }
21
22 CGUIInfoBool::~CGUIInfoBool() = default;
23
24 void CGUIInfoBool::Parse(const std::string &expression, int context)
25 {
26 if (expression == "true")
27 m_value = true;
28 else if (expression == "false")
29 m_value = false;
30 else
31 {
32 m_info = CServiceBroker::GetGUI()->GetInfoManager().Register(expression, context);
33 Update(context);
34 }
35 }
36
37 void CGUIInfoBool::Update(int contextWindow, const CGUIListItem* item /*= nullptr*/)
38 {
39 if (m_info)
40 m_value = m_info->Get(contextWindow, item);
41 }