[Test] Added tests for CUtil::SplitParams
[xbmc.git] / xbmc / favourites / FavouritesURL.h
blob7261484632a0867d179f004fe9ba40d539f11add
1 /*
2 * Copyright (C) 2012-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 #pragma once
11 #include "utils/ExecString.h"
13 #include <string>
14 #include <vector>
16 class CFileItem;
18 class CFavouritesURL
20 public:
21 enum class Action
23 UNKNOWN,
24 ACTIVATE_WINDOW,
25 PLAY_MEDIA,
26 SHOW_PICTURE,
27 RUN_SCRIPT,
28 RUN_ADDON,
29 START_ANDROID_ACTIVITY,
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);
37 virtual ~CFavouritesURL() = default;
39 std::string GetURL() const { return m_path; }
41 bool IsValid() const { return m_valid && m_exec.IsValid(); }
43 bool IsDir() const { return m_isDir; }
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; }
53 private:
54 bool Parse(CFavouritesURL::Action action, const std::vector<std::string>& params);
56 CExecString m_exec;
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;