Debian Codegraph @

xbmc/favourites/FavouritesURL.h

raw
1 /*
2 * Copyright (C) 2012-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 #pragma once
10
11 #include "utils/ExecString.h"
12
13 #include <string>
14 #include <vector>
15
16 class CFileItem;
17
18 class CFavouritesURL
19 {
20 public:
21 enum class Action
22 {
23 UNKNOWN,
24 ACTIVATE_WINDOW,
25 PLAY_MEDIA,
26 SHOW_PICTURE,
27 RUN_SCRIPT,
28 RUN_ADDON,
29 START_ANDROID_ACTIVITY,
30 };
31
32 explicit CFavouritesURL(const std::string& favouritesURL);
33 explicit CFavouritesURL(const CExecString& execString);
34 CFavouritesURL(Action action, const std::vector<std::string>& params);
35 CFavouritesURL(const CFileItem& item, int contextWindow);
36
37 virtual ~CFavouritesURL() = default;
38
39 std::string GetURL() const { return m_path; }
40
41 bool IsValid() const { return m_valid && m_exec.IsValid(); }
42
43 bool IsDir() const { return m_isDir; }
44
45 std::string GetExecString() const { return m_exec.GetExecString(); }
46 Action GetAction() const { return m_action; }
47 std::vector<std::string> GetParams() const { return m_exec.GetParams(); }
48 std::string GetTarget() const { return m_target; }
49 int GetWindowID() const { return m_windowId; }
50 std::string GetActionLabel() const { return m_actionLabel; }
51 std::string GetProviderLabel() const { return m_providerLabel; }
52
53 private:
54 bool Parse(CFavouritesURL::Action action, const std::vector<std::string>& params);
55
56 CExecString m_exec;
57
58 bool m_valid{false};
59 std::string m_path;
60 Action m_action{Action::UNKNOWN};
61 std::string m_target;
62 int m_windowId{-1};
63 bool m_isDir{false};
64 std::string m_actionLabel;
65 std::string m_providerLabel;
66 };