2014-05-06 08:07:18 +00:00
|
|
|
#ifndef slic3r_PlaceholderParser_hpp_
|
|
|
|
#define slic3r_PlaceholderParser_hpp_
|
|
|
|
|
|
|
|
|
|
|
|
#include <myinit.h>
|
|
|
|
#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 {
|
|
|
|
|
2015-07-01 17:35:22 +00:00
|
|
|
typedef std::map<std::string, std::string> t_strstr_map;
|
|
|
|
typedef std::map<std::string, std::vector<std::string> > t_strstrs_map;
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
class PlaceholderParser
|
|
|
|
{
|
|
|
|
public:
|
2015-07-01 17:35:22 +00:00
|
|
|
t_strstr_map _single;
|
|
|
|
t_strstrs_map _multiple;
|
|
|
|
|
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);
|
2015-07-01 17:35:22 +00:00
|
|
|
void set(const std::string &key, std::vector<std::string> values);
|
|
|
|
std::string process(std::string str) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
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
|