mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-13 02:19:01 +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;
|
||||
}
|
||||
|
||||
config_ref Preset::config() {
|
||||
std::weak_ptr<Slic3r::Config> result { this->_dirty_config };
|
||||
return result;
|
||||
}
|
||||
|
||||
config_ptr Preset::load_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.
|
||||
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.
|
||||
bool loaded() { return !this->_config->empty(); }
|
||||
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
|
||||
class Config;
|
||||
using config_ptr = std::shared_ptr<Config>;
|
||||
using config_ref = std::weak_ptr<Config>;
|
||||
|
||||
class Config {
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user