| 1 | #============================================================= -*-perl-*- | ||
| 2 | # | ||
| 3 | # XML::Schema::Annotation.pm | ||
| 4 | # | ||
| 5 | # DESCRIPTION | ||
| 6 | # Module implementing a mixin class for adding functionality to | ||
| 7 | # annotate objects. | ||
| 8 | # | ||
| 9 | # AUTHOR | ||
| 10 | # Andy Wardley <abw@kfs.org> | ||
| 11 | # | ||
| 12 | # COPYRIGHT | ||
| 13 | # Copyright (C) 2001 Canon Research Centre Europe Ltd. | ||
| 14 | # All Rights Reserved. | ||
| 15 | # | ||
| 16 | # This module is free software; you can redistribute it and/or | ||
| 17 | # modify it under the same terms as Perl itself. | ||
| 18 | # | ||
| 19 | # REVISION | ||
| 20 | # $Id: Annotation.pm,v 1.1.1.1 2001/08/29 14:30:17 abw Exp $ | ||
| 21 | # | ||
| 22 | #======================================================================== | ||
| 23 | |||
| 24 | package XML::Schema::Annotation; | ||
| 25 | |||
| 26 | use strict; | ||
| 27 | use base qw( XML::Schema::Base ); | ||
| 28 | use vars qw( $VERSION $DEBUG $ERROR ); | ||
| 29 | |||
| 30 | $VERSION = sprintf("%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/); | ||
| 31 | $DEBUG = 0 unless defined $DEBUG; | ||
| 32 | $ERROR = ''; | ||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | #------------------------------------------------------------------------ | ||
| 37 | # init() | ||
| 38 | #------------------------------------------------------------------------ | ||
| 39 | |||
| 40 | *init_annotation = \&init; | ||
| 41 | |||
| 42 | sub init { | ||
| 43 | my ($self, $config) = @_; | ||
| 44 | return $self; | ||
| 45 | } | ||
| 46 | |||
| 47 | sub add_annotation { | ||
| 48 | my ($self, $type, $note) = @_; | ||
| 49 | $self->{"_ANNOTATE_\U$type"} = $note; | ||
| 50 | |||
| 51 | $self->TRACE("annotating ", $self, " with [$type] [$note]\n"); | ||
| 52 | } | ||
| 53 | |||
| 54 | sub get_annotation { | ||
| 55 | my ($self, $type, $note) = @_; | ||
| 56 | $self->TRACE("fetching annotating [$type] from ", $self); | ||
| 57 | return $self->{"_ANNOTATE_\U$type"}; | ||
| 58 | } | ||
| 59 | |||
| 60 | 1; |