about summary refs log tree commit diff
path: root/docs/tool/Modules/NaturalDocs/Constants.pm
blob: f9e272b3c76ba635978f7da0adfcf6e51fe53fed (plain)
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
###############################################################################
#
#   Package: NaturalDocs::Constants
#
###############################################################################
#
#   Constants that are used throughout the script.  All are exported by default.
#
###############################################################################

# 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::Constants;

use vars qw(@EXPORT @ISA);
require Exporter;
@ISA = qw(Exporter);

@EXPORT = ('MENU_TITLE', 'MENU_SUBTITLE', 'MENU_FILE', 'MENU_GROUP', 'MENU_TEXT', 'MENU_LINK', 'MENU_FOOTER',
                   'MENU_INDEX', 'MENU_FORMAT', 'MENU_ENDOFORIGINAL', 'MENU_DATA',

                   'MENU_FILE_NOAUTOTITLE', 'MENU_GROUP_UPDATETITLES', 'MENU_GROUP_UPDATESTRUCTURE',
                   'MENU_GROUP_UPDATEORDER', 'MENU_GROUP_HASENDOFORIGINAL',
                   'MENU_GROUP_UNSORTED', 'MENU_GROUP_FILESSORTED',
                   'MENU_GROUP_FILESANDGROUPSSORTED', 'MENU_GROUP_EVERYTHINGSORTED',
                   'MENU_GROUP_ISINDEXGROUP',

                   'FILE_NEW', 'FILE_CHANGED', 'FILE_SAME', 'FILE_DOESNTEXIST');

#
#   Topic: Assumptions
#
#   - No constant here will ever be zero.
#   - All constants are exported by default.
#


###############################################################################
# Group: Virtual Types
# These are only groups of constants, but should be treated like typedefs or enums.  Each one represents a distinct type and
# their values should only be one of their constants or undef.


#
#   Constants: MenuEntryType
#
#   The types of entries that can appear in the menu.
#
#       MENU_TITLE         - The title of the menu.
#       MENU_SUBTITLE   - The sub-title of the menu.
#       MENU_FILE           - A source file, relative to the source directory.
#       MENU_GROUP       - A group.
#       MENU_TEXT          - Arbitrary text.
#       MENU_LINK           - A web link.
#       MENU_FOOTER      - Footer text.
#       MENU_INDEX        - An index.
#       MENU_FORMAT     - The version of Natural Docs the menu file was generated with.
#       MENU_ENDOFORIGINAL - A dummy entry that marks where the original group content ends.  This is used when automatically
#                                           changing the groups so that the alphabetization or lack thereof can be detected without being
#                                           affected by new entries tacked on to the end.
#       MENU_DATA - Data not meant for user editing.
#
#   Dependency:
#
#       <PreviousMenuState.nd> depends on these values all being able to fit into a UInt8, i.e. <= 255.
#
use constant MENU_TITLE => 1;
use constant MENU_SUBTITLE => 2;
use constant MENU_FILE => 3;
use constant MENU_GROUP => 4;
use constant MENU_TEXT => 5;
use constant MENU_LINK => 6;
use constant MENU_FOOTER => 7;
use constant MENU_INDEX => 8;
use constant MENU_FORMAT => 9;
use constant MENU_ENDOFORIGINAL => 10;
use constant MENU_DATA => 11;


#
#   Constants: FileStatus
#
#   What happened to a file since Natural Docs' last execution.
#
#       FILE_NEW                - The file has been added since the last run.
#       FILE_CHANGED        - The file has been modified since the last run.
#       FILE_SAME               - The file hasn't been modified since the last run.
#       FILE_DOESNTEXIST  - The file doesn't exist, or was deleted.
#
use constant FILE_NEW => 1;
use constant FILE_CHANGED => 2;
use constant FILE_SAME => 3;
use constant FILE_DOESNTEXIST => 4;



###############################################################################
# Group: Flags
# These constants can be combined with each other.


#
#   Constants: Menu Entry Flags
#
#   The various flags that can apply to a menu entry.  You cannot mix flags of different types, since they may overlap.
#
#   File Flags:
#
#       MENU_FILE_NOAUTOTITLE - Whether the file is auto-titled or not.
#
#   Group Flags:
#
#       MENU_GROUP_UPDATETITLES - The group should have its auto-titles regenerated.
#       MENU_GROUP_UPDATESTRUCTURE - The group should be checked for structural changes, such as being removed or being
#                                                             split into subgroups.
#       MENU_GROUP_UPDATEORDER - The group should be resorted.
#
#       MENU_GROUP_HASENDOFORIGINAL - Whether the group contains a dummy <MENU_ENDOFORIGINAL> entry.
#       MENU_GROUP_ISINDEXGROUP - Whether the group is used primarily for <MENU_INDEX> entries.  <MENU_TEXT> entries
#                                                       are tolerated.
#
#       MENU_GROUP_UNSORTED - The group's contents are not sorted.
#       MENU_GROUP_FILESSORTED - The group's files are sorted alphabetically.
#       MENU_GROUP_FILESANDGROUPSSORTED - The group's files and sub-groups are sorted alphabetically.
#       MENU_GROUP_EVERYTHINGSORTED - All entries in the group are sorted alphabetically.
#
use constant MENU_FILE_NOAUTOTITLE => 0x0001;

use constant MENU_GROUP_UPDATETITLES => 0x0001;
use constant MENU_GROUP_UPDATESTRUCTURE => 0x0002;
use constant MENU_GROUP_UPDATEORDER => 0x0004;
use constant MENU_GROUP_HASENDOFORIGINAL => 0x0008;

# 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.
use constant MENU_GROUP_UNSORTED => 0x0010;
use constant MENU_GROUP_FILESSORTED => 0x0020;
use constant MENU_GROUP_FILESANDGROUPSSORTED => 0x0040;
use constant MENU_GROUP_EVERYTHINGSORTED => 0x0080;

use constant MENU_GROUP_ISINDEXGROUP => 0x0100;




###############################################################################
# Group: Support Functions


#
#   Function: IsClassHierarchyReference
#   Returns whether the passed <ReferenceType> belongs to <NaturalDocs::ClassHierarchy>.
#
sub IsClassHierarchyReference #(reference)
    {
    my ($self, $reference) = @_;
    return ($reference == ::REFERENCE_CH_CLASS() || $reference == ::REFERENCE_CH_PARENT());
    };



1;