%module{Slic3r::XS}; %{ #include #include "slic3r/GUI/Preset.hpp" %} %name{Slic3r::GUI::Preset} class Preset { // owned by PresetCollection, no constructor/destructor bool is_default() %code%{ RETVAL = THIS->is_default; %}; bool is_external() %code%{ RETVAL = THIS->is_external; %}; bool is_visible() %code%{ RETVAL = THIS->is_visible; %}; bool is_dirty() %code%{ RETVAL = THIS->is_dirty; %}; const char* name() %code%{ RETVAL = THIS->name.c_str(); %}; const char* file() %code%{ RETVAL = THIS->file.c_str(); %}; bool loaded() %code%{ RETVAL = THIS->loaded; %}; Ref config() %code%{ RETVAL = &THIS->config; %}; }; %name{Slic3r::GUI::PresetCollection} class PresetCollection { Ref preset(size_t idx) %code%{ RETVAL = &THIS->preset(idx); %}; Ref default_preset() %code%{ RETVAL = &THIS->default_preset(); %}; size_t size() const; size_t num_visible() const; %{ SV* PresetCollection::arrayref() CODE: AV* av = newAV(); av_fill(av, THIS->size()-1); int i = 0; for (size_t i = 0; i < THIS->size(); ++ i) { Preset &preset = THIS->preset(i); av_store(av, i++, perl_to_SV_ref(preset)); } RETVAL = newRV_noinc((SV*)av); OUTPUT: RETVAL %} }; %name{Slic3r::GUI::PresetBundle} class PresetBundle { PresetBundle(); ~PresetBundle(); void load_bitmaps(std::string path_bitmap_compatible, std::string path_bitmap_incompatible); void load_presets(std::string dir_path); Ref prints() %code%{ RETVAL = &THIS->prints; %}; Ref filaments() %code%{ RETVAL = &THIS->filaments; %}; Ref printers() %code%{ RETVAL = &THIS->printers; %}; };