2 * Copyright (C) 2005-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.
19 * Class containing vector of condition->(action/navigation route) and handling its execution.
25 * Class which defines an executable action
27 class CExecutableAction
31 * Executable action constructor (without conditional execution)
32 * @param action - The action to be executed
34 explicit CExecutableAction(const std::string
& action
);
36 * Executable action constructor (providing the condition and the action)
37 * @param condition - The condition that dictates the action execution
38 * @param action - The actual action
40 CExecutableAction(const std::string
& condition
, const std::string
& action
);
43 * Get the condition of this executable action (may be empty)
44 * @return condition - The condition that dictates the action execution (or an empty string)
46 std::string
GetCondition() const;
49 * Checks if the executable action has any condition
50 * @return true if the executable action has any condition, else false
52 bool HasCondition() const;
55 * Get the action string of this executable action
56 * @return action - The action string
58 std::string
GetAction() const;
61 * Sets/Replaces the action string of this executable action
62 * @param action - The action string
64 void SetAction(const std::string
& action
);
66 bool operator==(const CExecutableAction
& right
) const
68 return m_condition
== right
.m_condition
&& m_action
== right
.m_action
;
73 * Executable action default constructor
75 CExecutableAction() = delete;
76 /* The condition that dictates the action execution */
77 std::string m_condition
;
78 /* The actual action */
82 CGUIAction() = default;
83 explicit CGUIAction(int controlID
);
85 * Execute actions without specifying any target control or parent control. Action will use the default focused control.
87 bool ExecuteActions() const;
89 * Execute actions (no navigation paths); if action is paired with condition - evaluate condition first
91 bool ExecuteActions(int controlID
,
93 const std::shared_ptr
<CGUIListItem
>& item
= nullptr) const;
95 * Check if there are any conditional actions
97 bool HasConditionalActions() const;
99 * Check if there is any action that meet its condition
101 bool HasActionsMeetingCondition() const;
103 * Check if there is any action
105 bool HasAnyActions() const;
107 * Get the total number of actions
109 size_t GetActionCount() const;
111 * Get navigation route that meet its conditions first
113 int GetNavigation() const;
115 * Set navigation route
117 void SetNavigation(int id
);
119 * Configure CGUIAction to send threaded messages
121 void EnableSendThreadMessageMode();
123 * Add an executable action to the CGUIAction container
125 void Append(const CExecutableAction
& action
);
127 * Prune any executable actions stored in the CGUIAction
131 bool operator==(const CGUIAction
& rhs
) const
133 return m_actions
== rhs
.m_actions
&& m_sendThreadMessages
== rhs
.m_sendThreadMessages
;
137 std::vector
<CExecutableAction
> m_actions
;
138 bool m_sendThreadMessages
= false;