Class: WIN32OLE_PARAM
- Inherits:
-
Object
- Object
- WIN32OLE_PARAM
- Defined in:
- win32ole.c,
win32ole.c
Overview
WIN32OLE_PARAM
objects represent param information of
the OLE method.
Instance Method Summary collapse
-
#default ⇒ Object
Returns default value.
- #initialize ⇒ Object constructor
-
#input? ⇒ Boolean
Returns true if the parameter is input.
-
#inspect ⇒ String
Returns the parameter name with class name.
-
#name ⇒ Object
(also: #to_s)
Returns name.
-
#ole_type ⇒ Object
Returns OLE type of WIN32OLE_PARAM object(parameter of OLE method).
-
#ole_type_detail ⇒ Object
Returns detail information of type of argument.
-
#optional? ⇒ Boolean
Returns true if argument is optional.
-
#output? ⇒ Boolean
Returns true if argument is output.
-
#retval? ⇒ Boolean
Returns true if argument is return value.
Constructor Details
#initialize ⇒ Object
7325 7326 7327 7328 7329 7330 7331 7332 7333 |
# File 'win32ole.c', line 7325
static VALUE foleparam_initialize(VALUE self, VALUE olemethod, VALUE n)
{
int idx;
if (!rb_obj_is_kind_of(olemethod, cWIN32OLE_METHOD)) {
rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE_METHOD object");
}
idx = FIX2INT(n);
return oleparam_ole_param(self, olemethod, idx);
}
|
Instance Method Details
#default ⇒ Object
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
7568 7569 7570 7571 7572 7573 7574 |
# File 'win32ole.c', line 7568
static VALUE foleparam_default(VALUE self)
{
struct oleparamdata *pparam;
Data_Get_Struct(self, struct oleparamdata, pparam);
return ole_param_default(pparam->pTypeInfo, pparam->method_index,
pparam->index);
}
|
#input? ⇒ Boolean
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
7444 7445 7446 7447 7448 7449 7450 |
# File 'win32ole.c', line 7444
static VALUE foleparam_input(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);
}
|
#inspect ⇒ String
Returns the parameter name with class name. If the parameter has default value, then returns name=value string with class name.
7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 |
# File 'win32ole.c', line 7584
static VALUE
foleparam_inspect(VALUE self)
{
VALUE detail = foleparam_name(self);
VALUE defval = foleparam_default(self);
if (defval != Qnil) {
rb_str_cat2(detail, "=");
rb_str_concat(detail, rb_funcall(defval, rb_intern("inspect"), 0));
}
return make_inspect("WIN32OLE_PARAM", detail);
}
|
#name ⇒ Object Also known as: to_s
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
7345 7346 7347 7348 7349 |
# File 'win32ole.c', line 7345
static VALUE
foleparam_name(VALUE self)
{
return rb_ivar_get(self, rb_intern("name"));
}
|
#ole_type ⇒ Object
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
7376 7377 7378 7379 7380 7381 7382 7383 |
# File 'win32ole.c', line 7376
static VALUE
foleparam_ole_type(VALUE self)
{
struct oleparamdata *pparam;
Data_Get_Struct(self, struct oleparamdata, pparam);
return ole_param_ole_type(pparam->pTypeInfo, pparam->method_index,
pparam->index);
}
|
#ole_type_detail ⇒ Object
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"]
7410 7411 7412 7413 7414 7415 7416 7417 |
# File 'win32ole.c', line 7410
static VALUE
foleparam_ole_type_detail(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);
}
|
#optional? ⇒ Boolean
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
7489 7490 7491 7492 7493 7494 7495 |
# File 'win32ole.c', line 7489
static VALUE foleparam_optional(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);
}
|
#output? ⇒ Boolean
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
7471 7472 7473 7474 7475 7476 7477 |
# File 'win32ole.c', line 7471
static VALUE foleparam_output(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);
}
|
#retval? ⇒ Boolean
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
7508 7509 7510 7511 7512 7513 7514 |
# File 'win32ole.c', line 7508
static VALUE foleparam_retval(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);
}
|