OSDN Git Service

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