mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 19:50:37 +08:00
Added template function to make getting references to ConfigOptions easier to write.
This commit is contained in:
parent
4860d63b01
commit
dc08bcafae
@ -16,6 +16,13 @@ public:
|
|||||||
|
|
||||||
void write_ini(const std::string& file) { save(file); }
|
void write_ini(const std::string& file) { save(file); }
|
||||||
void read_ini(const std::string& file) { load(file); }
|
void read_ini(const std::string& file) { load(file); }
|
||||||
|
|
||||||
|
/// Template function to retrieve and cast in hopefully a slightly nicer
|
||||||
|
/// format than longwinded dynamic_cast<>
|
||||||
|
template <class T>
|
||||||
|
T& get(const t_config_option_key& opt_key, bool create=false) {
|
||||||
|
return *(dynamic_cast<T*>(this->optptr(opt_key, create)));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
Loading…
x
Reference in New Issue
Block a user