Natural Docs Version 1.2 |
NaturalDocs:: ClassHierarchyA package that handles all the gory details of managing the class hierarchy. It handles the hierarchy itself, which files define them, rebuilding the files that are affected by changes, and loading and saving them to a file. Usage and Dependencies
Summary
CLASS_HIERARCHY_FILEHANDLEThe file handle used with ClassHierarchy.nd. classes
A hash of all the classes. The keys are the class names, and the values are NaturalDocs::ClassHierarchy::Classes. files
A hash of the hierarchy information referenced by file. The keys are the file names, and the values are NaturalDocs::ClassHierarchy::Files. watchedFile
A NaturalDocs::ClassHierarchy::File object of the file being watched for changes. This is compared to the version in files to see if anything was changed since the last parse. ClassHierarchy.ndStores the class hierarchy on disk. Format[BINARY_FORMAT] The firs byte is the <BINARY_FORMAT> constant. [app version] Next is the binary application version it was generated with. Manage with NaturalDocs::Version. [AString16: class] Next we begin a class segment. These continue until the end of the file. The class segment starts of with the class’ name. [UInt32: number of files] [AString16: file] ... Next there is the number of files that define that class. It’s a UInt32, which seems like overkill, but I could imagine every file in a huge C++ project being under the same namespace, and thus contributing its own definition. It’s theoretically possible. Following the number is that many file names. You must remember the index of each file, as they will be important later. Indexes start at one. [UInt8: number of parents] ( [AString16: parent] [UInt32: file index] ... [UInt32: 0] ) ... Next there is the number of parents defined for this class. For each one, we define a parent segment, which consists of its name, and then a zero-terminated string of indexes of the files that define that parent as part of that class. The indexes start at one, and are into the list of files we saw previously. Note that we do store class segments for classes without parents, but not for undefined classes. This concludes a class segment. These segments continue until the end of the file. Revisions1.2
AddParent
Adds a class-parent relationship to the hierarchy. Unless dontRebuild is set, this will put any files whose hierarchy output will change on the build list. This also adds a reference in NaturalDocs::SymbolTable between the files so that if the summary or definition of one class changes, both files will be affected. Parameters
WatchFileForChanges
Watches a file for changes, which can then be applied by AnalyzeChanges(). Definitions are not deleted via a DeleteClass() function. Instead, a file is watched for changes, reparsed, and then a comparison is made to look for definitions that disappeared and any other relevant changes. Parameters
AnalyzeChanges
Checks the watched file for any changes that occured since the last time is was parsed, and updates the hierarchy as necessary. Also sends any files that are affected to NaturalDocs::Project->RebuildFile(). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
my %classes |
my %files |
my $watchedFile |
my $watchedFileName |
sub Load |
sub Save |
sub Purge |
| ||||||||||
| |||||||||||||||
sub WatchFileForChanges #(file) |
sub AnalyzeChanges |
sub ParentsOf #(class) |
sub ChildrenOf #(class) |
sub DeleteFile #(file) |
| ||||||||||
| |||||||||||||||
sub ParseForInformation #(file) |
sub RebuildFile #(file) |