1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
###############################################################################
#
# Package: NaturalDocs::SymbolTable::SymbolDefinition
#
###############################################################################
#
# A class representing a symbol definition. This does not store the definition symbol, class, or file.
#
###############################################################################
# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
# Natural Docs is licensed under the GPL
use strict;
use integer;
package NaturalDocs::SymbolTable::SymbolDefinition;
###############################################################################
# Group: Implementation
#
# Constants: Members
#
# The class is implemented as a blessed arrayref. The following constants are its members.
#
# TYPE - The symbol <TopicType>.
# PROTOTYPE - The symbol's prototype, if applicable. Will be undef otherwise.
# SUMMARY - The symbol's summary, if applicable. Will be undef otherwise.
#
use constant TYPE => 0;
use constant PROTOTYPE => 1;
use constant SUMMARY => 2;
# New depends on the order of the constants.
###############################################################################
# Group: Functions
#
# Function: New
#
# Creates and returns a new object.
#
# Parameters:
#
# type - The symbol <TopicType>.
# prototype - The symbol prototype, if applicable. Undef otherwise.
# summary - The symbol's summary, if applicable. Undef otherwise.
#
sub New #(type, prototype, summary)
{
# This depends on the parameter list being the same as the constant order.
my $package = shift;
my $object = [ @_ ];
bless $object, $package;
return $object;
};
# Function: Type
# Returns the definition's <TopicType>.
sub Type
{ return $_[0]->[TYPE]; };
# Function: SetType
# Changes the <TopicType>.
sub SetType #(type)
{ $_[0]->[TYPE] = $_[1]; };
# Function: Prototype
# Returns the definition's prototype, or undef if it doesn't have one.
sub Prototype
{ return $_[0]->[PROTOTYPE]; };
# Function: SetPrototype
# Changes the prototype.
sub SetPrototype #(prototype)
{ $_[0]->[PROTOTYPE] = $_[1]; };
# Function: Summary
# Returns the definition's summary, or undef if it doesn't have one.
sub Summary
{ return $_[0]->[SUMMARY]; };
# Function: SetSummary
# Changes the summary.
sub SetSummary #(summary)
{ $_[0]->[SUMMARY] = $_[1]; };
1;
|