Class: WIN32OLE_PARAM

Class | WIN32OLE_PARAM
In: | win32ole/win32ole.c
Parent: | Object

`WIN32OLE_PARAM` objects represent param information of the OLE method.

### Methods

default input? name ole_type ole_type_detail optional? output? retval? to_s

### Public Instance methods

WIN32OLE_PARAM#default

Returns default value. If the default value does not exist, this method returns nil.

       tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
       method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
       method.params.each do |param|
         if param.default
           puts "#{param.name} (= #{param.default})"
         else
           puts "#{param}"
         end
       end

       The above script result is following:
           Filename
           FileFormat
           Password
           WriteResPassword
           ReadOnlyRecommended
           CreateBackup
           AccessMode (= 1)
           ConflictResolution
           AddToMru
           TextCodepage
           TextVisualLayout

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_PARAM#default
     *
     *  Returns default value. If the default value does not exist,
     *  this method returns nil.
     *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
     *     method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
     *     method.params.each do |param|
     *       if param.default
     *         puts "#{param.name} (= #{param.default})"
     *       else
     *         puts "#{param}"
     *       end
     *     end
     *
     *     The above script result is following:
     *         Filename
     *         FileFormat
     *         Password
     *         WriteResPassword
     *         ReadOnlyRecommended
     *         CreateBackup
     *         AccessMode (= 1)
     *         ConflictResolution
     *         AddToMru
     *         TextCodepage
     *         TextVisualLayout
     */
    static VALUE foleparam_default(self)
        VALUE self;
    {
        struct oleparamdata *pparam;
        Data_Get_Struct(self, struct oleparamdata, pparam);
        return ole_param_default(pparam->pTypeInfo, pparam->method_index,
                                 pparam->index);
    }

WIN32OLE_PARAM#input?

Returns true if the parameter is input.

       tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
       method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
       param1 = method.params[0]
       puts param1.input? # => true

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_PARAM#input?
     *
     *  Returns true if the parameter is input.
     *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
     *     method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
     *     param1 = method.params[0]
     *     puts param1.input? # => true
     */
    static VALUE foleparam_input(self)
        VALUE self;
    {
        struct oleparamdata *pparam;
        Data_Get_Struct(self, struct oleparamdata, pparam);
        return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
                                   pparam->index, PARAMFLAG_FIN);
    }

WIN32OLE_PARAM#name

Returns name.

       tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
       method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
       param1 = method.params[0]
       puts param1.name # => Filename

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_PARAM#name
     *
     *  Returns name.
     *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
     *     method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
     *     param1 = method.params[0]
     *     puts param1.name # => Filename
     */
    static VALUE
    foleparam_name(self)
        VALUE self;
    {
        return rb_ivar_get(self, rb_intern("name"));
    }

WIN32OLE_PARAM#ole_type

Returns OLE type of WIN32OLE_PARAM object(parameter of OLE method).

       tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
       method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
       param1 = method.params[0]
       puts param1.ole_type # => VARIANT

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_PARAM#ole_type
     *
     *  Returns OLE type of WIN32OLE_PARAM object(parameter of OLE method).
     *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
     *     method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
     *     param1 = method.params[0]
     *     puts param1.ole_type # => VARIANT
     */
    static VALUE
    foleparam_ole_type(self)
        VALUE self;
    {
        struct oleparamdata *pparam;
        Data_Get_Struct(self, struct oleparamdata, pparam);
        return ole_param_ole_type(pparam->pTypeInfo, pparam->method_index,
                                  pparam->index);
    }

WIN32OLE_PARAM#ole_type_detail

Returns detail information of type of argument.

       tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'IWorksheetFunction')
       method = WIN32OLE_METHOD.new(tobj, 'SumIf')
       param1 = method.params[0]
       p param1.ole_type_detail # => ["PTR", "USERDEFINED", "Range"]

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_PARAM#ole_type_detail
     *
     *  Returns detail information of type of argument.
     *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'IWorksheetFunction')
     *     method = WIN32OLE_METHOD.new(tobj, 'SumIf')
     *     param1 = method.params[0]
     *     p param1.ole_type_detail # => ["PTR", "USERDEFINED", "Range"]
     */
    static VALUE
    foleparam_ole_type_detail(self)
        VALUE self;
    {
        struct oleparamdata *pparam;
        Data_Get_Struct(self, struct oleparamdata, pparam);
        return ole_param_ole_type_detail(pparam->pTypeInfo, pparam->method_index,
                                         pparam->index);
    }

WIN32OLE_PARAM#optional?

Returns true if argument is optional.

       tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
       method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
       param1 = method.params[0]
       puts "#{param1.name} #{param1.optional?}" # => Filename true

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_PARAM#optional?
     *
     *  Returns true if argument is optional.
     *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
     *     method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
     *     param1 = method.params[0]
     *     puts "#{param1.name} #{param1.optional?}" # => Filename true
     */
    static VALUE foleparam_optional(self)
        VALUE self;
    {
        struct oleparamdata *pparam;
        Data_Get_Struct(self, struct oleparamdata, pparam);
        return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
                                   pparam->index, PARAMFLAG_FOPT);
    }

WIN32OLE#output?

Returns true if argument is output.

       tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'DWebBrowserEvents')
       method = WIN32OLE_METHOD.new(tobj, 'NewWindow')
       method.params.each do |param|
         puts "#{param.name} #{param.output?}"
       end

       The result of above script is following:
         URL false
         Flags false
         TargetFrameName false
         PostData false
         Headers false
         Processed true

[Source]

    /*
     *  call-seq:
     *     WIN32OLE#output?
     *
     *  Returns true if argument is output.
     *     tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'DWebBrowserEvents')
     *     method = WIN32OLE_METHOD.new(tobj, 'NewWindow')
     *     method.params.each do |param|
     *       puts "#{param.name} #{param.output?}"
     *     end
     *
     *     The result of above script is following:
     *       URL false
     *       Flags false
     *       TargetFrameName false
     *       PostData false
     *       Headers false
     *       Processed true
     */
    static VALUE foleparam_output(self)
        VALUE self;
    {
        struct oleparamdata *pparam;
        Data_Get_Struct(self, struct oleparamdata, pparam);
        return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
                                   pparam->index, PARAMFLAG_FOUT);
    }

WIN32OLE_PARAM#retval?

Returns true if argument is return value.

       tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library',
                                'DirectPlayLobbyConnection')
       method = WIN32OLE_METHOD.new(tobj, 'GetPlayerShortName')
       param = method.params[0]
       puts "#{param.name} #{param.retval?}"  # => name true

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_PARAM#retval?
     *
     *  Returns true if argument is return value.
     *     tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library',
     *                              'DirectPlayLobbyConnection')
     *     method = WIN32OLE_METHOD.new(tobj, 'GetPlayerShortName')
     *     param = method.params[0]
     *     puts "#{param.name} #{param.retval?}"  # => name true
     */
    static VALUE foleparam_retval(self)
        VALUE self;
    {
        struct oleparamdata *pparam;
        Data_Get_Struct(self, struct oleparamdata, pparam);
        return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index,
                                   pparam->index, PARAMFLAG_FRETVAL);
    }

to_s()

Alias for name

[Validate]