RStudio Launcher Plugin SDK
1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
|
#include <map>
#include <ostream>
#include <set>
#include <sstream>
#include <utility>
#include <vector>
#include <Optional.hpp>
#include <Error.hpp>
#include <logging/Logger.hpp>
#include <PImpl.hpp>
Go to the source code of this file.
Classes | |
class | rstudio::launcher_plugins::json::Value |
Class which represents a json value. More... | |
class | rstudio::launcher_plugins::json::Object |
Class which represents a specific type of JSON Value: a JSON object. More... | |
class | rstudio::launcher_plugins::json::Object::Member |
Class which represents a single member of a JSON object. More... | |
class | rstudio::launcher_plugins::json::Object::Iterator |
Class which allows iterating over the members of a JSON object. More... | |
class | rstudio::launcher_plugins::json::Array |
Class which represents a JSON array. More... | |
class | rstudio::launcher_plugins::json::Array::Iterator |
Class which allows iterating over the elements of a JSON array. More... | |
struct | rstudio::launcher_plugins::json::detail::is_json_type< T > |
Struct which is either a child class of std::true_type or std::false_type depending on whether T is a JSON type (e.g. Value, Object, Array) or not (e.g. int, bool, string, float, etc.). More... | |
Enumerations | |
enum | rstudio::launcher_plugins::json::Type { ARRAY, BOOL, INTEGER, OBJECT, STRING, REAL, NULL_TYPE, UNKNOWN } |
Enum which represents the type of a json value. More... | |
enum | rstudio::launcher_plugins::json::JsonReadError { SUCCESS = 0, MISSING_MEMBER = 1, INVALID_TYPE = 2 } |
Errors which may occur while reading values from JSON objects. | |
Functions | |
template<typename T > | |
bool | rstudio::launcher_plugins::json::isType (const Value &in_value) |
Checks whether the specified JSON value is of the type specified in the template parameter. More... | |
std::string | rstudio::launcher_plugins::json::typeAsString (Type in_type) |
std::ostream & | rstudio::launcher_plugins::json::operator<< (std::ostream &io_ostream, Type in_type) |
template<typename T > | |
Type | rstudio::launcher_plugins::json::detail::asJsonType (const T &in_object, std::true_type) |
Internal utility function. Gets the type of the object as a JSON type, if the object is a JSON type (e.g. Value, Object, Array). More... | |
template<typename T > | |
Type | rstudio::launcher_plugins::json::detail::asJsonType (const T &in_object, std::false_type) |
Internal utility function. Gets the type of the object as a JSON type, if the object is not a JSON type (e.g. int, bool, string, float, etc.). More... | |
template<typename T > | |
Value | rstudio::launcher_plugins::json::detail::toJsonValue (const T &in_value) |
Internal utility function. Converts a C/C++ value to a JSON value. More... | |
template<typename T > | |
Value | rstudio::launcher_plugins::json::detail::toJsonValue (const Optional< T > &in_value) |
Internal utility function. Converts a C/C++ optional value to a JSON value. More... | |
template<typename T > | |
Value | rstudio::launcher_plugins::json::detail::toJsonValue (const std::vector< T > &in_vector) |
Internal utility function. Converts a vector value to a JSON array value. More... | |
template<typename T > | |
Value | rstudio::launcher_plugins::json::detail::toJsonValue (const std::set< T > &in_set) |
Internal utility function. Converts a set value to a JSON array value. More... | |
template<typename T > | |
Type | rstudio::launcher_plugins::json::asJsonType (const T &in_object) |
Gets the JSON type of the object. More... | |
std::string | rstudio::launcher_plugins::json::typeAsString (const Value &in_value) |
Gets the type of the JSON value as a string. More... | |
template<typename T > | |
Value | rstudio::launcher_plugins::json::toJsonValue (const T &in_value) |
Converts a C/C++ value to a JSON value. More... | |
template<typename T > | |
Array | rstudio::launcher_plugins::json::toJsonArray (const std::vector< T > &in_vector) |
Converts a vector value to a JSON array value. More... | |
template<typename T > | |
Array | rstudio::launcher_plugins::json::toJsonArray (const std::set< T > &in_set) |
Converts a set value to a JSON array value. More... | |
Error | rstudio::launcher_plugins::json::jsonReadError (JsonReadError in_errorCode, const std::string &in_message, const ErrorLocation &in_errorLocation) |
Creates a JSON read error. More... | |
bool | rstudio::launcher_plugins::json::isMissingMemberError (const Error &in_error) |
Checks whether the supplied error is a "missing member" error. More... | |
template<typename T > | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, T &out_value) |
Reads a member from an object. More... | |
template<typename T > | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, Optional< T > &out_value) |
Reads a member from an object. More... | |
template<typename T > | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, std::vector< T > &out_values) |
Reads an array member from an object. More... | |
template<typename T > | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, std::set< T > &out_values) |
Reads an array member from an object. More... | |
template<typename T > | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, Optional< std::vector< T > > &out_values) |
Reads an optional array member from an object. More... | |
template<typename T > | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, Optional< std::set< T > > &out_values) |
Reads an optional array member from an object. More... | |
template<typename T , typename... Args> | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, T &out_value, Args &... io_args) |
Reads multiple members from an object. More... | |
template<typename T , typename... Args> | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, Optional< T > &out_value, Args &... io_args) |
Reads multiple members from an object. More... | |
template<typename T , typename... Args> | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, std::vector< T > &out_values, Args &... io_args) |
Reads multiple members from an object. More... | |
template<typename T , typename... Args> | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, std::set< T > &out_values, Args &... io_args) |
Reads multiple members from an object. More... | |
template<typename T , typename... Args> | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, Optional< std::vector< T > > &out_value, Args &... io_args) |
Reads multiple members from an object. More... | |
template<typename T , typename... Args> | |
Error | rstudio::launcher_plugins::json::readObject (const Object &in_object, const std::string &in_name, Optional< std::set< T > > &out_value, Args &... io_args) |
Reads multiple members from an object. More... | |
JSON classes and utility functions.
|
strong |
Enum which represents the type of a json value.
Represents the type of error to send to the RStudio Launcher.
Enum which represents the type of a Response.
Enum which represents the type of a Request.
The type of resource limit.
Enum which represents the Type of a JobConfig value.
The last enum value, INVALID, must always be the last value and is used to validate the received request.
Types are defined as described in the RStudio Launcher API Documentation. See https://docs.rstudio.com/job-launcher/latest/creating-plugins.html#plugin-messages for more details.
Types are defined as described in the RStudio Launcher API Documentation. See https://docs.rstudio.com/job-launcher/latest/creating-plugins.html#plugin-messages for more details.
Type rstudio::launcher_plugins::json::asJsonType | ( | const T & | in_object | ) |
Gets the JSON type of the object.
T | The C/C++ type of the object. |
in_object | The object for which to retrieve the type. |
Type rstudio::launcher_plugins::json::detail::asJsonType | ( | const T & | in_object, |
std::false_type | |||
) |
Internal utility function. Gets the type of the object as a JSON type, if the object is not a JSON type (e.g. int, bool, string, float, etc.).
T | The type of in_object. |
in_object | The object to get the type of. |
Type rstudio::launcher_plugins::json::detail::asJsonType | ( | const T & | in_object, |
std::true_type | |||
) |
Internal utility function. Gets the type of the object as a JSON type, if the object is a JSON type (e.g. Value, Object, Array).
T | The type of in_object. |
in_object | The object to get the type of. |
bool rstudio::launcher_plugins::json::isMissingMemberError | ( | const Error & | in_error | ) |
Checks whether the supplied error is a "missing member" error.
in_error | The error to check. |
bool rstudio::launcher_plugins::json::isType | ( | const Value & | in_value | ) |
Checks whether the specified JSON value is of the type specified in the template parameter.
T | The type to check the JSON value against. |
in_value | The value of which to check the type. |
Error rstudio::launcher_plugins::json::jsonReadError | ( | JsonReadError | in_errorCode, |
const std::string & | in_message, | ||
const ErrorLocation & | in_errorLocation | ||
) |
Creates a JSON read error.
in_errorCode | The code of the error to create. |
in_message | The message of the error. |
in_errorLocation | The location at which the error occurred. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
Optional< std::set< T > > & | out_value, | ||
Args &... | io_args | ||
) |
Reads multiple members from an object.
T | The type of the values of the array member to read. |
Args | The template parameter pack for the remaining members. |
in_object | The object from which to read the members. |
in_name | The name of the first member to be read. |
out_values | The set of unique values of the array member to be read, if no error occurs. |
io_args | The parameter pack of the remaining members to be read. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
Optional< std::set< T > > & | out_values | ||
) |
Reads an optional array member from an object.
T | The type of values of the array member. |
in_object | The object from which the member should be read. |
in_name | The name of the member to read. |
out_values | The set of unique values of the array member, if no error occurs. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
Optional< std::vector< T > > & | out_value, | ||
Args &... | io_args | ||
) |
Reads multiple members from an object.
T | The type of the values of the array member to read. |
Args | The template parameter pack for the remaining members. |
in_object | The object from which to read the members. |
in_name | The name of the first member to be read. |
out_values | The values of the array member to be read, if no error occurs. |
io_args | The parameter pack of the remaining members to be read. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
Optional< std::vector< T > > & | out_values | ||
) |
Reads an optional array member from an object.
T | The type of values of the array member. |
in_object | The object from which the member should be read. |
in_name | The name of the member to read. |
out_values | The values of the array member, if no error occurs. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
Optional< T > & | out_value | ||
) |
Reads a member from an object.
T | The type of the member. |
in_object | The object from which the member should be read. |
in_name | The name of the member to read. |
out_value | The value of the member, if no error occurs. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
Optional< T > & | out_value, | ||
Args &... | io_args | ||
) |
Reads multiple members from an object.
T | The type of the first member to read. |
Args | The template parameter pack for the remaining members. |
in_object | The object from which to read the members. |
in_name | The name of the first member to be read. |
out_value | The value of the first member to be read, if no error occurs. |
io_args | The parameter pack of the remaining members to be read. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
std::set< T > & | out_values | ||
) |
Reads an array member from an object.
T | The type of values of the array member. |
in_object | The object from which the member should be read. |
in_name | The name of the member to read. |
out_values | The set of unique values of the array member, if no error occurs. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
std::set< T > & | out_values, | ||
Args &... | io_args | ||
) |
Reads multiple members from an object.
T | The type of the values of the array member to read. |
Args | The template parameter pack for the remaining members. |
in_object | The object from which to read the members. |
in_name | The name of the first member to be read. |
out_values | The set of unique values of the array member to be read, if no error occurs. |
io_args | The parameter pack of the remaining members to be read. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
std::vector< T > & | out_values | ||
) |
Reads an array member from an object.
T | The type of values of the array member. |
in_object | The object from which the member should be read. |
in_name | The name of the member to read. |
out_values | The values of the array member, if no error occurs. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
std::vector< T > & | out_values, | ||
Args &... | io_args | ||
) |
Reads multiple members from an object.
T | The type of the values of the array member to read. |
Args | The template parameter pack for the remaining members. |
in_object | The object from which to read the members. |
in_name | The name of the first member to be read. |
out_values | The values of the array member to be read, if no error occurs. |
io_args | The parameter pack of the remaining members to be read. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
T & | out_value | ||
) |
Reads a member from an object.
T | The type of the member. |
in_object | The object from which the member should be read. |
in_name | The name of the member to read. |
out_value | The value of the member, if no error occurs. |
Error rstudio::launcher_plugins::json::readObject | ( | const Object & | in_object, |
const std::string & | in_name, | ||
T & | out_value, | ||
Args &... | io_args | ||
) |
Reads multiple members from an object.
T | The type of the first member to read. |
Args | The template parameter pack for the remaining members. |
in_object | The object from which to read the members. |
in_name | The name of the first member to be read. |
out_value | The value of the first member to be read, if no error occurs. |
io_args | The parameter pack of the remaining members to be read. |
Array rstudio::launcher_plugins::json::toJsonArray | ( | const std::set< T > & | in_set | ) |
Converts a set value to a JSON array value.
T | The C/C++ type of the set elements. |
in_set | The set value to convert to a JSON array value. |
Array rstudio::launcher_plugins::json::toJsonArray | ( | const std::vector< T > & | in_vector | ) |
Converts a vector value to a JSON array value.
T | The C/C++ type of the vector elements. |
in_vector | The vector value to convert to a JSON array value. |
|
inline |
Internal utility function. Converts a C/C++ optional value to a JSON value.
T | The C/C++ type of the value to convert. |
in_value | The optional value to convert to a JSON value. |
|
inline |
Internal utility function. Converts a set value to a JSON array value.
T | The C/C++ type of the set elements. |
in_set | The set value to convert to a JSON array value. |
|
inline |
Internal utility function. Converts a vector value to a JSON array value.
T | The C/C++ type of the vector elements. |
in_vector | The vector value to convert to a JSON array value. |
|
inline |
Internal utility function. Converts a C/C++ value to a JSON value.
T | The C/C++ type of the value to convert. |
in_value | The value to convert to a JSON value. |
|
inline |
Converts a C/C++ value to a JSON value.
T | The C/C++ type of the value to convert. |
in_value | The value to convert to a JSON value. |
|
inline |
Gets the type of the JSON value as a string.
in_value | The JSON value for which retrieve the type as a string. |