diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /devtools/swigwin-1.3.34/Lib/ruby/std_common.i | |
| download | archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip | |
Diffstat (limited to 'devtools/swigwin-1.3.34/Lib/ruby/std_common.i')
| -rw-r--r-- | devtools/swigwin-1.3.34/Lib/ruby/std_common.i | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/devtools/swigwin-1.3.34/Lib/ruby/std_common.i b/devtools/swigwin-1.3.34/Lib/ruby/std_common.i new file mode 100644 index 0000000..16365a4 --- /dev/null +++ b/devtools/swigwin-1.3.34/Lib/ruby/std_common.i @@ -0,0 +1,44 @@ +%include <std/std_except.i> +%include <rubystdcommon.swg> +%include <rubystdautodoc.swg> + + +/* + Generate the traits for a 'primitive' type, such as 'double', + for which the SWIG_AsVal and SWIG_From methods are already defined. +*/ + +%define %traits_ptypen(Type...) + %fragment(SWIG_Traits_frag(Type),"header", + fragment=SWIG_AsVal_frag(Type), + fragment=SWIG_From_frag(Type), + fragment="StdTraits") { +namespace swig { + template <> struct traits<Type > { + typedef value_category category; + static const char* type_name() { return #Type; } + }; + template <> struct traits_asval<Type > { + typedef Type value_type; + static int asval(VALUE obj, value_type *val) { + return SWIG_AsVal(Type)(obj, val); + } + }; + template <> struct traits_from<Type > { + typedef Type value_type; + static VALUE from(const value_type& val) { + return SWIG_From(Type)(val); + } + }; +} +} +%enddef + + +%include <std/std_common.i> + +// +// Generates the traits for all the known primitive +// C++ types (int, double, ...) +// +%apply_cpptypes(%traits_ptypen); |