mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-28 15:45:30 +00:00
Implement type checking for XS objects
Type handling is mainly done using templates. Template Slic3r::ClassTraits is used to store info about exported types (perl class name). Currently only perl class name and refference name is used. Template values are initialized by REGISTER_CLASS macro. This macro is used in .cpp file of class ( it needs to be used exactly for each type). Ref<type> class is used to return value as perl reference. Operator overloading is used to make c++ and XSpp happy, only pointer value should be possible to return. Clone<type> class is used to return copy of value ( using new and copy constructor). Copy is created on assigment, this should be probably improved (memory leak on multiple assignments). It is overloaded to be able to return type, type* and type&. Typechecking in ExtrusionEntityCollection updated to check all passed types.
This commit is contained in:
@@ -3,18 +3,19 @@
|
||||
%{
|
||||
#include <myinit.h>
|
||||
#include "ExPolygon.hpp"
|
||||
#include "perlglue.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExPolygon} class ExPolygon {
|
||||
~ExPolygon();
|
||||
ExPolygon* clone()
|
||||
%code{% const char* CLASS = "Slic3r::ExPolygon"; RETVAL = new ExPolygon(*THIS); %};
|
||||
Clone<ExPolygon> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
SV* arrayref()
|
||||
%code{% RETVAL = THIS->to_AV(); %};
|
||||
SV* pp()
|
||||
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
||||
Polygon* contour()
|
||||
%code{% const char* CLASS = "Slic3r::Polygon::Ref"; RETVAL = &(THIS->contour); %};
|
||||
Ref<Polygon> contour()
|
||||
%code{% RETVAL = &(THIS->contour); %};
|
||||
Polygons* holes()
|
||||
%code{% RETVAL = &(THIS->holes); %};
|
||||
void scale(double factor);
|
||||
|
||||
Reference in New Issue
Block a user