libslic3r
Library for generating gcode from 3d models
Public Member Functions | Static Public Member Functions | List of all members
Slic3r::Config Class Reference

#include <Config.hpp>

Public Member Functions

void write_ini (const std::string &file) const
 Write a windows-style opt=value ini file with categories from the configuration store. More...
 
void read_ini (const std::string &file)
 Parse a windows-style opt=value ini file with categories and load the configuration store. More...
 
double getFloat (const t_config_option_key &opt_key, bool create=true)
 
int getInt (const t_config_option_key &opt_key, bool create=true)
 
bool getBool (const t_config_option_key &opt_key, bool create=true)
 
std::string getString (const t_config_option_key &opt_key, bool create=true)
 
template<class T >
T * get_ptr (const t_config_option_key &opt_key, bool create=true)
 Template function to dynamic cast and leave it in pointer form. More...
 
template<class T >
T & get (const t_config_option_key &opt_key, bool create=true)
 
void set (const t_config_option_key &opt_key, const std::string &value)
 Function to parse value from a string to whatever opt_key is. More...
 
void set (const t_config_option_key &opt_key, const char *value)
 
void set (const t_config_option_key &opt_key, const int value)
 
void set (const t_config_option_key &opt_key, const bool value)
 
void set (const t_config_option_key &opt_key, const double value)
 
bool validate ()
 
const DynamicPrintConfigconfig () const
 
bool empty () const
 
void apply (const config_ptr &other)
 Pass-through of apply() More...
 
void apply (const Slic3r::Config &other)
 
void apply (const Slic3r::ConfigBase &other)
 Allow other configs to be applied to this one. More...
 
 Config ()
 Do not use; prefer static factory methods instead. More...
 

Static Public Member Functions

static std::shared_ptr< Confignew_from_defaults ()
 Factory method to construct a Config with all default values loaded. More...
 
static std::shared_ptr< Confignew_from_defaults (std::initializer_list< std::string > init)
 Factory method to construct a Config with specific default values loaded. More...
 
static std::shared_ptr< Confignew_from_defaults (t_config_option_keys init)
 Factory method to construct a Config with specific default values loaded. More...
 
static std::shared_ptr< Confignew_from_cli (const int &argc, const char *argv[])
 Factory method to construct a Config from CLI options. More...
 
static std::shared_ptr< Confignew_from_ini (const std::string &inifile)
 Factory method to construct a Config from an ini file. More...
 

Constructor & Destructor Documentation

◆ Config()

Slic3r::Config::Config ( )

Do not use; prefer static factory methods instead.

Member Function Documentation

◆ apply() [1/3]

void Slic3r::Config::apply ( const config_ptr other)
inline

Pass-through of apply()

◆ apply() [2/3]

void Slic3r::Config::apply ( const Slic3r::Config other)
inline

◆ apply() [3/3]

void Slic3r::Config::apply ( const Slic3r::ConfigBase other)
inline

Allow other configs to be applied to this one.

◆ config()

const DynamicPrintConfig& Slic3r::Config::config ( ) const
inline

◆ empty()

bool Slic3r::Config::empty ( ) const
inline

◆ get()

template<class T >
T& Slic3r::Config::get ( const t_config_option_key opt_key,
bool  create = true 
)
inline

Template function to retrieve and cast in hopefully a slightly nicer format than longwinded dynamic_cast<>

◆ get_ptr()

template<class T >
T* Slic3r::Config::get_ptr ( const t_config_option_key opt_key,
bool  create = true 
)
inline

Template function to dynamic cast and leave it in pointer form.

◆ getBool()

bool Slic3r::Config::getBool ( const t_config_option_key opt_key,
bool  create = true 
)
inline

◆ getFloat()

double Slic3r::Config::getFloat ( const t_config_option_key opt_key,
bool  create = true 
)
inline

◆ getInt()

int Slic3r::Config::getInt ( const t_config_option_key opt_key,
bool  create = true 
)
inline

◆ getString()

std::string Slic3r::Config::getString ( const t_config_option_key opt_key,
bool  create = true 
)
inline

◆ new_from_cli()

static std::shared_ptr<Config> Slic3r::Config::new_from_cli ( const int &  argc,
const char *  argv[] 
)
static

Factory method to construct a Config from CLI options.

◆ new_from_defaults() [1/3]

std::shared_ptr< Config > Slic3r::Config::new_from_defaults ( )
static

Factory method to construct a Config with all default values loaded.

◆ new_from_defaults() [2/3]

std::shared_ptr< Config > Slic3r::Config::new_from_defaults ( std::initializer_list< std::string >  init)
static

Factory method to construct a Config with specific default values loaded.

◆ new_from_defaults() [3/3]

std::shared_ptr< Config > Slic3r::Config::new_from_defaults ( t_config_option_keys  init)
static

Factory method to construct a Config with specific default values loaded.

◆ new_from_ini()

std::shared_ptr< Config > Slic3r::Config::new_from_ini ( const std::string &  inifile)
static

Factory method to construct a Config from an ini file.

◆ read_ini()

void Slic3r::Config::read_ini ( const std::string &  file)

Parse a windows-style opt=value ini file with categories and load the configuration store.

◆ set() [1/5]

void Slic3r::Config::set ( const t_config_option_key opt_key,
const std::string &  value 
)

Function to parse value from a string to whatever opt_key is.

◆ set() [2/5]

void Slic3r::Config::set ( const t_config_option_key opt_key,
const char *  value 
)
inline

◆ set() [3/5]

void Slic3r::Config::set ( const t_config_option_key opt_key,
const int  value 
)

Function to parse value from an integer to whatever opt_key is, if opt_key is a numeric type. This will throw an exception and do nothing if called with an incorrect type.

◆ set() [4/5]

void Slic3r::Config::set ( const t_config_option_key opt_key,
const bool  value 
)

Function to parse value from an boolean to whatever opt_key is, if opt_key is a numeric type. This will throw an exception and do nothing if called with an incorrect type.

◆ set() [5/5]

void Slic3r::Config::set ( const t_config_option_key opt_key,
const double  value 
)

Function to parse value from an integer to whatever opt_key is, if opt_key is a numeric type. This will throw an exception and do nothing if called with an incorrect type.

◆ validate()

bool Slic3r::Config::validate ( )

Method to validate the different configuration options. It will throw InvalidConfigOption exceptions on failure.

◆ write_ini()

void Slic3r::Config::write_ini ( const std::string &  file) const

Write a windows-style opt=value ini file with categories from the configuration store.


The documentation for this class was generated from the following files: