8 static HRESULT recordinfo_from_itypelib(ITypeLib *pTypeLib,
VALUE name, IRecordInfo **ppri);
10 static void olerecord_free(
void *pvar);
11 static size_t olerecord_size(
const void *ptr);
12 static VALUE folerecord_s_allocate(
VALUE klass);
25 {
NULL, olerecord_free, olerecord_size,},
30 recordinfo_from_itypelib(ITypeLib *pTypeLib,
VALUE name, IRecordInfo **ppri)
39 count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
40 for (i = 0; i <
count; i++) {
41 hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
46 hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo);
51 hr = GetRecordInfoFromTypeInfo(pTypeInfo, ppri);
76 hr = pri->lpVtbl->PutField(pri, INVOKE_PROPERTYPUT, prec->
pdata, pbuf, &var);
97 hr = pri->lpVtbl->GetSize(pri, &size);
108 hr = pri->lpVtbl->RecordInit(pri, prec->
pdata);
112 fields = folerecord_to_h(rec);
114 V_RECORDINFO(var) =
pri;
115 V_RECORD(var) = prec->
pdata;
116 V_VT(var) = VT_RECORD;
141 hr = pri->lpVtbl->GetName(pri, &bstr);
146 hr = pri->lpVtbl->GetFieldNames(pri, &count,
NULL);
147 if (FAILED(hr) || count == 0)
150 hr = pri->lpVtbl->GetFieldNames(pri, &count, bstrs);
157 for (i = 0; i <
count; i++) {
162 hr = pri->lpVtbl->GetFieldNoCopy(pri, prec, bstrs[i], &var, &pdata);
216 olerecord_free(
void *ptr) {
226 olerecord_size(
const void *ptr)
235 hr = pvar->
pri->lpVtbl->GetSize(pvar->
pri, &size);
245 folerecord_s_allocate(
VALUE klass) {
284 ITypeLib *pTypeLib =
NULL;
285 IRecordInfo *pri =
NULL;
313 hr = recordinfo_from_itypelib(pTypeLib,
typename, &pri);
358 folerecord_to_h(
VALUE self)
395 folerecord_typename(
VALUE self)
416 if (p[len-1] ==
'=') {
457 #if SIZEOF_SIZE_T > SIZEOF_LONG 467 return olerecord_ivar_get(
self, name);
468 }
else if (argc == 2) {
469 return olerecord_ivar_set(
self, name, argv[1]);
503 folerecord_ole_instance_variable_get(
VALUE self,
VALUE name)
513 return olerecord_ivar_get(
self, sname);
542 folerecord_ole_instance_variable_set(
VALUE self,
VALUE name,
VALUE val)
552 return olerecord_ivar_set(
self, sname, val);
578 folerecord_inspect(
VALUE self)
582 tname = folerecord_typename(
self);
VALUE eWIN32OLERuntimeError
#define RUBY_TYPED_FREE_IMMEDIATELY
size_t strlen(const char *)
VALUE create_win32ole_record(IRecordInfo *pri, void *prec)
void rb_raise(VALUE exc, const char *fmt,...)
#define TypedData_Get_Struct(obj, type, data_type, sval)
ITypeLib * itypelib(VALUE self)
LPWSTR ole_vstr2wc(VALUE vstr)
VALUE rb_ivar_get(VALUE, ID)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
int rb_str_cmp(VALUE, VALUE)
VALUE rb_hash_fetch(VALUE hash, VALUE key)
VALUE rb_inspect(VALUE)
Convenient wrapper of Object::inspect.
void ole_rec2variant(VALUE rec, VARIANT *var)
HRESULT typelib_from_val(VALUE obj, ITypeLib **pTypeLib)
void rb_hash_foreach(VALUE hash, int(*func)(ANYARGS), VALUE farg)
#define RB_TYPE_P(obj, type)
VALUE rb_obj_is_kind_of(VALUE, VALUE)
call-seq: obj.is_a?(class) -> true or false obj.kind_of?(class) -> true or false
void ole_raise(HRESULT hr, VALUE ecs, const char *fmt,...)
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE val)
RUBY_EXTERN VALUE rb_cObject
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
void Init_win32ole_record(void)
#define ALLOCA_N(type, n)
VALUE ole_variant2val(VARIANT *pvar)
VALUE rb_str_subseq(VALUE, long, long)
VALUE rb_sprintf(const char *format,...)
VALUE rb_ivar_set(VALUE, ID, VALUE)
void olerecord_set_ivar(VALUE obj, IRecordInfo *pri, void *prec)
register unsigned int len
#define StringValueCStr(v)
typedef HRESULT(STDAPICALLTYPE FNCOCREATEINSTANCEEX)(REFCLSID
#define TypedData_Make_Struct(klass, type, data_type, sval)
#define StringValuePtr(v)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
void ole_val2variant(VALUE val, VARIANT *var)