1 package PciIds::Address::Toplevel;
4 use base 'PciIds::Address::Base';
8 if( $value =~ /^P[CD]\/?/ ) {
9 return bless PciIds::Address::Base::new( $value );
17 if( $self->{'value'} =~ /^PC/ ) {
20 return 'PCI Device Classes';
24 sub restrictRex( $$ ) {
25 my( $self, $restrict ) = @_;
26 return PciIds::Address::new( $self->get().'/0000' )->restrictRex( $restrict );#Nasty trick, get the right address of any subnode and try it there
34 my( $self, $suffix ) = @_;
36 if( $self->{'value'} =~ /^PC/ ) {#PCI
37 return ( undef, "Invalid ID syntax" ) unless ( $suffix =~ /^[0-9a-f]{4,4}$/ );
38 } else {#PCI Device Class
39 return ( undef, "Invalid ID syntax" ) unless ( $suffix =~ /^[0-9a-f]{2,2}$/ );
41 return ( PciIds::Address::Base::new( $self->{'value'} . ( ( $self->{'value'} =~ /\/$/ ) ? '' : '/' ) . $suffix ), undef );
44 sub canAddDiscuss( $ ) { return 0; }
46 sub defaultRestrict( $ ) {
48 if( $self->get() =~ /PC/ ) {
55 sub defaultRestrictList( $ ) {
57 if( $self->get() =~ /PC/ ) {
59 for(my $i = '0'; $i < '10'; ++ $i ) {
62 push @result, ( 'a', 'b', 'c', 'd', 'e', 'f' );
64 push @final, [ $_, $_ ] foreach( @result );
65 push @final, [ "", "all" ];