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.
NaturalDocs:: | 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. |
File Handles | |
FH_FILEINFO | The file handle for the file information file, FileInfo.nd. |
FH_CONFIGFILEINFO | The file handle for the config file information file, ConfigFileInfo.nd. |
FH_IMAGEFILE | The file handle for determining the dimensions of image files. |
Source File Variables | |
supportedFiles | A hash of all the supported files in the input directory. |
filesToParse | An existence hash of all the FileNames that need to be parsed. |
filesToBuild | An existence hash of all the FileNames that need to be built. |
filesToPurge | An existence hash of the FileNames that had Natural Docs content last time, but now either don’t exist or no longer have content. |
unbuiltFilesWithContent | An existence hash of all the FileNames that have Natural Docs content but are not part of filesToBuild. |
reparseEverything | Whether all the source files need to be reparsed. |
rebuildEverything | Whether all the source files need to be rebuilt. |
mostUsedLanguage | The name of the most used language. |
Configuration File Variables | |
mainConfigFile | A hash mapping all the main configuration file names without paths to their FileStatus. |
userConfigFiles | A hash mapping all the user configuration file names without paths to their FileStatus. |
Image File Variables | |
imageFileExtensions | An existence hash of all the file extensions for images. |
imageFiles | A hash of all the image files in the project. |
imageFilesToUpdate | An existence hash of all the image FileNames that need to be updated, either because they changed or they’re new to the project. |
imageFilesToPurge | An existence hash of all the image FileNames that need to be purged, either because the files no longer exist or because they are no longer used. |
insensitiveImageFiles | A hash that maps all lowercase image FileNames to their proper case as it would appear in imageFiles. |
Files | |
FileInfo.nd | An index of the state of the files as of the last parse. |
ConfigFileInfo.nd | An index of the state of the config files as of the last parse. |
ImageFileInfo.nd | An index of the state of the image files as of the last parse. |
File Functions | |
LoadSourceFileInfo | Loads the project file from disk and compares it against the files in the input directory. |
SaveSourceFileInfo | Saves the source file info to disk. |
LoadConfigFileInfo | Loads the config file info from disk. |
SaveConfigFileInfo | Saves the config file info to disk. |
LoadImageFileInfo | Loads the image file info from disk. |
SaveImageFileInfo | Saves the image file info to disk. |
MigrateOldFiles | If the project uses the old file names used prior to 1.14, it converts them to the new file names. |
Config and Data File Functions | |
MainConfigFile | Returns the full path to the passed main configuration file. |
MainConfigFileStatus | Returns the FileStatus of the passed main configuration file. |
UserConfigFile | Returns the full path to the passed user configuration file. |
UserConfigFileStatus | Returns the FileStatus of the passed user configuration file. |
DataFile | Returns the full path to the passed data file. |
Source File Functions | |
FilesToParse | Returns an existence hashref of the FileNames to parse. |
FilesToBuild | Returns an existence hashref of the FileNames to build. |
FilesToPurge | Returns an existence hashref of the FileNames that had content last time, but now either don’t anymore or were deleted. |
RebuildFile | Adds the file to the list of files to build. |
ReparseEverything | Adds all supported files to the list of files to parse. |
RebuildEverything | Adds all supported files to the list of files to build. |
UnbuiltFilesWithContent | Returns an existence hashref of the FileNames that have Natural Docs content but are not part of FilesToBuild(). |
FilesWithContent | Returns and existence hashref of the FileNames that have Natural Docs content. |
HasContent | Returns whether the FileName contains Natural Docs content. |
SetHasContent | Sets whether the FileName has Natural Docs content or not. |
StatusOf | Returns the FileStatus of the passed FileName. |
DefaultMenuTitleOf | Returns the default menu title of the FileName. |
SetDefaultMenuTitle | Sets the FileName’s default menu title. |
MostUsedLanguage | Returns the name of the most used language in the source trees. |
Image File Functions | |
ImageFileExists | Returns whether the passed image file exists. |
ImageFileDimensions | Returns the dimensions of the passed image file as the array ( width, height ). |
ImageFileCapitalization | Returns the properly capitalized version of the passed image FileName. |
AddImageFileReference | Adds a reference to the passed image FileName. |
DeleteImageFileReference | Deletes a reference from the passed image FileName. |
ImageFilesToUpdate | Returns an existence hashref of image FileNames that need to be updated. |
ImageFilesToPurge | Returns an existence hashref of image FileNames that need to be updated. |
Support Functions | |
GetAllSupportedFiles | Gets all the supported files in the passed directory and its subdirectories and puts them into supportedFiles. |
DetermineImageDimensions | Attempts to determine the dimensions of the passed image and apply them to their object in imageFiles. |
The file handle for the file information file, FileInfo.nd.
The file handle for the config file information file, ConfigFileInfo.nd.
my %supportedFiles
A hash of all the supported files in the input directory. The keys are the FileNames, and the values are NaturalDocs::Project::SourceFile objects.
my %filesToParse
An existence hash of all the FileNames that need to be parsed.
my %filesToBuild
An existence hash of all the FileNames that need to be built.
my %filesToPurge
An existence hash of the FileNames that had Natural Docs content last time, but now either don’t exist or no longer have content.
my %unbuiltFilesWithContent
An existence hash of all the FileNames that have Natural Docs content but are not part of filesToBuild.
my %mainConfigFiles
A hash mapping all the main configuration file names without paths to their FileStatus. Prior to LoadConfigFileInfo(), it serves as an existence hashref of the file names.
my %userConfigFiles
A hash mapping all the user configuration file names without paths to their FileStatus. Prior to LoadConfigFileInfo(), it serves as an existence hashref of the file names.
my %imageFiles
A hash of all the image files in the project. The keys are the FileNames and the values are NaturalDocs::Project::ImageFiles.
my %imageFilesToUpdate
An existence hash of all the image FileNames that need to be updated, either because they changed or they’re new to the project.
my %imageFilesToPurge
An existence hash of all the image FileNames that need to be purged, either because the files no longer exist or because they are no longer used.
my %insensitiveImageFiles
A hash that maps all lowercase image FileNames to their proper case as it would appear in imageFiles. Used for case insensitivity, obviously.
You can’t just use all lowercase in imageFiles because both Linux and HTTP are case sensitive, so the original case must be preserved. We also want to allow separate entries for files that differ based only on case, so it goes to imageFiles first where they can be distinguished and here only if there’s no match. Ties are broken by whichever is lower with cmp, because it has to resolve consistently on all runs of the program.
An index of the state of the files as of the last parse. Used to determine if files were added, deleted, or changed.
The format is a text file.
[VersionInt: app version]
The beginning of the file is the VersionInt it was generated with.
[most used language name]
Next is the name of the most used language in the source tree. Does not include text files.
Each following line is
[file name] tab [last modification time] tab [has ND content (0 or 1)] tab [default menu title] \n
An index of the state of the config files as of the last parse.
[BINARY_FORMAT] [VersionInt: app version]
First is the standard BINARY_FORMAT VersionInt header.
[UInt32: last modification time of menu] [UInt32: last modification of main topics file] [UInt32: last modification of user topics file] [UInt32: last modification of main languages file] [UInt32: last modification of user languages file]
Next are the last modification times of various configuration files as UInt32s in the standard Unix format.
An index of the state of the image files as of the last parse.
[Standard Binary Header]
First is the standard binary file header as defined by NaturalDocs::BinaryFile.
[AString16: file name or undef] [UInt32: last modification time] [UInt8: was used]
This section is repeated until the file name is null. The last modification times are UInt32s in the standard Unix format.
sub LoadSourceFileInfo
Loads the project file from disk and compares it against the files in the input directory. Project is loaded from FileInfo.nd. New and changed files will be added to FilesToParse(), and if they have content, FilesToBuild().
Will call NaturalDocs::Languages->OnMostUsedLanguageKnown() if MostUsedLanguage() changes.
Returns whether the project was changed in any way.
sub SaveSourceFileInfo
Saves the source file info to disk. Everything is saved in FileInfo.nd.
sub SaveConfigFileInfo
Saves the config file info to disk. You must save all other config files first, such as Menu.txt and Topics.txt.
sub MainConfigFileStatus #( string file )
Returns the FileStatus of the passed main configuration file. Pass the file name only.
sub UserConfigFileStatus #( string file )
Returns the FileStatus of the passed user configuration file. Pass the file name only.
sub FilesToParse
Returns an existence hashref of the FileNames to parse. This is not a copy of the data, so don’t change it.
sub FilesToBuild
Returns an existence hashref of the FileNames to build. This is not a copy of the data, so don’t change it.
sub FilesToPurge
Returns an existence hashref of the FileNames 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.
sub RebuildFile #( file )
Adds the file to the list of files to build. This function will automatically filter out files that don’t have Natural Docs content and files that are part of FilesToPurge(). If this gets called on a file and that file later gets Natural Docs content, it will be added.
file | The FileName to build or rebuild. |
sub UnbuiltFilesWithContent
Returns an existence hashref of the FileNames that have Natural Docs content but are not part of FilesToBuild(). This is not a copy of the data so don’t change it.
sub FilesWithContent
Returns and existence hashref of the FileNames that have Natural Docs content.
sub HasContent #( file )
Returns whether the FileName contains Natural Docs content.
sub SetHasContent #( file, hasContent )
Sets whether the FileName has Natural Docs content or not.
sub StatusOf #( file )
Returns the FileStatus of the passed FileName.
sub SetDefaultMenuTitle #( file, menuTitle )
Sets the FileName’s default menu title.
sub ImageFileCapitalization #( FileName file ) => FileName
Returns the properly capitalized version of the passed image FileName. Image file paths are treated as case insensitive regardless of whether the underlying operating system is or not, so we have to make sure the final version matches the capitalization of the actual file.
sub AddImageFileReference #( FileName imageFile )
Adds a reference to the passed image FileName.
sub DeleteImageFileReference #( FileName imageFile )
Deletes a reference from the passed image FileName.
sub ImageFilesToUpdate
Returns an existence hashref of image FileNames that need to be updated. Do not change.
sub ImageFilesToPurge
Returns an existence hashref of image FileNames that need to be updated. Do not change.
sub GetAllSupportedFiles
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::SourceFile->LastModified(). Also sets mostUsedLanguage.
sub DetermineImageDimensions #( FileName imageFile )
Attempts to determine the dimensions of the passed image and apply them to their object in imageFiles. Will set them to undef if they can’t be determined.
A hash of all the supported files in the input directory.
my %supportedFiles
An existence hash of all the FileNames that need to be parsed.
my %filesToParse
An existence hash of all the FileNames that need to be built.
my %filesToBuild
An existence hash of the FileNames that had Natural Docs content last time, but now either don’t exist or no longer have content.
my %filesToPurge
An existence hash of all the FileNames that have Natural Docs content but are not part of filesToBuild.
my %unbuiltFilesWithContent
Whether all the source files need to be reparsed.
my $reparseEverything
Whether all the source files need to be rebuilt.
my $rebuildEverything
The name of the most used language.
my $mostUsedLanguage
A hash mapping all the main configuration file names without paths to their FileStatus.
my %mainConfigFiles
A hash mapping all the user configuration file names without paths to their FileStatus.
my %userConfigFiles
An existence hash of all the file extensions for images.
my %imageFileExtensions
A hash of all the image files in the project.
my %imageFiles
An existence hash of all the image FileNames that need to be updated, either because they changed or they’re new to the project.
my %imageFilesToUpdate
An existence hash of all the image FileNames that need to be purged, either because the files no longer exist or because they are no longer used.
my %imageFilesToPurge
A hash that maps all lowercase image FileNames to their proper case as it would appear in imageFiles.
my %insensitiveImageFiles
Loads the project file from disk and compares it against the files in the input directory.
sub LoadSourceFileInfo
Saves the source file info to disk.
sub SaveSourceFileInfo
Loads the config file info from disk.
sub LoadConfigFileInfo
Saves the config file info to disk.
sub SaveConfigFileInfo
Loads the image file info from disk.
sub LoadImageFileInfo
Saves the image file info to disk.
sub SaveImageFileInfo
If the project uses the old file names used prior to 1.14, it converts them to the new file names.
sub MigrateOldFiles
Returns the full path to the passed main configuration file.
sub MainConfigFile #( string file )
Returns the FileStatus of the passed main configuration file.
sub MainConfigFileStatus #( string file )
Returns the full path to the passed user configuration file.
sub UserConfigFile #( string file )
Returns the FileStatus of the passed user configuration file.
sub UserConfigFileStatus #( string file )
Returns the full path to the passed data file.
sub DataFile #( string file )
Returns an existence hashref of the FileNames to parse.
sub FilesToParse
Returns an existence hashref of the FileNames to build.
sub FilesToBuild
Returns an existence hashref of the FileNames that had content last time, but now either don’t anymore or were deleted.
sub FilesToPurge
Adds the file to the list of files to build.
sub RebuildFile #( file )
Adds all supported files to the list of files to parse.
sub ReparseEverything
Adds all supported files to the list of files to build.
sub RebuildEverything
Returns an existence hashref of the FileNames that have Natural Docs content but are not part of FilesToBuild().
sub UnbuiltFilesWithContent
Returns and existence hashref of the FileNames that have Natural Docs content.
sub FilesWithContent
Returns whether the FileName contains Natural Docs content.
sub HasContent #( file )
Sets whether the FileName has Natural Docs content or not.
sub SetHasContent #( file, hasContent )
Returns the FileStatus of the passed FileName.
sub StatusOf #( file )
Returns the default menu title of the FileName.
sub DefaultMenuTitleOf #( file )
Sets the FileName’s default menu title.
sub SetDefaultMenuTitle #( file, menuTitle )
Returns the name of the most used language in the source trees.
sub MostUsedLanguage
Returns whether the passed image file exists.
sub ImageFileExists #( FileName file ) => bool
Returns the dimensions of the passed image file as the array ( width, height ).
sub ImageFileDimensions #( FileName file ) => (int, int)
Returns the properly capitalized version of the passed image FileName.
sub ImageFileCapitalization #( FileName file ) => FileName
Adds a reference to the passed image FileName.
sub AddImageFileReference #( FileName imageFile )
Deletes a reference from the passed image FileName.
sub DeleteImageFileReference #( FileName imageFile )
Returns an existence hashref of image FileNames that need to be updated.
sub ImageFilesToUpdate
Returns an existence hashref of image FileNames that need to be updated.
sub ImageFilesToPurge
Gets all the supported files in the passed directory and its subdirectories and puts them into supportedFiles.
sub GetAllSupportedFiles
Attempts to determine the dimensions of the passed image and apply them to their object in imageFiles.
sub DetermineImageDimensions #( FileName imageFile )
Called when the most used language is known.
sub OnMostUsedLanguageKnown
Returns the integer timestamp of when the file was last modified.
sub LastModified