⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 entry.pm

📁 platform file from motorola kernel code
💻 PM
字号:
# The source files are wholly original Motorola proprietary work now being # licensed as BSD, the following Copyright Notice will be added to each source # code file, documentation and other materials with the distribution:# #       Copyright  2006, Motorola, All Rights Reserved.# # This program is licensed under a BSD license with the following terms:# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met:## - Redistributions of source code must retain the above copyright notice, #   this list of conditions and the following disclaimer. ## - Redistributions in binary form must reproduce the above copyright notice, #   this list of conditions and the following disclaimer in the documentation #   and/or other materials provided with the distribution. ## - Neither the name of the MOTOROLA nor the names of its contributors may be #   used to endorse or promote products derived from this software without #   specific prior written permission.### THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE.#package Bom::Entry;use base 'Ref';#==============================================================================##    General Description:#    Create and manipulate bom entry objects##==============================================================================use strict;sub new {	my ($this,$path,$bomsrc,$line) = @_;	my $class = ref($this) || $this;	my $self = {		path  => $path,		attrs => {},		attrlist => [],		file  => $bomsrc,		line  => $line,	};	bless($self,$class);}sub path {	my $self = shift;	$self->{path} = shift if @_;	$self->{path};}sub attrs {	my $self = shift;	my $val;	if (@_) {		my $hash = shift;		$self->{attrs} = Ref::copy($hash);		$self->{attrlist} = [sort(keys(%$hash))];	} else {		$val = Ref::copy($self->{attrs});	}	$val;}sub set_attr {	my $self = shift;	while (@_) {		my ($key,$val) = (shift,shift);		push(@{$self->{attrlist}},$key) unless exists($self->{attrs}{$key});		$self->{attrs}{$key} = $val;	}	();}sub has_attr {	my ($self,$key) = @_;	exists($self->{attrs}{$key});}sub get_attr {	my ($self,$key) = @_;	$self->{attrs}{$key};}sub del_attr {	my $self = shift;	my $attrs = $self->{attrs};	my @attrlist = @{$self->{attrlist}};	foreach my $attr (@_) {		delete($attrs->{$attr});		@attrlist = grep { $_ ne $attr } @attrlist;	}	$self->{attrlist} = \@attrlist;	();}	sub attrpairs {	my $self = shift;	my @pairs;	foreach my $k (@{$self->{attrlist}}) {		my $v = $self->get_attr($k);		my $pair;		unless (defined($v)) {			$pair = $k;		} elsif ($v =~ /\s/o) {			$pair = qq($k='$v');		} else {			$pair = qq($k=$v);		}		push(@pairs,$pair);	}	@pairs;}sub stringify {	my ($self) = @_;		my $string = $self->path."\n";	if (!defined($self->get_attr('bomfile')) && defined($self->{file})) {		$string .= "\tbomfile=$self->{file} bomline=$self->{line}\n";	}	if (@{$self->{attrlist}}) {		$string .= "\t";		$string .= join(' ',$self->attrpairs);		$string .= "\n";	}	$string;}1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -