/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/javascript/reference/example.i
42 строки
710 B
Olly Betts
Eliminate trivial differences between the reference examples
07 ноя 2014, 05:34
07 ноя 2014, 05:34
ac1f067
Код
Авторство
О чём код?
/* File : example.i */ /* This file has a few "typical" uses of C++ references. */ %module example %{ #include "example.h" %} class Vector { public: Vector(double x, double y, double z); ~Vector(); char *print(); }; /* This helper function calls an overloaded operator */ %inline %{ Vector addv(Vector &a, Vector &b) { return a+b; } %} /* Wrapper around an array of vectors class */ class VectorArray { public: VectorArray(int maxsize); ~VectorArray(); int size(); /* This wrapper provides an alternative to the [] operator */ %extend { Vector &get(int index) { return (*$self)[index]; } void set(int index, Vector &a) { (*$self)[index] = a; } } };