class Paludis::ChoiceValue

A single ChoiceValue object for a Choice.

Public Instance Methods

origin → ChoiceOrigin click to toggle source

Is this flag explicitly listed?

Use this to avoid showing things like LINGUAS values that aren't listed in IUSE but that end up as a ChoiceValue anyway.

VALUE
    choice_value_origin(VALUE self_v)
    {
        std::shared_ptr<const ChoiceValue> self(value_to_choice_value(self_v));
        return INT2FIX(self->origin());
    }

    void do_register_choice()
    {
        /*
         * Document-class: Paludis::Choices
         *
         * A collection of Choice objects for a PackageID.
         */
        c_choices = rb_define_class_under(c_paludis_module, "Choices", rb_cObject);
        rb_funcall(c_choices, rb_intern("private_class_method"), 1, rb_str_new2("new"));
        rb_define_method(c_choices, "each", choices_each, 0);
        rb_include_module(c_choices, rb_mEnumerable);
        rb_define_method(c_choices, "find_by_name_with_prefix", choices_find_by_name_with_prefix, 1);
        rb_define_method(c_choices, "has_matching_contains_every_value_prefix?", choices_has_matching_contains_every_value_prefix, 1);

        /*
         * Document-class: Paludis::Choice
         *
         * A collection of ChoiceValue objects for a PackageID's Choices.
         */
        c_choice = rb_define_class_under(c_paludis_module, "Choice", rb_cObject);
        rb_funcall(c_choice, rb_intern("private_class_method"), 1, rb_str_new2("new"));
        rb_define_method(c_choice, "raw_name", choice_raw_name, 0)
        rb_define_method(c_choice, "human_name", choice_human_name, 0)
        rb_define_method(c_choice, "prefix", choice_prefix, 0)
        rb_define_method(c_choice, "contains_every_value?", choice_contains_every_value, 0)
        rb_define_method(c_choice, "hidden?", choice_hidden, 0)
        rb_define_method(c_choice, "show_with_no_prefix?", choice_show_with_no_prefix, 0)
        rb_define_method(c_choice, "consider_added_or_changed?", choice_consider_added_or_changed, 0)
        rb_define_method(c_choice, "each", choice_each, 0);
        rb_include_module(c_choice, rb_mEnumerable);

        /*
         * Document-module: Paludis::ChoiceOrigin
         *
         * The origin of a Choice
         */
        c_choice_origin = rb_define_module_under(c_paludis_module, "ChoiceOrigin");
        for (ChoiceOrigin l(static_cast<ChoiceOrigin>(0)), l_end(last_co) ; l != l_end ;
                l = static_cast<ChoiceOrigin>(static_cast<int>(l) + 1))
            rb_define_const(c_choice_origin, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));


        /*
         * Document-class: Paludis::ChoiceValue
         *
         * A single ChoiceValue object for a Choice.
         */
        c_choice_value = rb_define_class_under(c_paludis_module, "ChoiceValue", rb_cObject);
        rb_funcall(c_choice_value, rb_intern("private_class_method"), 1, rb_str_new2("new"));
        rb_define_method(c_choice_value, "unprefixed_name", choice_value_unprefixed_name, 0)
        rb_define_method(c_choice_value, "name_with_prefix", choice_value_name_with_prefix, 0)
        rb_define_method(c_choice_value, "enabled?", choice_value_enabled, 0)
        rb_define_method(c_choice_value, "enabled_by_default?", choice_value_enabled_by_default, 0)
        rb_define_method(c_choice_value, "locked?", choice_value_locked, 0)
        rb_define_method(c_choice_value, "description", choice_value_description, 0)
        rb_define_method(c_choice_value, "origin", choice_value_origin, 0);
    }
}