Sha256: 245e6b1d9a2edde233bddd9836ac2bc04523afc87280ed9c719b9daf1d48021f

Contents?: true

Size: 1.53 KB

Versions: 13

Compression:

Stored size: 1.53 KB

Contents

# Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.

###
# wxRuby3 client data typemap definition
###

require_relative '../core/mapping'

module WXRuby3

  module Typemap

    module ClientData

      include Typemap::Module

      define do

        map 'wxClientData *' => 'Object' do
          add_header_code <<~__CODE
            #include "wxruby-ClientData.h"
            __CODE
          map_in code: '$1 = NIL_P($input) ? nullptr : new wxRubyClientData($input);'
          map_out code: <<~__CODE
            $result = Qnil;
            if ($1)
            {
              wxRubyClientData* rbcd = dynamic_cast<wxRubyClientData*> ($1);
              if (rbcd) $result = rbcd->GetData();
            }
          __CODE

          map_typecheck precedence: 'POINTER', code: '$1 = true;'
        end

        map 'wxObject *userData' => 'Object' do
          add_header_code <<~__CODE
            #include "wxruby-ClientData.h"
            __CODE
          map_in code: '$1 = NIL_P($input) ? nullptr : new wxRubyUserData($input);'

          map_typecheck precedence: 'POINTER', code: '$1 = true;'
        end

        # WxUserDataObject must be typedef for wxObject*
        map 'WxUserDataObject' => 'Object' do

          map_out code: <<~__CODE
            $result = Qnil;
            if ($1)
            {
              wxRubyUserData* rbud = dynamic_cast<wxRubyUserData*> ($1);
              if (rbud) $result = rbud->GetData();
            }
          __CODE

        end

      end

    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wxruby3-1.3.1 rakelib/lib/typemap/client_data.rb
wxruby3-1.3.0 rakelib/lib/typemap/client_data.rb
wxruby3-1.2.1 rakelib/lib/typemap/client_data.rb
wxruby3-1.2.0 rakelib/lib/typemap/client_data.rb
wxruby3-1.1.2 rakelib/lib/typemap/client_data.rb
wxruby3-1.1.1 rakelib/lib/typemap/client_data.rb
wxruby3-1.1.0 rakelib/lib/typemap/client_data.rb
wxruby3-1.0.1 rakelib/lib/typemap/client_data.rb
wxruby3-0.9.8 rakelib/lib/typemap/client_data.rb
wxruby3-0.9.7 rakelib/lib/typemap/client_data.rb
wxruby3-0.9.5 rakelib/lib/typemap/client_data.rb
wxruby3-0.9.4 rakelib/lib/typemap/client_data.rb
wxruby3-0.9.3 rakelib/lib/typemap/client_data.rb