OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::anonymous_namespace{PluginConfig.cpp} Namespace Reference

Functions

std::string string_field (const nlohmann::json &entry, const char *key)
bool is_recognized_entry (const nlohmann::json &entry, PluginCapabilityId &id)
CapabilityConfigEntry decode_entry (const PluginCapabilityId &id, const nlohmann::json &entry)
std::string running_plugin_version (const std::string &plugin_key)
const PresetBundle * active_preset_bundle ()
PluginCapabilityId capability_identity (const PluginCapabilityInterface &capability, const char *api_name)

Variables

constexpr const char * KEY_PLUGIN = "plugin_key"
constexpr const char * KEY_CAPABILITY = "capability"
constexpr const char * KEY_TYPE = "capability_type"
constexpr const char * KEY_VERSION = "plugin_version"
constexpr const char * KEY_CAP_CONFIG = "cap_config"

Function Documentation

◆ active_preset_bundle()

const PresetBundle * Slic3r::anonymous_namespace{PluginConfig.cpp}::active_preset_bundle ( )
89{
90 const auto* app = dynamic_cast<const GUI::GUI_App*>(wxApp::GetInstance());
91 return app == nullptr ? nullptr : app->preset_bundle;
92}
Definition GUI_App.hpp:255

References active_preset_bundle().

Referenced by active_preset_bundle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ capability_identity()

PluginCapabilityId Slic3r::anonymous_namespace{PluginConfig.cpp}::capability_identity ( const PluginCapabilityInterface & capability,
const char * api_name )
98{
99 const PluginCapabilityId id = capability.identity();
100 if (id.empty())
101 throw std::runtime_error(std::string(api_name) + "() is only available on a capability loaded by the plugin host");
102
103 return id;
104}
PluginCapabilityId identity() const
Definition PythonPluginInterface.hpp:189
bool empty(const BoundingBoxBase< PointType, PointsType > &bb)
Definition BoundingBox.hpp:273
Definition PythonPluginInterface.hpp:20

References capability_identity(), Slic3r::empty(), and Slic3r::PluginCapabilityInterface::identity().

Referenced by capability_identity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decode_entry()

CapabilityConfigEntry Slic3r::anonymous_namespace{PluginConfig.cpp}::decode_entry ( const PluginCapabilityId & id,
const nlohmann::json & entry )
67{
69 result.id = id;
71 const auto cap_it = entry.find(KEY_CAP_CONFIG);
72 result.config = cap_it != entry.end() ? *cap_it : nlohmann::json::object();
73 return result;
74}
constexpr const char * KEY_VERSION
Definition PluginConfig.cpp:46
std::string string_field(const nlohmann::json &entry, const char *key)
Definition PluginConfig.cpp:49
constexpr const char * KEY_CAP_CONFIG
Definition PluginConfig.cpp:47
PluginCapabilityId id
Definition PluginConfig.hpp:23
std::string plugin_version
Definition PluginConfig.hpp:24
nlohmann::json config
Definition PluginConfig.hpp:25
Definition PluginConfig.hpp:22

References Slic3r::CapabilityConfigEntry::config, decode_entry(), Slic3r::CapabilityConfigEntry::id, KEY_CAP_CONFIG, KEY_VERSION, Slic3r::CapabilityConfigEntry::plugin_version, and string_field().

Referenced by decode_entry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_recognized_entry()

bool Slic3r::anonymous_namespace{PluginConfig.cpp}::is_recognized_entry ( const nlohmann::json & entry,
PluginCapabilityId & id )
56{
57 if (!entry.is_object())
58 return false;
59
60 id.plugin_key = string_field(entry, KEY_PLUGIN);
61 id.name = string_field(entry, KEY_CAPABILITY);
63 return !id.empty();
64}
constexpr const char * KEY_PLUGIN
Definition PluginConfig.cpp:43
constexpr const char * KEY_TYPE
Definition PluginConfig.cpp:45
constexpr const char * KEY_CAPABILITY
Definition PluginConfig.cpp:44
PluginCapabilityType plugin_capability_type_from_string(std::string_view value)
Definition PythonPluginInterface.hpp:72

References is_recognized_entry(), KEY_CAPABILITY, KEY_PLUGIN, KEY_TYPE, Slic3r::plugin_capability_type_from_string(), and string_field().

Referenced by is_recognized_entry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ running_plugin_version()

std::string Slic3r::anonymous_namespace{PluginConfig.cpp}::running_plugin_version ( const std::string & plugin_key)
79{
80 PluginDescriptor descriptor;
81 if (!PluginManager::instance().try_get_valid_plugin_descriptor(plugin_key, descriptor))
82 return {};
83 return descriptor.installed_version.empty() ? descriptor.version : descriptor.installed_version;
84}
static PluginManager & instance()
Definition PluginManager.cpp:74
Definition PluginDescriptor.hpp:53
std::string version
Definition PluginDescriptor.hpp:58
std::string installed_version
Definition PluginDescriptor.hpp:60

References Slic3r::PluginDescriptor::installed_version, Slic3r::PluginManager::instance(), running_plugin_version(), and Slic3r::PluginDescriptor::version.

Referenced by running_plugin_version().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ string_field()

std::string Slic3r::anonymous_namespace{PluginConfig.cpp}::string_field ( const nlohmann::json & entry,
const char * key )
50{
51 const auto it = entry.find(key);
52 return it != entry.end() && it->is_string() ? it->get<std::string>() : std::string();
53}
STL namespace.

References string_field().

Referenced by decode_entry(), is_recognized_entry(), and string_field().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ KEY_CAP_CONFIG

const char* Slic3r::anonymous_namespace{PluginConfig.cpp}::KEY_CAP_CONFIG = "cap_config"
constexpr

Referenced by decode_entry().

◆ KEY_CAPABILITY

const char* Slic3r::anonymous_namespace{PluginConfig.cpp}::KEY_CAPABILITY = "capability"
constexpr

Referenced by is_recognized_entry().

◆ KEY_PLUGIN

const char* Slic3r::anonymous_namespace{PluginConfig.cpp}::KEY_PLUGIN = "plugin_key"
constexpr

Referenced by is_recognized_entry().

◆ KEY_TYPE

const char* Slic3r::anonymous_namespace{PluginConfig.cpp}::KEY_TYPE = "capability_type"
constexpr

Referenced by is_recognized_entry().

◆ KEY_VERSION

const char* Slic3r::anonymous_namespace{PluginConfig.cpp}::KEY_VERSION = "plugin_version"
constexpr

Referenced by decode_entry().