mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 04:15:51 +08:00
Preset::config() returns a weak reference to the shared configuration.
This commit is contained in:
parent
ef37a748ff
commit
76be75431b
@ -44,6 +44,11 @@ Slic3r::Config Preset::dirty_config() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config_ref Preset::config() {
|
||||||
|
std::weak_ptr<Slic3r::Config> result { this->_dirty_config };
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
config_ptr Preset::load_config() {
|
config_ptr Preset::load_config() {
|
||||||
if (this->loaded()) return this->_dirty_config;
|
if (this->loaded()) return this->_dirty_config;
|
||||||
|
|
||||||
|
@ -78,6 +78,9 @@ public:
|
|||||||
/// Retrieve a copy of the loaded version of the configuration with any options applied.
|
/// Retrieve a copy of the loaded version of the configuration with any options applied.
|
||||||
Slic3r::Config dirty_config();
|
Slic3r::Config dirty_config();
|
||||||
|
|
||||||
|
/// Retrieve a shared (cast through a weak) pointer.
|
||||||
|
config_ref config();
|
||||||
|
|
||||||
/// Pass-through to Slic3r::Config, returns whether or not a config was loaded.
|
/// Pass-through to Slic3r::Config, returns whether or not a config was loaded.
|
||||||
bool loaded() { return !this->_config->empty(); }
|
bool loaded() { return !this->_config->empty(); }
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ public:
|
|||||||
|
|
||||||
class Config;
|
class Config;
|
||||||
using config_ptr = std::shared_ptr<Config>;
|
using config_ptr = std::shared_ptr<Config>;
|
||||||
|
using config_ref = std::weak_ptr<Config>;
|
||||||
|
|
||||||
class Config {
|
class Config {
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user