OSDN Git Service

Version 5.91
[vbslib/main.git] / GPL_bin_fullset / NaturalDocs / Modules / NaturalDocs / Constants.pm
1 ###############################################################################
2 #
3 #   Package: NaturalDocs::Constants
4 #
5 ###############################################################################
6 #
7 #   Constants that are used throughout the script.  All are exported by default.
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::Constants;
19
20 use vars qw(@EXPORT @ISA);
21 require Exporter;
22 @ISA = qw(Exporter);
23
24 @EXPORT = ('MENU_TITLE', 'MENU_SUBTITLE', 'MENU_FILE', 'MENU_GROUP', 'MENU_TEXT', 'MENU_LINK', 'MENU_FOOTER',
25                    'MENU_INDEX', 'MENU_FORMAT', 'MENU_ENDOFORIGINAL', 'MENU_DATA',
26
27                    'MENU_FILE_NOAUTOTITLE', 'MENU_GROUP_UPDATETITLES', 'MENU_GROUP_UPDATESTRUCTURE',
28                    'MENU_GROUP_UPDATEORDER', 'MENU_GROUP_HASENDOFORIGINAL',
29                    'MENU_GROUP_UNSORTED', 'MENU_GROUP_FILESSORTED',
30                    'MENU_GROUP_FILESANDGROUPSSORTED', 'MENU_GROUP_EVERYTHINGSORTED',
31                    'MENU_GROUP_ISINDEXGROUP',
32
33                    'FILE_NEW', 'FILE_CHANGED', 'FILE_SAME', 'FILE_DOESNTEXIST');
34
35 #
36 #   Topic: Assumptions
37 #
38 #   - No constant here will ever be zero.
39 #   - All constants are exported by default.
40 #
41
42
43 ###############################################################################
44 # Group: Virtual Types
45 # These are only groups of constants, but should be treated like typedefs or enums.  Each one represents a distinct type and
46 # their values should only be one of their constants or undef.
47
48
49 #
50 #   Constants: MenuEntryType
51 #
52 #   The types of entries that can appear in the menu.
53 #
54 #       MENU_TITLE         - The title of the menu.
55 #       MENU_SUBTITLE   - The sub-title of the menu.
56 #       MENU_FILE           - A source file, relative to the source directory.
57 #       MENU_GROUP       - A group.
58 #       MENU_TEXT          - Arbitrary text.
59 #       MENU_LINK           - A web link.
60 #       MENU_FOOTER      - Footer text.
61 #       MENU_INDEX        - An index.
62 #       MENU_FORMAT     - The version of Natural Docs the menu file was generated with.
63 #       MENU_ENDOFORIGINAL - A dummy entry that marks where the original group content ends.  This is used when automatically
64 #                                           changing the groups so that the alphabetization or lack thereof can be detected without being
65 #                                           affected by new entries tacked on to the end.
66 #       MENU_DATA - Data not meant for user editing.
67 #
68 #   Dependency:
69 #
70 #       <PreviousMenuState.nd> depends on these values all being able to fit into a UInt8, i.e. <= 255.
71 #
72 use constant MENU_TITLE => 1;
73 use constant MENU_SUBTITLE => 2;
74 use constant MENU_FILE => 3;
75 use constant MENU_GROUP => 4;
76 use constant MENU_TEXT => 5;
77 use constant MENU_LINK => 6;
78 use constant MENU_FOOTER => 7;
79 use constant MENU_INDEX => 8;
80 use constant MENU_FORMAT => 9;
81 use constant MENU_ENDOFORIGINAL => 10;
82 use constant MENU_DATA => 11;
83
84
85 #
86 #   Constants: FileStatus
87 #
88 #   What happened to a file since Natural Docs' last execution.
89 #
90 #       FILE_NEW                - The file has been added since the last run.
91 #       FILE_CHANGED        - The file has been modified since the last run.
92 #       FILE_SAME               - The file hasn't been modified since the last run.
93 #       FILE_DOESNTEXIST  - The file doesn't exist, or was deleted.
94 #
95 use constant FILE_NEW => 1;
96 use constant FILE_CHANGED => 2;
97 use constant FILE_SAME => 3;
98 use constant FILE_DOESNTEXIST => 4;
99
100
101
102 ###############################################################################
103 # Group: Flags
104 # These constants can be combined with each other.
105
106
107 #
108 #   Constants: Menu Entry Flags
109 #
110 #   The various flags that can apply to a menu entry.  You cannot mix flags of different types, since they may overlap.
111 #
112 #   File Flags:
113 #
114 #       MENU_FILE_NOAUTOTITLE - Whether the file is auto-titled or not.
115 #
116 #   Group Flags:
117 #
118 #       MENU_GROUP_UPDATETITLES - The group should have its auto-titles regenerated.
119 #       MENU_GROUP_UPDATESTRUCTURE - The group should be checked for structural changes, such as being removed or being
120 #                                                             split into subgroups.
121 #       MENU_GROUP_UPDATEORDER - The group should be resorted.
122 #
123 #       MENU_GROUP_HASENDOFORIGINAL - Whether the group contains a dummy <MENU_ENDOFORIGINAL> entry.
124 #       MENU_GROUP_ISINDEXGROUP - Whether the group is used primarily for <MENU_INDEX> entries.  <MENU_TEXT> entries
125 #                                                       are tolerated.
126 #
127 #       MENU_GROUP_UNSORTED - The group's contents are not sorted.
128 #       MENU_GROUP_FILESSORTED - The group's files are sorted alphabetically.
129 #       MENU_GROUP_FILESANDGROUPSSORTED - The group's files and sub-groups are sorted alphabetically.
130 #       MENU_GROUP_EVERYTHINGSORTED - All entries in the group are sorted alphabetically.
131 #
132 use constant MENU_FILE_NOAUTOTITLE => 0x0001;
133
134 use constant MENU_GROUP_UPDATETITLES => 0x0001;
135 use constant MENU_GROUP_UPDATESTRUCTURE => 0x0002;
136 use constant MENU_GROUP_UPDATEORDER => 0x0004;
137 use constant MENU_GROUP_HASENDOFORIGINAL => 0x0008;
138
139 # This could really be a two-bit field instead of four flags, but it's not worth the effort since it's only used internally.
140 use constant MENU_GROUP_UNSORTED => 0x0010;
141 use constant MENU_GROUP_FILESSORTED => 0x0020;
142 use constant MENU_GROUP_FILESANDGROUPSSORTED => 0x0040;
143 use constant MENU_GROUP_EVERYTHINGSORTED => 0x0080;
144
145 use constant MENU_GROUP_ISINDEXGROUP => 0x0100;
146
147
148
149
150 ###############################################################################
151 # Group: Support Functions
152
153
154 #
155 #   Function: IsClassHierarchyReference
156 #   Returns whether the passed <ReferenceType> belongs to <NaturalDocs::ClassHierarchy>.
157 #
158 sub IsClassHierarchyReference #(reference)
159     {
160     my ($self, $reference) = @_;
161     return ($reference == ::REFERENCE_CH_CLASS() || $reference == ::REFERENCE_CH_PARENT());
162     };
163
164
165
166 1;