1 package PciIds::Address::PciClass;
4 use PciIds::Address::Toplevel;
5 use base 'PciIds::Address::Base';
9 return PciIds::Address::Toplevel::new( $address ) if( $address =~ /^PD\/?$/ );
10 return bless PciIds::Address::Base::new( $address );
20 $prefix = 'Program interface';
22 $prefix = 'Device subclass';
24 $prefix = 'Device class';
26 #TODO Other levels? Are the names OK?
27 return $prefix.' '.$_;
30 sub restrictRex( $$ ) {
31 my( $self, $restrict ) = @_;
32 my( $result ) = ( $restrict =~ /^([a-f0-9]{1,2})/ );#TODO every time?
37 return shift->get() =~ /\/.*\/.*\//;
41 my( $self, $suffix ) = @_;
42 return ( undef, 'You can not add to leaf node' ) if( $self->leaf() );
43 return ( undef, "Invalid ID syntax" ) unless ( $suffix =~ /^[0-9a-f]{2,2}$/ );
44 return ( PciIds::Address::new( $self->{'value'} . ( ( $self->{'value'} =~ /\/$/ ) ? '' : '/' ) . $suffix ), undef );