summaryrefslogtreecommitdiffstats
path: root/xbmc/guilib/guiinfo/GUIInfoBool.cpp
blob: 2f6b4f9dc69acceaa7661ea9d7471d0bbba173a5 (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
/*
 *  Copyright (C) 2005-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 "guilib/guiinfo/GUIInfoBool.h"

#include "GUIInfoManager.h"
#include "ServiceBroker.h"
#include "guilib/GUIComponent.h"

using namespace KODI::GUILIB::GUIINFO;

CGUIInfoBool::CGUIInfoBool(bool value)
{
  m_value = value;
}

CGUIInfoBool::~CGUIInfoBool() = default;

void CGUIInfoBool::Parse(const std::string &expression, int context)
{
  if (expression == "true")
    m_value = true;
  else if (expression == "false")
    m_value = false;
  else
  {
    m_info = CServiceBroker::GetGUI()->GetInfoManager().Register(expression, context);
    Update(context);
  }
}

void CGUIInfoBool::Update(int contextWindow, const CGUIListItem* item /*= nullptr*/)
{
  if (m_info)
    m_value = m_info->Get(contextWindow, item);
}