bixbite 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.markdown +49 -0
- data/VERSION +1 -0
- data/bin/bixbite +73 -0
- data/lib/bixbite.rb +13 -0
- data/lib/bixbite/command.rb +14 -0
- data/lib/bixbite/create.rb +76 -0
- data/template/Rakefile +25 -0
- data/template/assets/bixbite/Rakefile.rb +297 -0
- data/template/assets/naturaldocs/NaturalDocs/Config/Languages.txt +286 -0
- data/template/assets/naturaldocs/NaturalDocs/Config/Topics.txt +382 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/customizinglanguages.html +52 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/customizingtopics.html +74 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting.html +58 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting/reference.html +146 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting/walkthrough.html +180 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/example/Default.css +528 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/example/NaturalDocs.js +204 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/examples.css +90 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/background.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/leftside.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/logo.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbody.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbodybg.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overleftmargin.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenu.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenubg.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/rightside.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/logo.gif +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/about.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/background.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomleft.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomright.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/community.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/customizing.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/using.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/index.html +9 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/javascript/BrowserStyles.js +77 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/javascript/PNGHandling.js +72 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/keywords.html +38 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/languages.html +32 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/menu.html +79 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/output.html +84 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/running.html +40 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/styles.css +290 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/styles.html +52 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/troubleshooting.html +18 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/CSSGuide.txt +947 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/File Parsing.txt +83 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/HTMLTestCases.pm +269 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/Languages.txt +107 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/NDMarkup.txt +91 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/Symbol Management.txt +59 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/images/Logo.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/JavaScript/NaturalDocs.js +836 -0
- data/template/assets/naturaldocs/NaturalDocs/License-GPL.txt +341 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/BinaryFile.pm +294 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder.pm +280 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/Base.pm +348 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/FramedHTML.pm +345 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTML.pm +398 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTMLBase.pm +3693 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy.pm +860 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/Class.pm +412 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/File.pm +157 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ConfigFile.pm +497 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Constants.pm +165 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/DefineMembers.pm +100 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Error.pm +305 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/File.pm +540 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable.pm +383 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/Reference.pm +44 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/String.pm +110 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages.pm +1475 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/ActionScript.pm +1473 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Ada.pm +38 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced.pm +828 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/Scope.pm +95 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm +70 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Base.pm +832 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/CSharp.pm +1484 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/PLSQL.pm +319 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Pascal.pm +143 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Perl.pm +1370 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype.pm +92 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype/Parameter.pm +87 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Simple.pm +503 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Tcl.pm +219 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu.pm +3406 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu/Entry.pm +201 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/NDMarkup.pm +76 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser.pm +1331 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/JavaDoc.pm +464 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/Native.pm +1060 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/ParsedTopic.pm +253 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project.pm +1402 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/ImageFile.pm +160 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/SourceFile.pm +113 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ReferenceString.pm +334 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings.pm +1418 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings/BuildTarget.pm +66 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB.pm +678 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Extension.pm +84 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/File.pm +129 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Item.pm +201 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/ItemDefinition.pm +45 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm +159 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/StatusMessage.pm +102 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolString.pm +212 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable.pm +1984 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/File.pm +186 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/IndexElement.pm +522 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Reference.pm +273 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/ReferenceTarget.pm +97 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Symbol.pm +428 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/SymbolDefinition.pm +96 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics.pm +1319 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics/Type.pm +151 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Version.pm +384 -0
- data/template/assets/naturaldocs/NaturalDocs/NaturalDocs +400 -0
- data/template/assets/naturaldocs/NaturalDocs/NaturalDocs.bat +17 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Default.css +767 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Roman.css +765 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Small.css +763 -0
- data/template/assets/utilities/pngout +0 -0
- data/template/deploy/public_html/.htaccess +0 -0
- data/template/documentation/js/.htaccess +0 -0
- data/template/src/html/.htaccess +76 -0
- data/template/src/html/css/cmn/global.css +96 -0
- data/template/src/html/css/cmn/ie.css +15 -0
- data/template/src/html/css/cmn/ie6.css +15 -0
- data/template/src/html/images/cmn/.htaccess +0 -0
- data/template/src/html/images/tmp/.htaccess +0 -0
- data/template/src/html/includes/debug.inc +5 -0
- data/template/src/html/includes/footer.inc +52 -0
- data/template/src/html/includes/header.inc +61 -0
- data/template/src/html/includes/html.inc +3 -0
- data/template/src/html/includes/namespace.inc +19 -0
- data/template/src/html/includes/page.inc +151 -0
- data/template/src/html/index.html +35 -0
- data/template/src/html/js/cmn/bootstrap.js +74 -0
- data/template/src/html/js/cmn/global.js +142 -0
- data/template/src/html/js/cmn/lib/LAB.js +348 -0
- data/template/src/html/min/.htaccess +4 -0
- data/template/src/html/min/MinifyCLI.php +19 -0
- data/template/src/html/min/README.txt +132 -0
- data/template/src/html/min/builder/_index.js +242 -0
- data/template/src/html/min/builder/bm.js +36 -0
- data/template/src/html/min/builder/index.php +182 -0
- data/template/src/html/min/builder/ocCheck.php +36 -0
- data/template/src/html/min/builder/rewriteTest.js +1 -0
- data/template/src/html/min/config.php +187 -0
- data/template/src/html/min/groupsConfig.php +34 -0
- data/template/src/html/min/index.php +66 -0
- data/template/src/html/min/lib/FirePHP.php +1370 -0
- data/template/src/html/min/lib/HTTP/ConditionalGet.php +348 -0
- data/template/src/html/min/lib/HTTP/Encoder.php +326 -0
- data/template/src/html/min/lib/JSMin.php +314 -0
- data/template/src/html/min/lib/JSMinPlus.php +1872 -0
- data/template/src/html/min/lib/Minify.php +532 -0
- data/template/src/html/min/lib/Minify/Build.php +103 -0
- data/template/src/html/min/lib/Minify/CSS.php +83 -0
- data/template/src/html/min/lib/Minify/CSS/Compressor.php +250 -0
- data/template/src/html/min/lib/Minify/CSS/UriRewriter.php +270 -0
- data/template/src/html/min/lib/Minify/Cache/APC.php +130 -0
- data/template/src/html/min/lib/Minify/Cache/File.php +125 -0
- data/template/src/html/min/lib/Minify/Cache/Memcache.php +137 -0
- data/template/src/html/min/lib/Minify/ClosureCompiler.php +85 -0
- data/template/src/html/min/lib/Minify/CommentPreserver.php +90 -0
- data/template/src/html/min/lib/Minify/Controller/Base.php +202 -0
- data/template/src/html/min/lib/Minify/Controller/Files.php +78 -0
- data/template/src/html/min/lib/Minify/Controller/Groups.php +94 -0
- data/template/src/html/min/lib/Minify/Controller/MinApp.php +132 -0
- data/template/src/html/min/lib/Minify/Controller/Page.php +82 -0
- data/template/src/html/min/lib/Minify/Controller/Version1.php +118 -0
- data/template/src/html/min/lib/Minify/HTML.php +245 -0
- data/template/src/html/min/lib/Minify/ImportProcessor.php +157 -0
- data/template/src/html/min/lib/Minify/Lines.php +131 -0
- data/template/src/html/min/lib/Minify/Logger.php +45 -0
- data/template/src/html/min/lib/Minify/Packer.php +37 -0
- data/template/src/html/min/lib/Minify/Source.php +187 -0
- data/template/src/html/min/lib/Minify/YUICompressor.php +139 -0
- data/template/src/html/min/lib/Solar/Dir.php +199 -0
- data/template/src/html/min/lib/closure-compiler.jar +0 -0
- data/template/src/html/min/lib/yuicompressor-2.4.2.jar +0 -0
- data/template/src/html/min/utils.php +90 -0
- data/template/src/templates/css/template.css +7 -0
- data/template/src/templates/js/template.js +72 -0
- data/template/src/templates/template.html +18 -0
- data/template/src/yaml/config.yml +46 -0
- data/template/src/yaml/deploy.yml +35 -0
- data/test/bixbite_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +278 -0
@@ -0,0 +1,860 @@
|
|
1
|
+
###############################################################################
|
2
|
+
#
|
3
|
+
# Package: NaturalDocs::ClassHierarchy
|
4
|
+
#
|
5
|
+
###############################################################################
|
6
|
+
#
|
7
|
+
# A package that handles all the gory details of managing the class hierarchy. It handles the hierarchy itself, which files define
|
8
|
+
# them, rebuilding the files that are affected by changes, and loading and saving them to a file.
|
9
|
+
#
|
10
|
+
# Usage and Dependencies:
|
11
|
+
#
|
12
|
+
# - <NaturalDocs::Settings> and <NaturalDocs::Project> must be initialized before use.
|
13
|
+
#
|
14
|
+
# - <NaturalDocs::SymbolTable> must be initialized before <Load()> is called. It must reflect the state as of the last time
|
15
|
+
# Natural Docs was run.
|
16
|
+
#
|
17
|
+
# - <Load()> must be called to initialize the package. At this point, the <Information Functions> will return the state as
|
18
|
+
# of the last time Natural Docs was run. You are free to resolve <NaturalDocs::SymbolTable()> afterwards.
|
19
|
+
#
|
20
|
+
# - <Purge()> must be called, and then <NaturalDocs::Parser->ParseForInformation()> must be called on all files that
|
21
|
+
# have changed so it can fully resolve the hierarchy via the <Modification Functions()>. Afterwards the
|
22
|
+
# <Information Functions> will reflect the current state of the code.
|
23
|
+
#
|
24
|
+
# - <Save()> must be called to commit any changes to the symbol table back to disk.
|
25
|
+
#
|
26
|
+
###############################################################################
|
27
|
+
|
28
|
+
# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
|
29
|
+
# Natural Docs is licensed under the GPL
|
30
|
+
|
31
|
+
|
32
|
+
use strict;
|
33
|
+
use integer;
|
34
|
+
|
35
|
+
use NaturalDocs::ClassHierarchy::Class;
|
36
|
+
use NaturalDocs::ClassHierarchy::File;
|
37
|
+
|
38
|
+
package NaturalDocs::ClassHierarchy;
|
39
|
+
|
40
|
+
|
41
|
+
###############################################################################
|
42
|
+
# Group: Variables
|
43
|
+
|
44
|
+
#
|
45
|
+
# handle: CLASS_HIERARCHY_FILEHANDLE
|
46
|
+
# The file handle used with <ClassHierarchy.nd>.
|
47
|
+
#
|
48
|
+
|
49
|
+
#
|
50
|
+
# hash: classes
|
51
|
+
#
|
52
|
+
# A hash of all the classes. The keys are the class <SymbolStrings> and the values are <NaturalDocs::ClassHierarchy::Classes>.
|
53
|
+
#
|
54
|
+
my %classes;
|
55
|
+
|
56
|
+
#
|
57
|
+
# hash: files
|
58
|
+
#
|
59
|
+
# A hash of the hierarchy information referenced by file. The keys are the <FileNames>, and the values are
|
60
|
+
# <NaturalDocs::ClassHierarchy::File>s.
|
61
|
+
#
|
62
|
+
my %files;
|
63
|
+
|
64
|
+
#
|
65
|
+
# hash: parentReferences
|
66
|
+
#
|
67
|
+
# A hash of all the parent reference strings and what they resolve to. The keys are the <ReferenceStrings> and the values are
|
68
|
+
# the class <SymbolStrings> that they resolve to.
|
69
|
+
#
|
70
|
+
my %parentReferences;
|
71
|
+
|
72
|
+
#
|
73
|
+
# object: watchedFile
|
74
|
+
#
|
75
|
+
# A <NaturalDocs::ClassHierarchy::File> object of the file being watched for changes. This is compared to the version in <files>
|
76
|
+
# to see if anything was changed since the last parse.
|
77
|
+
#
|
78
|
+
my $watchedFile;
|
79
|
+
|
80
|
+
#
|
81
|
+
# string: watchedFileName
|
82
|
+
#
|
83
|
+
# The <FileName> of the watched file, if any. If there is no watched file, this will be undef.
|
84
|
+
#
|
85
|
+
my $watchedFileName;
|
86
|
+
|
87
|
+
#
|
88
|
+
# bool: dontRebuildFiles
|
89
|
+
#
|
90
|
+
# A bool to set if you don't want changes in the hierarchy to cause files to be rebuilt.
|
91
|
+
#
|
92
|
+
my $dontRebuildFiles;
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
###############################################################################
|
97
|
+
# Group: Files
|
98
|
+
|
99
|
+
|
100
|
+
#
|
101
|
+
# File: ClassHierarchy.nd
|
102
|
+
#
|
103
|
+
# Stores the class hierarchy on disk.
|
104
|
+
#
|
105
|
+
# Format:
|
106
|
+
#
|
107
|
+
# > [BINARY_FORMAT]
|
108
|
+
# > [VersionInt: app version]
|
109
|
+
#
|
110
|
+
# The standard <BINARY_FORMAT> and <VersionInt> header.
|
111
|
+
#
|
112
|
+
# > [SymbolString: class or undef to end]
|
113
|
+
#
|
114
|
+
# Next we begin a class segment with its <SymbolString>. These continue until the end of the file. Only defined classes are
|
115
|
+
# included.
|
116
|
+
#
|
117
|
+
# > [UInt32: number of files]
|
118
|
+
# > [AString16: file] [AString16: file] ...
|
119
|
+
#
|
120
|
+
# Next there is the number of files that define that class. It's a UInt32, which seems like overkill, but I could imagine every
|
121
|
+
# file in a huge C++ project being under the same namespace, and thus contributing its own definition. It's theoretically
|
122
|
+
# possible.
|
123
|
+
#
|
124
|
+
# Following the number is that many file names. You must remember the index of each file, as they will be important later.
|
125
|
+
# Indexes start at one because zero has a special meaning.
|
126
|
+
#
|
127
|
+
# > [UInt8: number of parents]
|
128
|
+
# > ( [ReferenceString (no type): parent]
|
129
|
+
# > [UInt32: file index] [UInt32: file index] ... [UInt32: 0] ) ...
|
130
|
+
#
|
131
|
+
# Next there is the number of parents defined for this class. For each one, we define a parent segment, which consists of
|
132
|
+
# its <ReferenceString>, and then a zero-terminated string of indexes of the files that define that parent as part of that class.
|
133
|
+
# The indexes start at one, and are into the list of files we saw previously.
|
134
|
+
#
|
135
|
+
# Note that we do store class segments for classes without parents, but not for undefined classes.
|
136
|
+
#
|
137
|
+
# This concludes a class segment. These segments continue until an undef <SymbolString>.
|
138
|
+
#
|
139
|
+
# See Also:
|
140
|
+
#
|
141
|
+
# <File Format Conventions>
|
142
|
+
#
|
143
|
+
# Revisions:
|
144
|
+
#
|
145
|
+
# 1.22:
|
146
|
+
#
|
147
|
+
# - Classes and parents switched from AString16s to <SymbolStrings> and <ReferenceStrings>.
|
148
|
+
# - A ending undef <SymbolString> was added to the end. Previously it stopped when the file ran out.
|
149
|
+
#
|
150
|
+
# 1.2:
|
151
|
+
#
|
152
|
+
# - This file was introduced in 1.2.
|
153
|
+
#
|
154
|
+
|
155
|
+
|
156
|
+
###############################################################################
|
157
|
+
# Group: File Functions
|
158
|
+
|
159
|
+
|
160
|
+
#
|
161
|
+
# Function: Load
|
162
|
+
#
|
163
|
+
# Loads the class hierarchy from disk.
|
164
|
+
#
|
165
|
+
sub Load
|
166
|
+
{
|
167
|
+
my ($self) = @_;
|
168
|
+
|
169
|
+
$dontRebuildFiles = 1;
|
170
|
+
|
171
|
+
my $fileIsOkay;
|
172
|
+
my $fileName = NaturalDocs::Project->DataFile('ClassHierarchy.nd');
|
173
|
+
|
174
|
+
if (!NaturalDocs::Settings->RebuildData() && open(CLASS_HIERARCHY_FILEHANDLE, '<' . $fileName))
|
175
|
+
{
|
176
|
+
# See if it's binary.
|
177
|
+
binmode(CLASS_HIERARCHY_FILEHANDLE);
|
178
|
+
|
179
|
+
my $firstChar;
|
180
|
+
read(CLASS_HIERARCHY_FILEHANDLE, $firstChar, 1);
|
181
|
+
|
182
|
+
if ($firstChar != ::BINARY_FORMAT())
|
183
|
+
{
|
184
|
+
close(CLASS_HIERARCHY_FILEHANDLE);
|
185
|
+
}
|
186
|
+
else
|
187
|
+
{
|
188
|
+
my $version = NaturalDocs::Version->FromBinaryFile(\*CLASS_HIERARCHY_FILEHANDLE);
|
189
|
+
|
190
|
+
# Minor bugs were fixed in 1.33 that may affect the stored data.
|
191
|
+
|
192
|
+
if (NaturalDocs::Version->CheckFileFormat( $version, NaturalDocs::Version->FromString('1.33') ))
|
193
|
+
{ $fileIsOkay = 1; }
|
194
|
+
else
|
195
|
+
{ close(CLASS_HIERARCHY_FILEHANDLE); };
|
196
|
+
};
|
197
|
+
};
|
198
|
+
|
199
|
+
|
200
|
+
if (!$fileIsOkay)
|
201
|
+
{
|
202
|
+
NaturalDocs::Project->ReparseEverything();
|
203
|
+
}
|
204
|
+
else
|
205
|
+
{
|
206
|
+
my $raw;
|
207
|
+
|
208
|
+
for (;;)
|
209
|
+
{
|
210
|
+
# [SymbolString: class or undef to end]
|
211
|
+
|
212
|
+
my $class = NaturalDocs::SymbolString->FromBinaryFile(\*CLASS_HIERARCHY_FILEHANDLE);
|
213
|
+
|
214
|
+
if (!defined $class)
|
215
|
+
{ last; };
|
216
|
+
|
217
|
+
# [UInt32: number of files]
|
218
|
+
|
219
|
+
read(CLASS_HIERARCHY_FILEHANDLE, $raw, 4);
|
220
|
+
my $numberOfFiles = unpack('N', $raw);
|
221
|
+
|
222
|
+
my @files;
|
223
|
+
|
224
|
+
while ($numberOfFiles)
|
225
|
+
{
|
226
|
+
# [AString16: file]
|
227
|
+
|
228
|
+
read(CLASS_HIERARCHY_FILEHANDLE, $raw, 2);
|
229
|
+
my $fileLength = unpack('n', $raw);
|
230
|
+
|
231
|
+
my $file;
|
232
|
+
read(CLASS_HIERARCHY_FILEHANDLE, $file, $fileLength);
|
233
|
+
|
234
|
+
push @files, $file;
|
235
|
+
$self->AddClass($file, $class, NaturalDocs::Languages->LanguageOf($file)->Name());
|
236
|
+
|
237
|
+
$numberOfFiles--;
|
238
|
+
};
|
239
|
+
|
240
|
+
# [UInt8: number of parents]
|
241
|
+
|
242
|
+
read(CLASS_HIERARCHY_FILEHANDLE, $raw, 1);
|
243
|
+
my $numberOfParents = unpack('C', $raw);
|
244
|
+
|
245
|
+
while ($numberOfParents)
|
246
|
+
{
|
247
|
+
# [ReferenceString (no type): parent]
|
248
|
+
|
249
|
+
my $parent = NaturalDocs::ReferenceString->FromBinaryFile(\*CLASS_HIERARCHY_FILEHANDLE,
|
250
|
+
::BINARYREF_NOTYPE(),
|
251
|
+
::REFERENCE_CH_PARENT());
|
252
|
+
|
253
|
+
for (;;)
|
254
|
+
{
|
255
|
+
# [UInt32: file index or 0]
|
256
|
+
|
257
|
+
read(CLASS_HIERARCHY_FILEHANDLE, $raw, 4);
|
258
|
+
my $fileIndex = unpack('N', $raw);
|
259
|
+
|
260
|
+
if ($fileIndex == 0)
|
261
|
+
{ last; }
|
262
|
+
|
263
|
+
$self->AddParentReference( $files[$fileIndex - 1], $class, $parent );
|
264
|
+
};
|
265
|
+
|
266
|
+
$numberOfParents--;
|
267
|
+
};
|
268
|
+
};
|
269
|
+
|
270
|
+
close(CLASS_HIERARCHY_FILEHANDLE);
|
271
|
+
};
|
272
|
+
|
273
|
+
$dontRebuildFiles = undef;
|
274
|
+
};
|
275
|
+
|
276
|
+
|
277
|
+
#
|
278
|
+
# Function: Save
|
279
|
+
#
|
280
|
+
# Saves the class hierarchy to disk.
|
281
|
+
#
|
282
|
+
sub Save
|
283
|
+
{
|
284
|
+
my ($self) = @_;
|
285
|
+
|
286
|
+
open (CLASS_HIERARCHY_FILEHANDLE, '>' . NaturalDocs::Project->DataFile('ClassHierarchy.nd'))
|
287
|
+
or die "Couldn't save " . NaturalDocs::Project->DataFile('ClassHierarchy.nd') . ".\n";
|
288
|
+
|
289
|
+
binmode(CLASS_HIERARCHY_FILEHANDLE);
|
290
|
+
|
291
|
+
print CLASS_HIERARCHY_FILEHANDLE '' . ::BINARY_FORMAT();
|
292
|
+
NaturalDocs::Version->ToBinaryFile(\*CLASS_HIERARCHY_FILEHANDLE, NaturalDocs::Settings->AppVersion());
|
293
|
+
|
294
|
+
while (my ($class, $classObject) = each %classes)
|
295
|
+
{
|
296
|
+
if ($classObject->IsDefined())
|
297
|
+
{
|
298
|
+
# [SymbolString: class or undef to end]
|
299
|
+
|
300
|
+
NaturalDocs::SymbolString->ToBinaryFile(\*CLASS_HIERARCHY_FILEHANDLE, $class);
|
301
|
+
|
302
|
+
# [UInt32: number of files]
|
303
|
+
|
304
|
+
my @definitions = $classObject->Definitions();
|
305
|
+
my %definitionIndexes;
|
306
|
+
|
307
|
+
print CLASS_HIERARCHY_FILEHANDLE pack('N', scalar @definitions);
|
308
|
+
|
309
|
+
for (my $i = 0; $i < scalar @definitions; $i++)
|
310
|
+
{
|
311
|
+
# [AString16: file]
|
312
|
+
print CLASS_HIERARCHY_FILEHANDLE pack('nA*', length($definitions[$i]), $definitions[$i]);
|
313
|
+
$definitionIndexes{$definitions[$i]} = $i + 1;
|
314
|
+
};
|
315
|
+
|
316
|
+
# [UInt8: number of parents]
|
317
|
+
|
318
|
+
my @parents = $classObject->ParentReferences();
|
319
|
+
print CLASS_HIERARCHY_FILEHANDLE pack('C', scalar @parents);
|
320
|
+
|
321
|
+
foreach my $parent (@parents)
|
322
|
+
{
|
323
|
+
# [ReferenceString (no type): parent]
|
324
|
+
|
325
|
+
NaturalDocs::ReferenceString->ToBinaryFile(\*CLASS_HIERARCHY_FILEHANDLE, $parent, ::BINARYREF_NOTYPE());
|
326
|
+
|
327
|
+
# [UInt32: file index]
|
328
|
+
|
329
|
+
my @parentDefinitions = $classObject->ParentReferenceDefinitions($parent);
|
330
|
+
|
331
|
+
foreach my $parentDefinition (@parentDefinitions)
|
332
|
+
{
|
333
|
+
print CLASS_HIERARCHY_FILEHANDLE pack('N', $definitionIndexes{$parentDefinition});
|
334
|
+
};
|
335
|
+
|
336
|
+
# [UInt32: 0]
|
337
|
+
print CLASS_HIERARCHY_FILEHANDLE pack('N', 0);
|
338
|
+
};
|
339
|
+
};
|
340
|
+
};
|
341
|
+
|
342
|
+
# [SymbolString: class or undef to end]
|
343
|
+
|
344
|
+
NaturalDocs::SymbolString->ToBinaryFile(\*CLASS_HIERARCHY_FILEHANDLE, undef);
|
345
|
+
|
346
|
+
close(CLASS_HIERARCHY_FILEHANDLE);
|
347
|
+
};
|
348
|
+
|
349
|
+
|
350
|
+
#
|
351
|
+
# Function: Purge
|
352
|
+
#
|
353
|
+
# Purges the hierarchy of files that no longer have Natural Docs content.
|
354
|
+
#
|
355
|
+
sub Purge
|
356
|
+
{
|
357
|
+
my ($self) = @_;
|
358
|
+
|
359
|
+
my $filesToPurge = NaturalDocs::Project->FilesToPurge();
|
360
|
+
|
361
|
+
foreach my $file (keys %$filesToPurge)
|
362
|
+
{
|
363
|
+
$self->DeleteFile($file);
|
364
|
+
};
|
365
|
+
};
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
###############################################################################
|
370
|
+
# Group: Interface Functions
|
371
|
+
|
372
|
+
|
373
|
+
#
|
374
|
+
# Function: OnInterpretationChange
|
375
|
+
#
|
376
|
+
# Called by <NaturalDocs::SymbolTable> whenever a class hierarchy reference's intepretation changes, meaning it switched
|
377
|
+
# from one symbol to another.
|
378
|
+
#
|
379
|
+
# reference - The <ReferenceString> whose current interpretation changed.
|
380
|
+
#
|
381
|
+
sub OnInterpretationChange #(reference)
|
382
|
+
{
|
383
|
+
my ($self, $reference) = @_;
|
384
|
+
|
385
|
+
if (NaturalDocs::ReferenceString->TypeOf($reference) == ::REFERENCE_CH_PARENT())
|
386
|
+
{
|
387
|
+
# The approach here is simply to completely delete the reference and readd it. This is less than optimal efficiency, since it's
|
388
|
+
# being removed and added from %files too, even though that isn't required. However, the simpler code is worth it
|
389
|
+
# considering this will only happen when a parent reference becomes defined or undefined, or on the rare languages (like C#)
|
390
|
+
# that allow relative parent references.
|
391
|
+
|
392
|
+
my $oldTargetSymbol = $parentReferences{$reference};
|
393
|
+
my $oldTargetObject = $classes{$oldTargetSymbol};
|
394
|
+
|
395
|
+
my @classesWithReferenceParent = $oldTargetObject->Children();
|
396
|
+
|
397
|
+
# Each entry is an arrayref of file names. Indexes are the same as classesWithReferenceParent's.
|
398
|
+
my @filesDefiningReferenceParent;
|
399
|
+
|
400
|
+
foreach my $classWithReferenceParent (@classesWithReferenceParent)
|
401
|
+
{
|
402
|
+
my $fileList = [ $classes{$classWithReferenceParent}->ParentReferenceDefinitions($reference) ];
|
403
|
+
push @filesDefiningReferenceParent, $fileList;
|
404
|
+
|
405
|
+
foreach my $fileDefiningReferenceParent (@$fileList)
|
406
|
+
{
|
407
|
+
$self->DeleteParentReference($fileDefiningReferenceParent, $classWithReferenceParent, $reference);
|
408
|
+
};
|
409
|
+
};
|
410
|
+
|
411
|
+
|
412
|
+
# This will force the reference to be reinterpreted on the next add.
|
413
|
+
|
414
|
+
delete $parentReferences{$reference};
|
415
|
+
|
416
|
+
|
417
|
+
# Now we can just readd it.
|
418
|
+
|
419
|
+
for (my $i = 0; $i < scalar @classesWithReferenceParent; $i++)
|
420
|
+
{
|
421
|
+
foreach my $file (@{$filesDefiningReferenceParent[$i]})
|
422
|
+
{
|
423
|
+
$self->AddParentReference($file, $classesWithReferenceParent[$i], $reference);
|
424
|
+
};
|
425
|
+
};
|
426
|
+
};
|
427
|
+
|
428
|
+
# The only way for a REFERENCE_CH_CLASS reference to change is if the symbol is deleted. That will be handled by
|
429
|
+
# <AnalyzeChanges()>, so we don't need to do anything here.
|
430
|
+
};
|
431
|
+
|
432
|
+
|
433
|
+
#
|
434
|
+
# Function: OnTargetSymbolChange
|
435
|
+
#
|
436
|
+
# Called by <NaturalDocs::SymbolTable> whenever a class hierarchy reference's target symbol changes, but the reference
|
437
|
+
# still resolves to the same symbol.
|
438
|
+
#
|
439
|
+
# Parameters:
|
440
|
+
#
|
441
|
+
# reference - The <ReferenceString> that was affected by the change.
|
442
|
+
#
|
443
|
+
sub OnTargetSymbolChange #(reference)
|
444
|
+
{
|
445
|
+
my ($self, $reference) = @_;
|
446
|
+
|
447
|
+
my $type = NaturalDocs::ReferenceString->TypeOf($reference);
|
448
|
+
my $class;
|
449
|
+
|
450
|
+
if ($type == ::REFERENCE_CH_PARENT())
|
451
|
+
{ $class = $parentReferences{$reference}; }
|
452
|
+
else # ($type == ::REFERENCE_CH_CLASS())
|
453
|
+
{
|
454
|
+
# Class references are global absolute, so we can just yank the symbol.
|
455
|
+
(undef, $class, undef, undef, undef, undef) = NaturalDocs::ReferenceString->InformationOf($reference);
|
456
|
+
};
|
457
|
+
|
458
|
+
$self->RebuildFilesFor($class, 1, 0, 1);
|
459
|
+
};
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
###############################################################################
|
464
|
+
# Group: Modification Functions
|
465
|
+
|
466
|
+
|
467
|
+
#
|
468
|
+
# Function: AddClass
|
469
|
+
#
|
470
|
+
# Adds a class to the hierarchy.
|
471
|
+
#
|
472
|
+
# Parameters:
|
473
|
+
#
|
474
|
+
# file - The <FileName> the class was defined in.
|
475
|
+
# class - The class <SymbolString>.
|
476
|
+
# languageName - The name of the language this applies to.
|
477
|
+
#
|
478
|
+
# Note:
|
479
|
+
#
|
480
|
+
# The file parameter must be defined when using this function externally. It may be undef for internal use only.
|
481
|
+
#
|
482
|
+
sub AddClass #(file, class, languageName)
|
483
|
+
{
|
484
|
+
my ($self, $file, $class, $languageName) = @_;
|
485
|
+
|
486
|
+
if (!exists $classes{$class})
|
487
|
+
{
|
488
|
+
$classes{$class} = NaturalDocs::ClassHierarchy::Class->New();
|
489
|
+
NaturalDocs::SymbolTable->AddReference($self->ClassReferenceOf($class, $languageName), $file)
|
490
|
+
};
|
491
|
+
|
492
|
+
if (defined $file)
|
493
|
+
{
|
494
|
+
# If this was the first definition for this class...
|
495
|
+
if ($classes{$class}->AddDefinition($file))
|
496
|
+
{ $self->RebuildFilesFor($class, 1, 1, 1); };
|
497
|
+
|
498
|
+
if (!exists $files{$file})
|
499
|
+
{ $files{$file} = NaturalDocs::ClassHierarchy::File->New(); };
|
500
|
+
|
501
|
+
$files{$file}->AddClass($class);
|
502
|
+
|
503
|
+
if (defined $watchedFileName)
|
504
|
+
{ $watchedFile->AddClass($class); };
|
505
|
+
};
|
506
|
+
};
|
507
|
+
|
508
|
+
|
509
|
+
#
|
510
|
+
# Function: AddParentReference
|
511
|
+
#
|
512
|
+
# Adds a class-parent relationship to the hierarchy. The classes will be created if they don't already exist.
|
513
|
+
#
|
514
|
+
# Parameters:
|
515
|
+
#
|
516
|
+
# file - The <FileName> the reference was defined in.
|
517
|
+
# class - The class <SymbolString>.
|
518
|
+
# symbol - The parent class <SymbolString>.
|
519
|
+
# scope - The package <SymbolString> that the reference appeared in.
|
520
|
+
# using - An arrayref of package <SymbolStrings> that the reference has access to via "using" statements.
|
521
|
+
# resolvingFlags - Any <Resolving Flags> to be used when resolving the reference.
|
522
|
+
#
|
523
|
+
# Alternate Parameters:
|
524
|
+
#
|
525
|
+
# file - The <FileName> the reference was defined in.
|
526
|
+
# class - The class <SymbolString>.
|
527
|
+
# reference - The parent <ReferenceString>.
|
528
|
+
#
|
529
|
+
sub AddParentReference #(file, class, symbol, scope, using, resolvingFlags) or (file, class, reference)
|
530
|
+
{
|
531
|
+
my ($self, $file, $class, $symbol, $parentReference);
|
532
|
+
|
533
|
+
if (scalar @_ == 7)
|
534
|
+
{
|
535
|
+
my ($scope, $using, $resolvingFlags);
|
536
|
+
($self, $file, $class, $symbol, $scope, $using, $resolvingFlags) = @_;
|
537
|
+
|
538
|
+
$parentReference = NaturalDocs::ReferenceString->MakeFrom(::REFERENCE_CH_PARENT(), $symbol,
|
539
|
+
NaturalDocs::Languages->LanguageOf($file)->Name(),
|
540
|
+
$scope, $using, $resolvingFlags);
|
541
|
+
}
|
542
|
+
else
|
543
|
+
{
|
544
|
+
($self, $file, $class, $parentReference) = @_;
|
545
|
+
$symbol = (NaturalDocs::ReferenceString->InformationOf($parentReference))[1];
|
546
|
+
};
|
547
|
+
|
548
|
+
|
549
|
+
# In case it doesn't already exist.
|
550
|
+
$self->AddClass($file, $class);
|
551
|
+
|
552
|
+
my $parent;
|
553
|
+
if (exists $parentReferences{$parentReference})
|
554
|
+
{
|
555
|
+
$parent = $parentReferences{$parentReference};
|
556
|
+
}
|
557
|
+
else
|
558
|
+
{
|
559
|
+
NaturalDocs::SymbolTable->AddReference($parentReference, $file);
|
560
|
+
my $parentTarget = NaturalDocs::SymbolTable->References($parentReference);
|
561
|
+
|
562
|
+
if (defined $parentTarget)
|
563
|
+
{ $parent = $parentTarget->Symbol(); }
|
564
|
+
else
|
565
|
+
{ $parent = $symbol; };
|
566
|
+
|
567
|
+
# In case it doesn't already exist.
|
568
|
+
$self->AddClass(undef, $parent);
|
569
|
+
|
570
|
+
$parentReferences{$parentReference} = $parent;
|
571
|
+
};
|
572
|
+
|
573
|
+
|
574
|
+
# If this defined a new parent...
|
575
|
+
if ($classes{$class}->AddParentReference($parentReference, $file, \%parentReferences))
|
576
|
+
{
|
577
|
+
$classes{$parent}->AddChild($class);
|
578
|
+
|
579
|
+
$self->RebuildFilesFor($class, 0, 1, 0);
|
580
|
+
$self->RebuildFilesFor($parent, 0, 1, 0);
|
581
|
+
};
|
582
|
+
|
583
|
+
$files{$file}->AddParentReference($class, $parentReference);
|
584
|
+
|
585
|
+
if (defined $watchedFileName)
|
586
|
+
{ $watchedFile->AddParentReference($class, $parentReference); };
|
587
|
+
};
|
588
|
+
|
589
|
+
|
590
|
+
#
|
591
|
+
# Function: WatchFileForChanges
|
592
|
+
#
|
593
|
+
# Watches a file for changes, which can then be applied by <AnalyzeChanges()>. Definitions are not deleted via a DeleteClass()
|
594
|
+
# function. Instead, a file is watched for changes, reparsed, and then a comparison is made to look for definitions that
|
595
|
+
# disappeared and any other relevant changes.
|
596
|
+
#
|
597
|
+
# Parameters:
|
598
|
+
#
|
599
|
+
# file - The <FileName> to watch.
|
600
|
+
#
|
601
|
+
sub WatchFileForChanges #(file)
|
602
|
+
{
|
603
|
+
my ($self, $file) = @_;
|
604
|
+
|
605
|
+
$watchedFile = NaturalDocs::ClassHierarchy::File->New();
|
606
|
+
$watchedFileName = $file;
|
607
|
+
};
|
608
|
+
|
609
|
+
|
610
|
+
#
|
611
|
+
# Function: AnalyzeChanges
|
612
|
+
#
|
613
|
+
# Checks the watched file for any changes that occured since the last time is was parsed, and updates the hierarchy as
|
614
|
+
# necessary. Also sends any files that are affected to <NaturalDocs::Project->RebuildFile()>.
|
615
|
+
#
|
616
|
+
sub AnalyzeChanges
|
617
|
+
{
|
618
|
+
my ($self) = @_;
|
619
|
+
|
620
|
+
# If the file didn't have any classes before, and it still doesn't, it wont be in %files.
|
621
|
+
if (exists $files{$watchedFileName})
|
622
|
+
{
|
623
|
+
my @originalClasses = $files{$watchedFileName}->Classes();
|
624
|
+
|
625
|
+
foreach my $originalClass (@originalClasses)
|
626
|
+
{
|
627
|
+
# If the class isn't there the second time around...
|
628
|
+
if (!$watchedFile->HasClass($originalClass))
|
629
|
+
{ $self->DeleteClass($watchedFileName, $originalClass); }
|
630
|
+
|
631
|
+
else
|
632
|
+
{
|
633
|
+
my @originalParents = $files{$watchedFileName}->ParentReferencesOf($originalClass);
|
634
|
+
|
635
|
+
foreach my $originalParent (@originalParents)
|
636
|
+
{
|
637
|
+
# If the parent reference wasn't there the second time around...
|
638
|
+
if (!$watchedFile->HasParentReference($originalClass, $originalParent))
|
639
|
+
{ $self->DeleteParentReference($watchedFileName, $originalClass, $originalParent); };
|
640
|
+
};
|
641
|
+
};
|
642
|
+
};
|
643
|
+
};
|
644
|
+
|
645
|
+
|
646
|
+
$watchedFile = undef;
|
647
|
+
$watchedFileName = undef;
|
648
|
+
};
|
649
|
+
|
650
|
+
|
651
|
+
|
652
|
+
###############################################################################
|
653
|
+
# Group: Information Functions
|
654
|
+
|
655
|
+
|
656
|
+
#
|
657
|
+
# Function: ParentsOf
|
658
|
+
# Returns a <SymbolString> array of the passed class' parents, or an empty array if none. Note that not all of them may be
|
659
|
+
# defined.
|
660
|
+
#
|
661
|
+
sub ParentsOf #(class)
|
662
|
+
{
|
663
|
+
my ($self, $class) = @_;
|
664
|
+
|
665
|
+
if (exists $classes{$class})
|
666
|
+
{ return $classes{$class}->Parents(); }
|
667
|
+
else
|
668
|
+
{ return ( ); };
|
669
|
+
};
|
670
|
+
|
671
|
+
#
|
672
|
+
# Function: ChildrenOf
|
673
|
+
# Returns a <SymbolString> array of the passed class' children, or an empty array if none. Note that not all of them may be
|
674
|
+
# defined.
|
675
|
+
#
|
676
|
+
sub ChildrenOf #(class)
|
677
|
+
{
|
678
|
+
my ($self, $class) = @_;
|
679
|
+
|
680
|
+
if (exists $classes{$class})
|
681
|
+
{ return $classes{$class}->Children(); }
|
682
|
+
else
|
683
|
+
{ return ( ); };
|
684
|
+
};
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
###############################################################################
|
689
|
+
# Group: Support Functions
|
690
|
+
|
691
|
+
|
692
|
+
#
|
693
|
+
# Function: DeleteFile
|
694
|
+
#
|
695
|
+
# Deletes a file and everything defined in it.
|
696
|
+
#
|
697
|
+
# Parameters:
|
698
|
+
#
|
699
|
+
# file - The <FileName>.
|
700
|
+
#
|
701
|
+
sub DeleteFile #(file)
|
702
|
+
{
|
703
|
+
my ($self, $file) = @_;
|
704
|
+
|
705
|
+
if (!exists $files{$file})
|
706
|
+
{ return; };
|
707
|
+
|
708
|
+
my @classes = $files{$file}->Classes();
|
709
|
+
foreach my $class (@classes)
|
710
|
+
{
|
711
|
+
$self->DeleteClass($file, $class);
|
712
|
+
};
|
713
|
+
|
714
|
+
delete $files{$file};
|
715
|
+
};
|
716
|
+
|
717
|
+
#
|
718
|
+
# Function: DeleteClass
|
719
|
+
#
|
720
|
+
# Deletes a class definition from a file. Will also delete any parent references from this class and file. Will rebuild any file
|
721
|
+
# affected unless <dontRebuildFiles> is set.
|
722
|
+
#
|
723
|
+
# Parameters:
|
724
|
+
#
|
725
|
+
# file - The <FileName> that defines the class.
|
726
|
+
# class - The class <SymbolString>.
|
727
|
+
#
|
728
|
+
sub DeleteClass #(file, class)
|
729
|
+
{
|
730
|
+
my ($self, $file, $class) = @_;
|
731
|
+
|
732
|
+
my @parents = $files{$file}->ParentReferencesOf($class);
|
733
|
+
foreach my $parent (@parents)
|
734
|
+
{
|
735
|
+
$self->DeleteParentReference($file, $class, $parent);
|
736
|
+
};
|
737
|
+
|
738
|
+
$files{$file}->DeleteClass($class);
|
739
|
+
|
740
|
+
# If we're deleting the last definition of this class.
|
741
|
+
if ($classes{$class}->DeleteDefinition($file))
|
742
|
+
{
|
743
|
+
if (!$classes{$class}->HasChildren())
|
744
|
+
{
|
745
|
+
delete $classes{$class};
|
746
|
+
|
747
|
+
if (!$dontRebuildFiles)
|
748
|
+
{ NaturalDocs::Project->RebuildFile($file); };
|
749
|
+
}
|
750
|
+
else
|
751
|
+
{ $self->RebuildFilesFor($class, 0, 1, 1); };
|
752
|
+
|
753
|
+
};
|
754
|
+
};
|
755
|
+
|
756
|
+
|
757
|
+
#
|
758
|
+
# Function: DeleteParentReference
|
759
|
+
#
|
760
|
+
# Deletes a class' parent reference and returns whether it resulted in the loss of a parent class. Will rebuild any file affected
|
761
|
+
# unless <dontRebuildFiles> is set.
|
762
|
+
#
|
763
|
+
# Parameters:
|
764
|
+
#
|
765
|
+
# file - The <FileName> that defines the reference.
|
766
|
+
# class - The class <SymbolString>.
|
767
|
+
# reference - The parent <ReferenceString>.
|
768
|
+
#
|
769
|
+
# Returns:
|
770
|
+
#
|
771
|
+
# If the class lost a parent as a result of this, it will return its <SymbolString>. It will return undef otherwise.
|
772
|
+
#
|
773
|
+
sub DeleteParentReference #(file, class, reference)
|
774
|
+
{
|
775
|
+
my ($self, $file, $class, $reference) = @_;
|
776
|
+
|
777
|
+
if (!exists $classes{$class})
|
778
|
+
{ return; };
|
779
|
+
|
780
|
+
$files{$file}->DeleteParentReference($class, $reference);
|
781
|
+
|
782
|
+
my $deletedParent = $classes{$class}->DeleteParentReference($reference, $file, \%parentReferences);
|
783
|
+
|
784
|
+
if (defined $deletedParent)
|
785
|
+
{
|
786
|
+
my $deletedParentObject = $classes{$deletedParent};
|
787
|
+
|
788
|
+
$deletedParentObject->DeleteChild($class);
|
789
|
+
|
790
|
+
$self->RebuildFilesFor($deletedParent, 0, 1, 0);
|
791
|
+
$self->RebuildFilesFor($class, 0, 1, 0);
|
792
|
+
|
793
|
+
if (!$deletedParentObject->HasChildren() && !$deletedParentObject->IsDefined())
|
794
|
+
{
|
795
|
+
delete $classes{$deletedParent};
|
796
|
+
NaturalDocs::SymbolTable->DeleteReference(
|
797
|
+
$self->ClassReferenceOf($class, NaturalDocs::Languages->LanguageOf($file)->Name()) );
|
798
|
+
};
|
799
|
+
|
800
|
+
return $deletedParent;
|
801
|
+
};
|
802
|
+
|
803
|
+
return undef;
|
804
|
+
};
|
805
|
+
|
806
|
+
|
807
|
+
#
|
808
|
+
# Function: ClassReferenceOf
|
809
|
+
#
|
810
|
+
# Returns the <REFERENCE_CH_CLASS> <ReferenceString> of the passed class <SymbolString>.
|
811
|
+
#
|
812
|
+
sub ClassReferenceOf #(class, languageName)
|
813
|
+
{
|
814
|
+
my ($self, $class, $languageName) = @_;
|
815
|
+
|
816
|
+
return NaturalDocs::ReferenceString->MakeFrom(::REFERENCE_CH_CLASS(), $class, $languageName, undef, undef,
|
817
|
+
::RESOLVE_ABSOLUTE() | ::RESOLVE_NOPLURAL());
|
818
|
+
};
|
819
|
+
|
820
|
+
|
821
|
+
#
|
822
|
+
# Function: RebuildFilesFor
|
823
|
+
#
|
824
|
+
# Calls <NaturalDocs::Project->RebuildFile()> for every file defining the passed class, its parents, and/or its children.
|
825
|
+
# Returns without doing anything if <dontRebuildFiles> is set.
|
826
|
+
#
|
827
|
+
# Parameters:
|
828
|
+
#
|
829
|
+
# class - The class <SymbolString>.
|
830
|
+
# rebuildParents - Whether to rebuild the class' parents.
|
831
|
+
# rebuildSelf - Whether to rebuild the class.
|
832
|
+
# rebuildChildren - Whether to rebuild the class' children.
|
833
|
+
#
|
834
|
+
sub RebuildFilesFor #(class, rebuildParents, rebuildSelf, rebuildChildren)
|
835
|
+
{
|
836
|
+
my ($self, $class, $rebuildParents, $rebuildSelf, $rebuildChildren) = @_;
|
837
|
+
|
838
|
+
if ($dontRebuildFiles)
|
839
|
+
{ return; };
|
840
|
+
|
841
|
+
my @classesToBuild;
|
842
|
+
|
843
|
+
if ($rebuildParents)
|
844
|
+
{ @classesToBuild = $classes{$class}->Parents(); };
|
845
|
+
if ($rebuildSelf)
|
846
|
+
{ push @classesToBuild, $class; };
|
847
|
+
if ($rebuildChildren)
|
848
|
+
{ push @classesToBuild, $classes{$class}->Children(); };
|
849
|
+
|
850
|
+
foreach my $classToBuild (@classesToBuild)
|
851
|
+
{
|
852
|
+
my @definitions = $classes{$classToBuild}->Definitions();
|
853
|
+
|
854
|
+
foreach my $definition (@definitions)
|
855
|
+
{ NaturalDocs::Project->RebuildFile($definition); };
|
856
|
+
};
|
857
|
+
};
|
858
|
+
|
859
|
+
|
860
|
+
1;
|