mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-03 16:50:47 +08:00
Added template function to make getting references to ConfigOptions easier to write.
This commit is contained in:
parent
e4aa624ccb
commit
65a1d57d05
@ -16,6 +16,13 @@ public:
|
||||
|
||||
void write_ini(const std::string& file) { save(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
|
||||
|
Loading…
x
Reference in New Issue
Block a user