RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
AbstractMain.hpp
1 /*
2  * AbstractMain.hpp
3  *
4  * Copyright (C) 2019-20 by RStudio, PBC
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
7  * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
8  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
12  * Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
15  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18  *
19  */
20 
21 #ifndef LAUNCHER_PLUGINS_ABSTRACT_MAIN_HPP
22 #define LAUNCHER_PLUGINS_ABSTRACT_MAIN_HPP
23 
24 #include <Noncopyable.hpp>
25 
26 #include <memory>
27 #include <system/FilePath.hpp>
28 
29 #include <api/AbstractPluginApi.hpp>
30 #include <comms/AbstractLauncherCommunicator.hpp>
31 
32 namespace rstudio {
33 namespace launcher_plugins {
34 
38 class AbstractMain : public Noncopyable
39 {
40 public:
44  virtual ~AbstractMain() = default;
45 
54  int run(int in_argCount, char** in_argList);
55 
56 protected:
60  AbstractMain();
61 
62 private:
71  virtual std::shared_ptr<api::AbstractPluginApi> createLauncherPluginApi(
72  std::shared_ptr<comms::AbstractLauncherCommunicator> in_launcherCommunicator) const = 0;
73 
79  virtual system::FilePath getConfigFile() const;
80 
86  virtual std::string getPluginName() const = 0;
87 
93  virtual std::string getProgramId() const;
94 
100  virtual Error initialize() = 0;
101 
102  // Private implementation of abstract main.
103  PRIVATE_IMPL_SHARED(m_abstractMainImpl);
104 };
105 
106 } // namespace launcher_plugins
107 } // namespace rstudio
108 
109 #endif
rstudio::launcher_plugins::system::FilePath
Class which represents a path on the system. May be any type of file (e.g. directory,...
Definition: FilePath.hpp:77
rstudio::launcher_plugins::AbstractMain
Base class for the PluginMain class, which runs the plugin.
Definition: AbstractMain.hpp:38
rstudio::launcher_plugins::AbstractMain::~AbstractMain
virtual ~AbstractMain()=default
Default destructor.
rstudio::launcher_plugins::AbstractMain::AbstractMain
AbstractMain()
Default Constructor.
rstudio::launcher_plugins::Error
Class which represents an error.
Definition: Error.hpp:174
rstudio::launcher_plugins::AbstractMain::run
int run(int in_argCount, char **in_argList)
Runs the plugin.
rstudio::launcher_plugins::Noncopyable
Class which can be inherited from to disallow copying of its child classes.
Definition: Noncopyable.hpp:34