Class: Archive::Entry

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
ext/entry.cpp

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object

entry <=> other -> -1,0,1 or nil

compares two entries



449
450
451
452
453
454
455
456
# File 'ext/entry.cpp', line 449

VALUE ArchiveEntry_compare(VALUE self,VALUE other)
{
	if(rb_obj_is_kind_of(other,rb_cArchiveEntry) != Qtrue)
		return Qnil;
	else {
		return rb_funcall(ArchiveEntry_mtime(self),rb_intern("<=>"),1,ArchiveEntry_mtime(other));
	}
}

#access_aclObject

ACL added later with acl gem



475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'ext/entry.cpp', line 475

VALUE ArchiveEntry_access_acl(VALUE self){
	if(rb_const_defined(rb_cObject,rb_intern("ACL"))){
		VALUE rb_cAcl = rb_const_get(rb_cObject,rb_intern("ACL"));
		VALUE rb_cAclEntry = rb_const_get(rb_cObject,rb_intern("Entry"));
		VALUE result = rb_class_new_instance(0,NULL,rb_cAcl);
		archive_entry_acl_reset(_self,ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
		int type,permset,tag,qual;
		const char* name;
		while(archive_entry_acl_next(_self, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,&type, &permset, &tag,&qual, &name) == 0){
			VALUE entry;
			VALUE temp[3];
			switch(tag){
			case ARCHIVE_ENTRY_ACL_USER:
			case ARCHIVE_ENTRY_ACL_USER_OBJ:
				temp[0] = ID2SYM(rb_intern("user"));
				break;
			case ARCHIVE_ENTRY_ACL_GROUP:
			case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
				temp[0] = ID2SYM(rb_intern("group"));
				break;
			case ARCHIVE_ENTRY_ACL_MASK:
				temp[0] = ID2SYM(rb_intern("mask"));
				break;
			case ARCHIVE_ENTRY_ACL_OTHER:
				temp[0] = ID2SYM(rb_intern("other"));
				break;
			}
			temp[1] = INT2NUM(permset);
			switch(tag){
			case ARCHIVE_ENTRY_ACL_USER:
			case ARCHIVE_ENTRY_ACL_GROUP:
				temp[2] = INT2NUM(qual);
				entry=rb_class_new_instance(3,temp,rb_cAclEntry);
				break;
			default:
				entry=rb_class_new_instance(2,temp,rb_cAclEntry);
				break;
			}
			rb_funcall(result,rb_intern("<<"),1,entry);
		}
		return result;
	}else
		rb_raise(rb_eNotImpError,"this function require the libacl-ruby gem!");
	return Qnil;
}

#atimeObject

:nodoc:



285
286
287
288
289
290
291
# File 'ext/entry.cpp', line 285

VALUE ArchiveEntry_atime(VALUE self)
{
	if(archive_entry_atime_is_set(_self))
		return rb_time_new(archive_entry_atime(_self),archive_entry_atime_nsec(_self));
	else
		return Qnil;
}

#atime=(value) ⇒ Object

:nodoc:



333
334
335
336
337
338
339
340
# File 'ext/entry.cpp', line 333

VALUE ArchiveEntry_set_atime(VALUE self,VALUE value)
{
	if(value ==Qnil)
		archive_entry_unset_atime(_self);
	else
		archive_entry_set_atime(_self,NUM2INT(rb_funcall(value,rb_intern("to_i"),0)),NUM2INT(rb_funcall(value,rb_intern("usec"),0)));
	return value;
}

#birthtimeObject

:nodoc:

call-seq:
entry.birthtime -> Time or nil

returns birthtime


324
325
326
327
328
329
330
# File 'ext/entry.cpp', line 324

VALUE ArchiveEntry_birthtime(VALUE self)
{
	if(archive_entry_birthtime_is_set(_self))
		return rb_time_new(archive_entry_birthtime(_self),archive_entry_birthtime_nsec(_self));
	else
		return Qnil;
}

#birthtime=(value) ⇒ Object

:nodoc:

call-seq:
entry.birthtime = Time or nil

sets birthtime


375
376
377
378
379
380
381
382
# File 'ext/entry.cpp', line 375

VALUE ArchiveEntry_set_birthtime(VALUE self,VALUE value)
{
	if(value ==Qnil)
		archive_entry_unset_birthtime(_self);
	else
		archive_entry_set_birthtime(_self,NUM2INT(rb_funcall(value,rb_intern("to_i"),0)),NUM2INT(rb_funcall(value,rb_intern("usec"),0)));
	return value;
}

#ctimeObject

:nodoc:

call-seq:
entry.ctime -> Time or nil

returns create time


298
299
300
301
302
303
304
# File 'ext/entry.cpp', line 298

VALUE ArchiveEntry_ctime(VALUE self)
{
	if(archive_entry_ctime_is_set(_self))
		return rb_time_new(archive_entry_ctime(_self),archive_entry_ctime_nsec(_self));
	else
		return Qnil;
}

#ctime=(value) ⇒ Object

:nodoc:

call-seq:
entry.ctime = Time or nil

sets create time


347
348
349
350
351
352
353
354
# File 'ext/entry.cpp', line 347

VALUE ArchiveEntry_set_ctime(VALUE self,VALUE value)
{
	if(value ==Qnil)
		archive_entry_unset_ctime(_self);
	else
		archive_entry_set_ctime(_self,NUM2INT(rb_funcall(value,rb_intern("to_i"),0)),NUM2INT(rb_funcall(value,rb_intern("usec"),0)));
	return value;
}

#devObject

entry.dev -> Integer

returns dev



41
42
43
44
# File 'ext/entry.cpp', line 41

VALUE ArchiveEntry_dev(VALUE self)
{
	return INT2NUM(archive_entry_dev(_self));
}

#dev=(dev) ⇒ Object

entry.dev = Integer

sets dev



389
390
391
392
# File 'ext/entry.cpp', line 389

VALUE ArchiveEntry_set_dev(VALUE self,VALUE dev){
	archive_entry_set_dev(_self,NUM2INT(dev));
	return dev;
}

#dev_majorObject

entry.devmajor -> Integer

returns devmajor



51
52
53
54
# File 'ext/entry.cpp', line 51

VALUE ArchiveEntry_devmajor(VALUE self)
{
	return INT2NUM(archive_entry_devmajor(_self));
}

#dev_major=(dev) ⇒ Object

entry.devmajor = Integer

sets devmajor



399
400
401
402
# File 'ext/entry.cpp', line 399

VALUE ArchiveEntry_set_devmajor(VALUE self,VALUE dev){
	archive_entry_set_devmajor(_self,NUM2INT(dev));
	return dev;
}

#dev_minorObject

entry.devminor -> Integer

returns devminor



61
62
63
64
# File 'ext/entry.cpp', line 61

VALUE ArchiveEntry_devminor(VALUE self)
{
	return INT2NUM(archive_entry_devminor(_self));
}

#dev_minor=(dev) ⇒ Object

entry.devminor = Integer

sets devminor



409
410
411
412
# File 'ext/entry.cpp', line 409

VALUE ArchiveEntry_set_devminor(VALUE self,VALUE dev){
	archive_entry_set_devminor(_self,NUM2INT(dev));
	return dev;
}

#gidObject

entry.gid -> Integer

Get Group ID



130
131
132
133
# File 'ext/entry.cpp', line 130

VALUE ArchiveEntry_gid(VALUE self)
{
	return INT2NUM(archive_entry_gid(_self));
}

#gid=(id) ⇒ Object

entry.gid = Integer

Set Group ID



151
152
153
154
# File 'ext/entry.cpp', line 151

VALUE ArchiveEntry_set_gid(VALUE self,VALUE id){
	archive_entry_set_gid(_self,NUM2INT(id));
	return id;
}

#gnameObject

entry.gname -> String

Get Group Name



108
109
110
111
# File 'ext/entry.cpp', line 108

VALUE ArchiveEntry_gname(VALUE self)
{
	return rb_str_new2(archive_entry_gname(_self));
}

#gname=(val) ⇒ Object

entry.gname = String

Set Group Name



174
175
176
177
178
# File 'ext/entry.cpp', line 174

VALUE ArchiveEntry_set_gname(VALUE self,VALUE val)
{
	archive_entry_set_gname(_self,rb_string_value_cstr(&val));
	return val;
}

entry.hardlink -> String or nil

returns the hardlink



209
210
211
212
213
# File 'ext/entry.cpp', line 209

VALUE ArchiveEntry_hardlink(VALUE self)
{
	const char* str = archive_entry_hardlink(_self);
	return str ==NULL? Qnil : rb_str_new2(str);
}

#hardlink=(val) ⇒ Object

entry.hardlink = String

sets hardlink



266
267
268
269
270
# File 'ext/entry.cpp', line 266

VALUE ArchiveEntry_set_hardlink(VALUE self,VALUE val)
{
	archive_entry_set_hardlink(_self,rb_string_value_cstr(&val));
	return val;
}

#inspectObject

entry.inspect -> String

returns readable string.



464
465
466
467
468
469
470
# File 'ext/entry.cpp', line 464

VALUE ArchiveEntry_inspect(VALUE self){
		VALUE array[3];
		array[0]=rb_str_new2("#<%s:%s>");
		array[1]=rb_class_of(self);	
		array[2]=ArchiveEntry_path(self);
		return rb_f_sprintf(3,array);
}

#mtimeObject

:nodoc:

call-seq:
entry.mtime -> Time or nil

returns modification time


311
312
313
314
315
316
317
# File 'ext/entry.cpp', line 311

VALUE ArchiveEntry_mtime(VALUE self)
{
	if(archive_entry_mtime_is_set(_self))
		return rb_time_new(archive_entry_mtime(_self),archive_entry_mtime_nsec(_self));
	else
		return Qnil;
}

#mtime=(value) ⇒ Object

:nodoc:

call-seq:
entry.mtime = Time or nil

sets modification time


361
362
363
364
365
366
367
368
# File 'ext/entry.cpp', line 361

VALUE ArchiveEntry_set_mtime(VALUE self,VALUE value)
{
	if(value ==Qnil)
		archive_entry_unset_mtime(_self);
	else
		archive_entry_set_mtime(_self,NUM2INT(rb_funcall(value,rb_intern("to_i"),0)),NUM2INT(rb_funcall(value,rb_intern("usec"),0)));
	return value;
}

#pathObject Also known as: to_s

entry.path -> String or nil

returns the path of the file



197
198
199
200
201
# File 'ext/entry.cpp', line 197

VALUE ArchiveEntry_path(VALUE self)
{
	const char* str = archive_entry_pathname(_self);
	return str ==NULL? Qnil : rb_str_new2(str);
}

#path=(val) ⇒ Object

entry.path = String

sets path



255
256
257
258
259
# File 'ext/entry.cpp', line 255

VALUE ArchiveEntry_set_path(VALUE self,VALUE val)
{
	archive_entry_set_pathname(_self,rb_string_value_cstr(&val));
	return val;
}

#rdevObject

entry.rdev -> Integer

returns rdev



72
73
74
75
# File 'ext/entry.cpp', line 72

VALUE ArchiveEntry_rdev(VALUE self)
{
	return INT2NUM(archive_entry_rdev(_self));
}

#rdev=(dev) ⇒ Object

entry.rdev = Integer

sets rdev



419
420
421
422
# File 'ext/entry.cpp', line 419

VALUE ArchiveEntry_set_rdev(VALUE self,VALUE dev){
	archive_entry_set_dev(_self,NUM2INT(dev));
	return dev;
}

#rdev_majorObject

entry.rdevmajor -> Integer

returns rdevmajor



82
83
84
85
# File 'ext/entry.cpp', line 82

VALUE ArchiveEntry_rdevmajor(VALUE self)
{
	return INT2NUM(archive_entry_rdevmajor(_self));
}

#rdev_major=(dev) ⇒ Object

entry.rdevminor = Integer

sets rdevminor



429
430
431
432
# File 'ext/entry.cpp', line 429

VALUE ArchiveEntry_set_rdevmajor(VALUE self,VALUE dev){
	archive_entry_set_rdevmajor(_self,NUM2INT(dev));
	return dev;
}

#rdev_minorObject

entry.rdevminor -> Integer

returns rdevminor



92
93
94
95
# File 'ext/entry.cpp', line 92

VALUE ArchiveEntry_rdevminor(VALUE self)
{
	return INT2NUM(archive_entry_rdevminor(_self));
}

#rdev_minor=(dev) ⇒ Object

entry.rdevmajor = Integer

sets rdevmajor



439
440
441
442
# File 'ext/entry.cpp', line 439

VALUE ArchiveEntry_set_rdevminor(VALUE self,VALUE dev){
	archive_entry_set_rdevminor(_self,NUM2INT(dev));
	return dev;
}

#sourcepathObject

entry.sourcepath -> String or nil

returns the hardlink



221
222
223
224
225
# File 'ext/entry.cpp', line 221

VALUE ArchiveEntry_sourcepath(VALUE self)
{
	const char* str = archive_entry_sourcepath(_self);
	return str ==NULL? Qnil : rb_str_new2(str);
}

entry.symlink -> String or nil

returns the symlink



244
245
246
247
248
# File 'ext/entry.cpp', line 244

VALUE ArchiveEntry_symlink(VALUE self)
{
	const char* str = archive_entry_symlink(_self);
	return str ==NULL? Qnil : rb_str_new2(str);
}

#symlink=(val) ⇒ Object

entry.symlink = String

sets symlink



277
278
279
280
281
# File 'ext/entry.cpp', line 277

VALUE ArchiveEntry_set_symlink(VALUE self,VALUE val)
{
	archive_entry_set_symlink(_self,rb_string_value_cstr(&val));
	return val;
}

#uidObject

entry.uid -> Integer

Get User ID



141
142
143
144
# File 'ext/entry.cpp', line 141

VALUE ArchiveEntry_uid(VALUE self)
{
	return INT2NUM(archive_entry_uid(_self));
}

#uid=(id) ⇒ Object

entry.uid = Integer

Set User ID



162
163
164
165
# File 'ext/entry.cpp', line 162

VALUE ArchiveEntry_set_uid(VALUE self,VALUE id){
	archive_entry_set_uid(_self,NUM2INT(id));
	return id;
}

#unameObject

entry.uname -> String

Get User Name



119
120
121
122
# File 'ext/entry.cpp', line 119

VALUE ArchiveEntry_uname(VALUE self)
{
	return rb_str_new2(archive_entry_uname(_self));
}

#uname=(val) ⇒ Object

entry.uname = String

Set User Name



185
186
187
188
189
# File 'ext/entry.cpp', line 185

VALUE ArchiveEntry_set_uname(VALUE self,VALUE val)
{
	archive_entry_set_uname(_self,rb_string_value_cstr(&val));
	return val;
}