class Paludis::Filter::Slot
Accept packages that have a particular slot.
Public Class Methods
Source
VALUE
filter_slot_new(VALUE self, VALUE s_v)
{
Filter * ptr(0);
try
{
SlotName s(std::string(StringValuePtr(s_v)));
ptr = new filter::Slot(s);
VALUE data(Data_Wrap_Struct(self, 0, &Common<Filter>::free, ptr));
rb_obj_call_init(data, 1, &s_v);
return data;
}
catch (const std::exception & e)
{
delete ptr;
exception_to_ruby_exception(e);
}
}
/*
* call-seq:
* new() -> Filter
*
* Create a Filter that accepts packages that have no slot.
*/
VALUE
filter_no_slot_new(VALUE self_v)
{
Filter * ptr(0);
try
{
ptr = new filter::NoSlot;
VALUE data(Data_Wrap_Struct(self_v, 0, &Common<Filter>::free, ptr));
rb_obj_call_init(data, 0, &self_v);
return data;
}
catch (const std::exception & e)
{
delete ptr;
exception_to_ruby_exception(e);
}
}
void do_register_filter()
{
/*
* Document-module: Paludis::Filter
*
* Collection of classes that restrict the results of an
* Environment selection.
*/
c_filter_module = rb_define_module_under(c_paludis_module, "Filter");
/*
* Document-class: Paludis::Filter::Filter
*
* Filter for an Environment selection.
*/
c_filter = rb_define_class_under(c_filter_module, "Filter", rb_cObject);
rb_undef_alloc_func(c_filter);
rb_funcall(c_filter, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_define_method(c_filter, "initialize", filter_init, -1);
rb_define_method(c_filter, "to_s", template_methods, 0);
/*
* Document-class: Paludis::Filter::All
*
* Accept all packages.
*/
c_filter_all = rb_define_class_under(c_filter_module, "All", c_filter);
rb_undef_alloc_func(c_filter_all);
rb_define_singleton_method(c_filter_all, "new", filter_all_new, 0);
/*
* Document-class: Paludis::Filter::NotMasked
*
* Accept unmasked packages.
*/
c_filter_not_masked = rb_define_class_under(c_filter_module, "NotMasked", c_filter);
rb_undef_alloc_func(c_filter_not_masked);
rb_define_singleton_method(c_filter_not_masked, "new", filter_not_masked_new, 0);
/*
* Document-class: Paludis::Filter::InstalledAtRoot
*
* Accept packages installed at a particular root.
*/
c_filter_installed_at_root = rb_define_class_under(c_filter_module, "InstalledAtRoot", c_filter);
rb_undef_alloc_func(c_filter_installed_at_root);
rb_define_singleton_method(c_filter_installed_at_root, "new", filter_installed_at_root_new, 1);
/*
* Document-class: Paludis::Filter::And
*
* Accept packages that match both filters.
*/
c_filter_and = rb_define_class_under(c_filter_module, "And", c_filter);
rb_undef_alloc_func(c_filter_and);
rb_define_singleton_method(c_filter_and, "new", filter_and_new, 2);
/*
* Document-class: Paludis::Filter::SupportsAction
*
* Accept packages that support a particular Action.
*/
c_filter_supports_action = rb_define_class_under(c_filter_module, "SupportsAction", c_filter);
rb_undef_alloc_func(c_filter_supports_action);
rb_define_singleton_method(c_filter_supports_action, "new", filter_supports_action_new, 1);
/*
* Document-class: Paludis::Filter::SameSlot
*
* Accept packages that have the same slot as a given PackageID.
*/
c_filter_same_slot = rb_define_class_under(c_filter_module, "SameSlot", c_filter);
rb_define_singleton_method(c_filter_same_slot, "new", filter_same_slot_new, 1);
/*
* Document-class: Paludis::Filter::Slot
*
* Accept packages that have a particular slot.
*/
c_filter_slot = rb_define_class_under(c_filter_module, "Slot", c_filter);
rb_define_singleton_method(c_filter_slot, "new", filter_slot_new, 1);
/*
* Document-class: Paludis::Filter::NoSlot
*
* Accept packages that have no slot.
*/
c_filter_no_slot = rb_define_class_under(c_filter_module, "NoSlot", c_filter);
rb_define_singleton_method(c_filter_no_slot, "new", filter_no_slot_new, 0);
}
}
Create a Filter that accepts packages that have a given slot.