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';
25 return pretty( shift );
28 sub restrictRex( $$ ) {
29 my( $self, $restrict ) = @_;
30 return PciIds::Address::new( $self->get().'/0000' )->restrictRex( $restrict );#Nasty trick, get the right address of any subnode and try it there
38 my( $self, $suffix ) = @_;
40 if( $self->{'value'} =~ /^PC/ ) {#PCI
41 return ( undef, "Invalid ID syntax" ) unless ( $suffix =~ /^[0-9a-f]{4,4}$/ );
42 } else {#PCI Device Class
43 return ( undef, "Invalid ID syntax" ) unless ( $suffix =~ /^[0-9a-f]{2,2}$/ );
45 return ( PciIds::Address::new( $self->{'value'} . ( ( $self->{'value'} =~ /\/$/ ) ? '' : '/' ) . $suffix ), undef );
48 sub canDiscuss( $ ) { return 0; }
50 sub defaultRestrict( $ ) {
52 if( $self->get() =~ /^PC/ ) {
59 sub defaultRestrictList( $ ) {
61 if( $self->get() =~ /^PC/ ) {
63 for(my $i = '0'; $i < '10'; ++ $i ) {
66 push @result, ( 'a', 'b', 'c', 'd', 'e', 'f' );
68 push @final, [ $_, $_ ] foreach( @result );
69 push @final, [ "", "all" ];
82 if( $self->{'value'} =~ /^PC/ ) {
91 if( $self->get() =~ /^PC/ ) {
94 return 'Device classes';
100 if( $self->get() =~ /^PC/ ) {