34 #include "../filesystem/FileSystem.h" 35 #include "../encoding/CharEncoding.h" 36 #include "../translator/Translator.h" 39 #include <boost/filesystem.hpp> 40 #include <boost/format.hpp> 41 #include <boost/property_tree/json_parser.hpp> 42 #include <boost/property_tree/ptree.hpp> 45 const std::string& file_name)
47 boost::property_tree::ptree doc;
51 boost::format err_msg(
TE_TR(
"The file %1% doesn't exist."));
55 boost::property_tree::json_parser::read_json(file_name, doc);
59 plugin.
name = doc.get<std::string>(
"name");
60 plugin.
display_name = doc.get<std::string>(
"display_name");
61 plugin.
description = doc.get<std::string>(
"description");
62 plugin.
version = doc.get<std::string>(
"version");
63 plugin.
release = doc.get<std::string>(
"release");
64 plugin.
engine = doc.get<std::string>(
"engine");
66 plugin.
license_URL = doc.get<std::string>(
"license_URL");
67 plugin.
site = doc.get<std::string>(
"site");
70 for (
const boost::property_tree::ptree::value_type& v :
71 doc.get_child(
"dependencies"))
72 plugin.
dependencies.push_back(v.second.get_value<std::string>());
73 for(
const boost::property_tree::ptree::value_type& v :
74 doc.get_child(
"resources"))
79 r.second = v.second.get_value<std::string>();
std::string license_description
A brief description about the plugin license.
static bool exists(const std::string &path)
Checks if a given path in UTF-8 exists.
std::string engine
The type of plugin execution engine: C++, JAVA, LUA or any other supported engine.
std::pair< std::string, std::string > Resource
Basic information about a plugin.
std::vector< Resource > resources
The list of resources used by plugin.
#define TE_TR(message)
It marks a string in order to get translated.
General utilities for serializing plugin information.
std::string description
A brief explanation about the plugin.
boost::error_info< struct tag_error_description, std::string > ErrorDescription
The base type for error report messages.
std::string display_name
The plugin name to be displayed in a graphical interface.
std::string name
The plugin name: an internal value used to identify the plugin in the system. Must be a unique value...
std::vector< std::string > dependencies
The list of required plugins in order to launch the plugin.
std::string license_URL
An URL where someone can find more information on the license.
std::string release
The release date of the plugin. This may be used to identify new versions of a given plugin...
TECOREEXPORT PluginInfo JSONPluginInfoSerializer(const std::string &file_name)
A plugin finder that search for plugins in some special directories defined by compile time macros...
std::string site
An URL pointing to the plugin site.
std::string version
The plugin version.
An exception indicating that a given argument is not valid, for instance if a given item already exis...