mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 23:31:13 -06:00
Removed StringMap
This commit is contained in:
parent
05b2993769
commit
54a199919b
11 changed files with 35 additions and 162 deletions
|
@ -4,7 +4,6 @@
|
|||
#include <myinit.h>
|
||||
#include "Model.hpp"
|
||||
#include "PrintConfig.hpp"
|
||||
#include "StringMap.hpp"
|
||||
#include "perlglue.hpp"
|
||||
%}
|
||||
|
||||
|
@ -28,9 +27,8 @@
|
|||
void delete_all_objects();
|
||||
void delete_all_materials();
|
||||
|
||||
%name{_set_material} Ref<ModelMaterial> set_material(t_model_material_id material_id,
|
||||
StringMap attributes)
|
||||
%code%{ RETVAL = THIS->set_material(material_id, attributes); %};
|
||||
%name{_set_material} Ref<ModelMaterial> set_material(t_model_material_id material_id)
|
||||
%code%{ RETVAL = THIS->set_material(material_id); %};
|
||||
|
||||
Ref<ModelMaterial> get_material(t_model_material_id material_id)
|
||||
%code%{
|
||||
|
@ -89,11 +87,29 @@
|
|||
Ref<Model> model()
|
||||
%code%{ RETVAL = THIS->model; %};
|
||||
|
||||
Ref<StringMap> _attributes()
|
||||
%code%{ RETVAL = &THIS->attributes; %};
|
||||
|
||||
Ref<DynamicPrintConfig> config()
|
||||
%code%{ RETVAL = &THIS->config; %};
|
||||
|
||||
std::string get_attribute(std::string name)
|
||||
%code%{ if (THIS->attributes.find(name) != THIS->attributes.end()) RETVAL = THIS->attributes[name]; %};
|
||||
|
||||
void set_attribute(std::string name, std::string value)
|
||||
%code%{ THIS->attributes[name] = value; %};
|
||||
|
||||
%{
|
||||
|
||||
SV*
|
||||
ModelMaterial::attributes()
|
||||
CODE:
|
||||
HV* hv = newHV();
|
||||
for (t_model_material_attributes::const_iterator attr = THIS->attributes.begin(); attr != THIS->attributes.end(); ++attr) {
|
||||
(void)hv_store( hv, attr->first.c_str(), attr->first.length(), newSVpv(attr->second.c_str(), attr->second.length()), 0 );
|
||||
}
|
||||
RETVAL = (SV*)newRV_noinc((SV*)hv);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
%}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <myinit.h>
|
||||
#include "StringMap.hpp"
|
||||
#include "perlglue.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::StringMap} class StringMap {
|
||||
std::string FETCH(std::string key)
|
||||
%code%{
|
||||
StringMap::iterator i = THIS->find(key);
|
||||
if (i == THIS->end()) {
|
||||
XSRETURN_UNDEF;
|
||||
}
|
||||
|
||||
RETVAL = i->second;
|
||||
%};
|
||||
|
||||
void STORE(std::string key, std::string val)
|
||||
%code%{ (*THIS)[key] = val; %};
|
||||
|
||||
void DELETE(std::string key)
|
||||
%code%{ THIS->erase(key); %};
|
||||
|
||||
void CLEAR()
|
||||
%code%{ THIS->clear(); %};
|
||||
|
||||
bool EXISTS(std::string key)
|
||||
%code%{ RETVAL = (THIS->find(key) != THIS->end()); %};
|
||||
|
||||
std::string FIRSTKEY()
|
||||
%code%{
|
||||
StringMap::iterator i = THIS->begin();
|
||||
if (i == THIS->end()) {
|
||||
XSRETURN_UNDEF;
|
||||
} else {
|
||||
RETVAL = i->first;
|
||||
}
|
||||
%};
|
||||
|
||||
std::string NEXTKEY(std::string lastkey)
|
||||
%code%{
|
||||
StringMap::iterator i = THIS->find(lastkey);
|
||||
if (i == THIS->end()) {
|
||||
XSRETURN_UNDEF;
|
||||
}
|
||||
|
||||
++i;
|
||||
if (i == THIS->end()) {
|
||||
XSRETURN_UNDEF;
|
||||
} else {
|
||||
RETVAL = i->first;
|
||||
}
|
||||
%};
|
||||
|
||||
bool SCALAR()
|
||||
%code%{ RETVAL = !THIS->empty(); %};
|
||||
};
|
|
@ -8,11 +8,6 @@ t_model_material_id T_STD_STRING
|
|||
t_layer_height_ranges T_LAYER_HEIGHT_RANGES
|
||||
|
||||
|
||||
StringMap T_STRING_MAP
|
||||
StringMap* O_OBJECT_SLIC3R
|
||||
Ref<StringMap> O_OBJECT_SLIC3R_T
|
||||
|
||||
|
||||
BoundingBox* O_OBJECT_SLIC3R
|
||||
Ref<BoundingBox> O_OBJECT_SLIC3R_T
|
||||
Clone<BoundingBox> O_OBJECT_SLIC3R_T
|
||||
|
@ -177,28 +172,6 @@ T_ARRAYREF
|
|||
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
||||
\"$var\");
|
||||
|
||||
# http://www.perlmonks.org/?node_id=853194
|
||||
T_STRING_MAP
|
||||
{
|
||||
HV *hv;
|
||||
HE *he;
|
||||
std::map<std::string, std::string> t_sm;
|
||||
if(SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVHV) {
|
||||
hv = (HV *)SvRV($arg);
|
||||
hv_iterinit(hv);
|
||||
} else {
|
||||
warn(\"${Package}::$func_name() -- $var is not a hash reference\");
|
||||
XSRETURN_UNDEF;
|
||||
}
|
||||
|
||||
while((he = hv_iternext(hv)) != NULL) {
|
||||
SV *svkey = HeSVKEY_force(he);
|
||||
SV *svval = HeVAL(he);
|
||||
t_sm[SvPV_nolen(svkey)] = SvPV_nolen(svval);
|
||||
}
|
||||
$var = t_sm;
|
||||
}
|
||||
|
||||
T_LAYER_HEIGHT_RANGES
|
||||
{
|
||||
if (!SvROK($arg) || SvTYPE(SvRV($arg)) != SVt_PVAV) {
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
%typemap{std::vector<double>*};
|
||||
%typemap{std::vector<std::string>};
|
||||
%typemap{t_layer_height_ranges};
|
||||
%typemap{StringMap};
|
||||
%typemap{StringMap*};
|
||||
%typemap{Ref<StringMap>}{simple};
|
||||
%typemap{SV*};
|
||||
%typemap{AV*};
|
||||
%typemap{Point*};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue