class Paludis::OverriddenMask

An OverriddenMask holds a Mask and an explanation of why it has been overridden.

Public Instance Methods

mask → Mask click to toggle source
VALUE
    overridden_mask_mask(VALUE self)
    {
        std::shared_ptr<const OverriddenMask> * ptr;
        Data_Get_Struct(self, std::shared_ptr<const OverriddenMask>, ptr);
        return mask_to_value((*ptr)->mask());
    }

    /*
     * call-seq:
     *     override_reason -> MaskOverrideReason
     */
    VALUE
    overridden_mask_override_reason(VALUE self)
    {
        std::shared_ptr<const OverriddenMask> * ptr;
        Data_Get_Struct(self, std::shared_ptr<const OverriddenMask>, ptr);
        return INT2FIX((*ptr)->override_reason());
    }


    void do_register_mask()
    {
        /*
         * Document-class: Paludis::Mask
         *
         * A mask represents one reason why a PackageID is masked (not installable).
         * A basic Mask has:
         *
         * * A single character key, which can be used by clients if they need a very compact way of representing a mask.
         *
         * * A description.
         *
         * Subclasses provide additional information.
         */
        c_mask = rb_define_class_under(c_paludis_module, "Mask", rb_cObject);
        rb_funcall(c_mask, rb_intern("private_class_method"), 1, rb_str_new2("new"));
        rb_define_method(c_mask, "key", mask_key, 0);
        rb_define_method(c_mask, "description",                template_methods, 0);
        rb_define_method(c_mask, "initialize", mask_init, -1);

        /*
         * Document-class: Paludis::UserMask
         *
         * A UserMask is a Mask due to user configuration.
         */
        c_user_mask = rb_define_class_under(c_paludis_module, "UserMask", c_mask);
        rb_define_method(c_user_mask, "token",                template_methods, 0);

        /*
         * Document-class: Paludis::UnacceptedMask
         *
         * An UnacceptedMask is a Mask that signifies that a particular value or combination of values in
         * (for example) a MetadataCollectionKey or MetadataSpecTreeKey is not accepted by user configuration.
         */
        c_unaccepted_mask = rb_define_class_under(c_paludis_module, "UnacceptedMask", c_mask);
        rb_define_method(c_unaccepted_mask, "unaccepted_key_name",                template_methods, 0);

        /*
         * Document-class: Paludis::RepositoryMask
         *
         * A RepositoryMask is a Mask that signifies that a PackageID has been marked as masked by a Repository.
         */
        c_repository_mask = rb_define_class_under(c_paludis_module, "RepositoryMask", c_mask);
        rb_define_method(c_repository_mask, "token",                template_methods, 0);

        /*
         * Document-class: Paludis::UnsupportedMask
         *
         *  An UnsupportedMask is a Mask that signifies that a PackageID is not supported, for example because
         *  it is broken or because it uses an unrecognised EAPI.
         */
        c_unsupported_mask = rb_define_class_under(c_paludis_module, "UnsupportedMask", c_mask);
        rb_define_method(c_unsupported_mask, "explanation",                template_methods, 0);

        /*
         * Document-class: Paludis::OverriddenMask
         *
         * An OverriddenMask holds a Mask and an explanation of why it has been overridden.
         */
        c_overridden_mask = rb_define_class_under(c_paludis_module, "OverriddenMask", rb_cObject);
        rb_define_method(c_overridden_mask, "mask", overridden_mask_mask, 0);
        rb_define_method(c_overridden_mask, "override_reason", overridden_mask_override_reason, 0);

        /*
         * Document-module: Paludis::MaskOverrideReason
         *
         * The reason an OverriddenMask is overridden.
         */
        c_mask_override_reason = rb_define_module_under(c_paludis_module, "MaskOverrideReason");
        for (MaskOverrideReason r(static_cast<MaskOverrideReason>(0)), r_end(last_mro) ; r != r_end ;
                r = static_cast<MaskOverrideReason>(static_cast<int>(r) + 1))
            rb_define_const(c_mask_override_reason, value_case_to_RubyCase(stringify(r)).c_str(), INT2FIX(r));

    }
}
override_reason → MaskOverrideReason click to toggle source
VALUE
    overridden_mask_override_reason(VALUE self)
    {
        std::shared_ptr<const OverriddenMask> * ptr;
        Data_Get_Struct(self, std::shared_ptr<const OverriddenMask>, ptr);
        return INT2FIX((*ptr)->override_reason());
    }


    void do_register_mask()
    {
        /*
         * Document-class: Paludis::Mask
         *
         * A mask represents one reason why a PackageID is masked (not installable).
         * A basic Mask has:
         *
         * * A single character key, which can be used by clients if they need a very compact way of representing a mask.
         *
         * * A description.
         *
         * Subclasses provide additional information.
         */
        c_mask = rb_define_class_under(c_paludis_module, "Mask", rb_cObject);
        rb_funcall(c_mask, rb_intern("private_class_method"), 1, rb_str_new2("new"));
        rb_define_method(c_mask, "key", mask_key, 0);
        rb_define_method(c_mask, "description",                template_methods, 0);
        rb_define_method(c_mask, "initialize", mask_init, -1);

        /*
         * Document-class: Paludis::UserMask
         *
         * A UserMask is a Mask due to user configuration.
         */
        c_user_mask = rb_define_class_under(c_paludis_module, "UserMask", c_mask);
        rb_define_method(c_user_mask, "token",                template_methods, 0);

        /*
         * Document-class: Paludis::UnacceptedMask
         *
         * An UnacceptedMask is a Mask that signifies that a particular value or combination of values in
         * (for example) a MetadataCollectionKey or MetadataSpecTreeKey is not accepted by user configuration.
         */
        c_unaccepted_mask = rb_define_class_under(c_paludis_module, "UnacceptedMask", c_mask);
        rb_define_method(c_unaccepted_mask, "unaccepted_key_name",                template_methods, 0);

        /*
         * Document-class: Paludis::RepositoryMask
         *
         * A RepositoryMask is a Mask that signifies that a PackageID has been marked as masked by a Repository.
         */
        c_repository_mask = rb_define_class_under(c_paludis_module, "RepositoryMask", c_mask);
        rb_define_method(c_repository_mask, "token",                template_methods, 0);

        /*
         * Document-class: Paludis::UnsupportedMask
         *
         *  An UnsupportedMask is a Mask that signifies that a PackageID is not supported, for example because
         *  it is broken or because it uses an unrecognised EAPI.
         */
        c_unsupported_mask = rb_define_class_under(c_paludis_module, "UnsupportedMask", c_mask);
        rb_define_method(c_unsupported_mask, "explanation",                template_methods, 0);

        /*
         * Document-class: Paludis::OverriddenMask
         *
         * An OverriddenMask holds a Mask and an explanation of why it has been overridden.
         */
        c_overridden_mask = rb_define_class_under(c_paludis_module, "OverriddenMask", rb_cObject);
        rb_define_method(c_overridden_mask, "mask", overridden_mask_mask, 0);
        rb_define_method(c_overridden_mask, "override_reason", overridden_mask_override_reason, 0);

        /*
         * Document-module: Paludis::MaskOverrideReason
         *
         * The reason an OverriddenMask is overridden.
         */
        c_mask_override_reason = rb_define_module_under(c_paludis_module, "MaskOverrideReason");
        for (MaskOverrideReason r(static_cast<MaskOverrideReason>(0)), r_end(last_mro) ; r != r_end ;
                r = static_cast<MaskOverrideReason>(static_cast<int>(r) + 1))
            rb_define_const(c_mask_override_reason, value_case_to_RubyCase(stringify(r)).c_str(), INT2FIX(r));

    }
}