[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / interfaces / generic / ILanguageInvoker.cpp
blobdf1193ed25322839e848ab18f8aed05deb9ce248
1 /*
2 * Copyright (C) 2015-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.
7 */
9 #include "ILanguageInvoker.h"
11 #include "interfaces/generic/ILanguageInvocationHandler.h"
13 #include <string>
14 #include <vector>
16 ILanguageInvoker::ILanguageInvoker(ILanguageInvocationHandler *invocationHandler)
17 : m_id(-1),
18 m_state(InvokerStateUninitialized),
19 m_invocationHandler(invocationHandler)
20 { }
22 ILanguageInvoker::~ILanguageInvoker() = default;
24 bool ILanguageInvoker::Execute(const std::string &script, const std::vector<std::string> &arguments /* = std::vector<std::string>() */)
26 if (m_invocationHandler)
27 m_invocationHandler->OnScriptStarted(this);
29 return execute(script, arguments);
32 bool ILanguageInvoker::Stop(bool abort /* = false */)
34 return stop(abort);
37 bool ILanguageInvoker::IsActive() const
39 return GetState() > InvokerStateUninitialized && GetState() < InvokerStateScriptDone;
42 bool ILanguageInvoker::IsRunning() const
44 return GetState() == InvokerStateRunning;
47 bool ILanguageInvoker::IsStopping() const
49 return GetState() == InvokerStateStopping;
52 void ILanguageInvoker::pulseGlobalEvent()
54 if (m_invocationHandler)
55 m_invocationHandler->PulseGlobalEvent();
58 bool ILanguageInvoker::onExecutionInitialized()
60 if (m_invocationHandler == NULL)
61 return false;
63 return m_invocationHandler->OnScriptInitialized(this);
66 void ILanguageInvoker::AbortNotification()
68 if (m_invocationHandler)
69 m_invocationHandler->NotifyScriptAborting(this);
72 void ILanguageInvoker::onExecutionFailed()
74 if (m_invocationHandler)
75 m_invocationHandler->OnExecutionEnded(this);
78 void ILanguageInvoker::onExecutionDone()
80 if (m_invocationHandler)
81 m_invocationHandler->OnExecutionEnded(this);
84 void ILanguageInvoker::onExecutionFinalized()
86 if (m_invocationHandler)
87 m_invocationHandler->OnScriptFinalized(this);
90 void ILanguageInvoker::setState(InvokerState state)
92 if (state <= m_state)
93 return;
95 m_state = state;