2014-05-06 08:07:18 +00:00
|
|
|
#ifndef slic3r_PlaceholderParser_hpp_
|
|
|
|
#define slic3r_PlaceholderParser_hpp_
|
|
|
|
|
2015-12-07 23:39:54 +00:00
|
|
|
#include "libslic3r.h"
|
2014-05-06 08:07:18 +00:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2015-05-02 19:43:22 +00:00
|
|
|
#include <vector>
|
2014-06-13 13:32:11 +00:00
|
|
|
#include "PrintConfig.hpp"
|
2014-05-06 08:07:18 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
|
|
|
class PlaceholderParser
|
|
|
|
{
|
2017-05-03 16:28:22 +00:00
|
|
|
public:
|
2017-07-31 13:42:55 +00:00
|
|
|
std::map<std::string, std::string> m_single;
|
|
|
|
std::map<std::string, std::vector<std::string>> m_multiple;
|
2015-07-01 17:35:22 +00:00
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
PlaceholderParser();
|
2014-11-09 19:41:27 +00:00
|
|
|
void update_timestamp();
|
2015-12-07 18:39:49 +00:00
|
|
|
void apply_config(const DynamicPrintConfig &config);
|
2015-07-01 15:56:38 +00:00
|
|
|
void apply_env_variables();
|
2014-11-09 19:41:27 +00:00
|
|
|
void set(const std::string &key, const std::string &value);
|
2015-05-02 19:43:22 +00:00
|
|
|
void set(const std::string &key, int value);
|
2017-05-03 16:28:22 +00:00
|
|
|
void set(const std::string &key, unsigned int value);
|
|
|
|
void set(const std::string &key, double value);
|
2015-07-01 17:35:22 +00:00
|
|
|
void set(const std::string &key, std::vector<std::string> values);
|
2017-07-31 13:42:55 +00:00
|
|
|
std::string process(std::string str, unsigned int current_extruder_id) const;
|
2015-07-01 17:35:22 +00:00
|
|
|
|
2017-05-03 16:28:22 +00:00
|
|
|
private:
|
2015-07-01 17:35:22 +00:00
|
|
|
bool find_and_replace(std::string &source, std::string const &find, std::string const &replace) const;
|
2014-05-06 08:07:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|