Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PlaceholderParser.xsp « xsp « xs - github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1f027a0d7834ca582206e8e83817a0a947f47dff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
%module{Slic3r::XS};

%{
#include <myinit.h>
#include <vector>
#include "PlaceholderParser.hpp"
%}

%name{Slic3r::GCode::PlaceholderParser} class PlaceholderParser {
    %name{_new} PlaceholderParser();
    ~PlaceholderParser();

    void apply_config(DynamicPrintConfig *config)
    %code%{ THIS->apply_config(*config); %};

    void _single_set(std::string k, std::string v)
        %code%{ THIS->_single[k] = v; %};

    std::string _single_get(std::string k)
        %code%{ RETVAL = THIS->_single[k]; %};
    std::string _multiple_get(std::string k)
        %code%{ RETVAL = THIS->_multiple[k]; %};

    std::vector<std::string> _single_keys()
        %code{%
            for (std::map<std::string, std::string>::iterator i = THIS->_single.begin();
                i != THIS->_single.end(); ++i)
            {
                RETVAL.push_back(i->first);
            }
        %};

    std::vector<std::string> _multiple_keys()
        %code{%
            for (std::map<std::string, std::string>::iterator i = THIS->_multiple.begin();
                i != THIS->_multiple.end(); ++i)
            {
                RETVAL.push_back(i->first);
            }
        %};
};