summaryrefslogtreecommitdiffstats
path: root/xbmc/guilib/guiinfo/GUIInfoBool.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--xbmc/guilib/guiinfo/GUIInfoBool.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/xbmc/guilib/guiinfo/GUIInfoBool.cpp b/xbmc/guilib/guiinfo/GUIInfoBool.cpp
new file mode 100644
index 0000000..2f6b4f9
--- /dev/null
+++ b/xbmc/guilib/guiinfo/GUIInfoBool.cpp
@@ -0,0 +1,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);
+}