NaturalDocs:: Project

A package that manages information about the files in the source tree, as well as the list of files that have to be parsed and built. 

Usage and Dependencies

Summary
A package that manages information about the files in the source tree, as well as the list of files that have to be parsed and built.
A hash of all the supported files in the input directory.
An existence hash of all the files that need to be parsed.
An existence hash of all the files that need to be built.
An existence hash of files that had Natural Docs content last time, but now either don’t exist or no longer have content.
An existence hashref of all the files that have Natural Docs content but are not part of filesToBuild.
An index of the state of the files as of the last parse.
Loads the project file from disk and compares it against the files in the input directory.
Saves the project file to disk.
Adds the file to the list of files to build.
Adds all supported files to the list of files to parse.
Returns the full path to the project’s data file.
Returns the full path to the symbol table’s data file.
Returns the full path to the project’s menu file.
Returns the full path to the project’s previous menu state file.
Returns the full path to the project’s menu backup file, which is used to save the original menu in some situations.
Returns an existence hashref of the list of files to parse.
Returns an existence hashref of the list of files to build.
Returns an existence hashref of the list of files that had content last time, but now either don’t anymore or were deleted.
Returns an existence hashref of files that have Natural Docs content but are not part of FilesToBuild().
Returns and existence hashref of the files that have Natural Docs content.
Returns whether the file contains Natural Docs content.
Returns the status of the passed file.
Returns the default menu title of the file.
Sets whether the file has Natural Docs content or not.
Sets the file’s default menu title.
Gets all the supported files in the passed directory and its subdirectories and puts them into supportedFiles.

Variables

supportedFiles

my %supportedFiles

A hash of all the supported files in the input directory.  The keys are the file names, and the values are NaturalDocs::Project::File objects. 

filesToParse

my %filesToParse

An existence hash of all the files that need to be parsed. 

filesToBuild

my %filesToBuild

An existence hash of all the files that need to be built. 

filesToPurge

my %filesToPurge

An existence hash of files that had Natural Docs content last time, but now either don’t exist or no longer have content. 

unbuiltFilesWithContent

my %unbuiltFilesWithContent

An existence hashref of all the files that have Natural Docs content but are not part of filesToBuild

Files

NaturalDocs. files

An index of the state of the files as of the last parse.  Used to determine if files were added, deleted, or changed. 

Format

The first line is NaturalDocs::Settings::FileVersion()

The second line is the last modification time of NaturalDocs_Menu.txt

Each following line is [file name]\t[last modification time]\t[has ND content boolean]\t[default menu title]. 

Action Functions

LoadAndDetectChanges

sub LoadAndDetectChanges

Loads the project file from disk and compares it against the files in the input directory.  Project is loaded from NaturalDocs.files.  New and changed files will be added to FilesToParse(), and if they have content, FilesToBuild()

Returns

Returns whether the project was changed in any way. 

Save

sub Save

Saves the project file to disk.  Everything is saved in NaturalDocs.filesNaturalDocs::Menu::Save() should be called prior to this function because its last modification time is saved here. 

RebuildFile

sub RebuildFile #(file)

Adds the file to the list of files to build.  Assumes the file contains Natural Docs content. 

Parameters

fileThe name of the file to build or rebuild. 

ReparseEverything

sub ReparseEverything

Adds all supported files to the list of files to parse. 

Information Functions

ProjectFile

sub ProjectFile

Returns the full path to the project’s data file. 

SymbolTableFile

sub SymbolTableFile

Returns the full path to the symbol table’s data file. 

MenuFile

sub MenuFile

Returns the full path to the project’s menu file. 

PreviousMenuStateFile

sub PreviousMenuStateFile

Returns the full path to the project’s previous menu state file. 

MenuBackupFile

sub MenuBackupFile

Returns the full path to the project’s menu backup file, which is used to save the original menu in some situations. 

FilesToParse

sub FilesToParse

Returns an existence hashref of the list of files to parse.  This is not a copy of the data, so don’t change it. 

FilesToBuild

sub FilesToBuild

Returns an existence hashref of the list of files to build.  This is not a copy of the data, so don’t change it. 

FilesToPurge

sub FilesToPurge

Returns an existence hashref of the list of files that had content last time, but now either don’t anymore or were deleted.  This is not a copy of the data, so don’t change it. 

UnbuiltFilesWithContent

sub UnbuiltFilesWithContent

Returns an existence hashref of files that have Natural Docs content but are not part of FilesToBuild().  This is not a copy of the data so don’t change it. 

FilesWithContent

sub FilesWithContent

Returns and existence hashref of the files that have Natural Docs content. 

HasContent

sub HasContent #(file)

Returns whether the file contains Natural Docs content. 

StatusOf

sub StatusOf #(file)

Returns the status of the passed file.  Will be onen of the File Status Constants

DefaultMenuTitleOf

sub DefaultMenuTitleOf #(file)

Returns the default menu title of the file.  If one isn’t specified, it returns the file name. 

Parameters

fileThe name of the file. 

SetHasContent

sub SetHasContent #(file, hasContent)

Sets whether the file has Natural Docs content or not. 

Parameters

fileThe file being modified. 
hasContentWhether the file now has Natural Docs content or not. 

SetDefaultMenuTitle

sub SetDefaultMenuTitle #(file, menuTitle)

Sets the file’s default menu title. 

Parameters

fileThe file which is having its title changed. 
menuTitleThe new menu title. 

Support Functions

GetAllSupportedFiles

sub GetAllSupportedFiles #(directory)

Gets all the supported files in the passed directory and its subdirectories and puts them into supportedFiles.  The only attribute that will be set is NaturalDocs::Project::File->LastModified()

Parameters

directoryThis is for the function’s own recursive use only.  Do not specify.