deprecated/buildtools/buildsystemtools/lib/XML/DOM/DOMException.pm
author kelvzhu
Mon, 18 Oct 2010 16:16:46 +0800
changeset 655 3f65fd25dfd4
permissions -rw-r--r--
sync up SVN codes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
655
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     1
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     2
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     3
# All rights reserved.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     4
# This component and the accompanying materials are made available
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     5
# under the terms of "Eclipse Public License v1.0"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     6
# which accompanies this distribution, and is available
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     8
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     9
# Initial Contributors:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    11
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    12
# Contributors:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    13
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    14
# Description: 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    15
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    16
######################################################################
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    17
package XML::DOM::DOMException;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    18
######################################################################
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    19
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    20
use Exporter;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    21
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    22
use overload '""' => \&stringify;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    23
use vars qw ( @ISA @EXPORT @ErrorNames );
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    24
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    25
BEGIN
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    26
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    27
  @ISA = qw( Exporter );
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    28
  @EXPORT = qw( INDEX_SIZE_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    29
		DOMSTRING_SIZE_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    30
		HIERARCHY_REQUEST_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    31
		WRONG_DOCUMENT_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    32
		INVALID_CHARACTER_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    33
		NO_DATA_ALLOWED_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    34
		NO_MODIFICATION_ALLOWED_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    35
		NOT_FOUND_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    36
		NOT_SUPPORTED_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    37
		INUSE_ATTRIBUTE_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    38
	      );
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    39
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    40
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    41
sub UNKNOWN_ERR			() {0;}	# not in the DOM Spec!
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    42
sub INDEX_SIZE_ERR		() {1;}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    43
sub DOMSTRING_SIZE_ERR		() {2;}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    44
sub HIERARCHY_REQUEST_ERR	() {3;}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    45
sub WRONG_DOCUMENT_ERR		() {4;}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    46
sub INVALID_CHARACTER_ERR	() {5;}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    47
sub NO_DATA_ALLOWED_ERR		() {6;}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    48
sub NO_MODIFICATION_ALLOWED_ERR	() {7;}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    49
sub NOT_FOUND_ERR		() {8;}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    50
sub NOT_SUPPORTED_ERR		() {9;}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    51
sub INUSE_ATTRIBUTE_ERR		() {10;}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    52
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    53
@ErrorNames = (
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    54
	       "UNKNOWN_ERR",
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    55
	       "INDEX_SIZE_ERR",
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    56
	       "DOMSTRING_SIZE_ERR",
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    57
	       "HIERARCHY_REQUEST_ERR",
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    58
	       "WRONG_DOCUMENT_ERR",
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    59
	       "INVALID_CHARACTER_ERR",
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    60
	       "NO_DATA_ALLOWED_ERR",
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    61
	       "NO_MODIFICATION_ALLOWED_ERR",
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    62
	       "NOT_FOUND_ERR",
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    63
	       "NOT_SUPPORTED_ERR",
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    64
	       "INUSE_ATTRIBUTE_ERR"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    65
	      );
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    66
sub new
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    67
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    68
    my ($type, $code, $msg) = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    69
    my $self = bless {Code => $code}, $type;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    70
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    71
    $self->{Message} = $msg if defined $msg;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    72
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    73
#    print "=> Exception: " . $self->stringify . "\n"; 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    74
    $self;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    75
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    76
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    77
sub getCode
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    78
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    79
    $_[0]->{Code};
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    80
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    81
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    82
#------------------------------------------------------------
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    83
# Extra method implementations
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    84
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    85
sub getName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    86
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    87
    $ErrorNames[$_[0]->{Code}];
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    88
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    89
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    90
sub getMessage
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    91
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    92
    $_[0]->{Message};
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    93
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    94
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    95
sub stringify
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    96
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    97
    my $self = shift;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    98
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    99
    "XML::DOM::DOMException(Code=" . $self->getCode . ", Name=" .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   100
	$self->getName . ", Message=" . $self->getMessage . ")";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   101
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   102
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   103
1; # package return code