NaturalDocs::SymbolTable::Symbol

A class representing a symbol or a potential symbol.

Summary
NaturalDocs::SymbolTable::SymbolA class representing a symbol or a potential symbol.
Implementation
MembersThe class is implemented as a blessed arrayref.
Modification Functions
NewCreates and returns a new object.
AddDefinitionAdds a symbol definition.
ChangeDefinitionChanges the information about an existing definition.
DeleteDefinitionRemoves a symbol definition.
AddReferenceAdds a reference that can be interpreted as this symbol.
DeleteReferenceDeletes a reference that can be interpreted as this symbol.
DeleteAllReferencesRemoves all references that can be interpreted as this symbol.
Information Functions
IsDefinedReturns whether the symbol is defined anywhere or not.
IsDefinedInReturns whether the symbol is defined in the passed FileName.
DefinitionsReturns an array of all the FileNames that define this symbol.
GlobalDefinitionReturns the FileName that contains the global definition of this symbol, or undef if the symbol isn’t defined.
TypeDefinedInReturns the TopicType of the symbol defined in the passed FileName, or undef if it’s not defined in that file.
GlobalTypeReturns the TopicType of the global definition, or undef if the symbol isn’t defined.
PrototypeDefinedInReturns the prototype of symbol defined in the passed FileName, or undef if it doesn’t exist or is not defined in that file.
GlobalPrototypeReturns the prototype of the global definition.
SummaryDefinedInReturns the summary of symbol defined in the passed FileName, or undef if it doesn’t exist or is not defined in that file.
GlobalSummaryReturns the summary of the global definition.
HasReferencesReturns whether the symbol can be interpreted as any references.
ReferencesReturns an array of all the reference strings that can be interpreted as this symbol.
ReferencesAndScoresReturns a hash of all the references that can be interpreted as this symbol and their scores.

Implementation

Members

The class is implemented as a blessed arrayref.  The following constants are its members.

DEFINITIONSA hashref of all the files which define this symbol.  The keys are the FileNames, and the values are NaturalDocs::SymbolTable::SymbolDefinition objects.  If no files define this symbol, this item will be undef.
GLOBAL_DEFINITIONThe FileName which defines the global version of the symbol, which is what is used if a file references the symbol but does not have its own definition.  If there are no definitions, this item will be undef.
REFERENCESA hashref of the references that can be interpreted as this symbol.  This doesn’t mean these references necessarily are.  The keys are the reference strings, and the values are the scores of the interpretations.  If no references can be interpreted as this symbol, this item will be undef.

Modification Functions

New

sub New

Creates and returns a new object.

AddDefinition

sub AddDefinition #(file,
type,
prototype,
summary)

Adds a symbol definition.  If this is the first definition for this symbol, it will become the global definition.  If the definition already exists for the file, it will be ignored.

Parameters

fileThe FileName that defines the symbol.
typeThe TopicType of the definition.
prototypeThe prototype of the definition, if applicable.  Undef otherwise.
summaryThe summary for the definition, if applicable.  Undef otherwise.

Returns

Whether this provided the first definition for this symbol.

ChangeDefinition

sub ChangeDefinition #(file,
type,
prototype,
summary)

Changes the information about an existing definition.

Parameters

fileThe FileName that defines the symbol.  Must exist.
typeThe new TopicType of the definition.
prototypeThe new prototype of the definition, if applicable.  Undef otherwise.
summaryThe new summary of the definition, if applicable.  Undef otherwise.

DeleteDefinition

sub DeleteDefinition #(file)

Removes a symbol definition.  If the definition served as the global definition, a new one will be selected.

Parameters

fileThe FileName which contains definition to delete.

Returns

Whether that was the only definition, and the symbol is now undefined.

AddReference

sub AddReference #(referenceString,
score)

Adds a reference that can be interpreted as this symbol.  It can be, but not necessarily is.

Parameters

referenceStringThe string of the reference.
scoreThe score of this interpretation.

DeleteReference

sub DeleteReference #(referenceString)

Deletes a reference that can be interpreted as this symbol.

Parameters

referenceStringThe string of the reference to delete.

DeleteAllReferences

sub DeleteAllReferences

Removes all references that can be interpreted as this symbol.

Information Functions

IsDefined

sub IsDefined

Returns whether the symbol is defined anywhere or not.  If it’s not, that means it’s just a potential interpretation of a reference.

IsDefinedIn

sub IsDefinedIn #(file)

Returns whether the symbol is defined in the passed FileName.

Definitions

sub Definitions

Returns an array of all the FileNames that define this symbol.  If none do, will return an empty array.

GlobalDefinition

sub GlobalDefinition

Returns the FileName that contains the global definition of this symbol, or undef if the symbol isn’t defined.

TypeDefinedIn

sub TypeDefinedIn #(file)

Returns the TopicType of the symbol defined in the passed FileName, or undef if it’s not defined in that file.

GlobalType

sub GlobalType

Returns the TopicType of the global definition, or undef if the symbol isn’t defined.

PrototypeDefinedIn

sub PrototypeDefinedIn #(file)

Returns the prototype of symbol defined in the passed FileName, or undef if it doesn’t exist or is not defined in that file.

GlobalPrototype

sub GlobalPrototype

Returns the prototype of the global definition.  Will be undef if it doesn’t exist or the symbol isn’t defined.

SummaryDefinedIn

sub SummaryDefinedIn #(file)

Returns the summary of symbol defined in the passed FileName, or undef if it doesn’t exist or is not defined in that file.

GlobalSummary

sub GlobalSummary

Returns the summary of the global definition.  Will be undef if it doesn’t exist or the symbol isn’t defined.

HasReferences

sub HasReferences

Returns whether the symbol can be interpreted as any references.

References

sub References

Returns an array of all the reference strings that can be interpreted as this symbol.  If none, will return an empty array.

ReferencesAndScores

sub ReferencesAndScores

Returns a hash of all the references that can be interpreted as this symbol and their scores.  The keys are the reference strings, and the values are the scores.  If none, will return an empty hash.

sub New
Creates and returns a new object.
sub AddDefinition #(file,
type,
prototype,
summary)
Adds a symbol definition.
sub ChangeDefinition #(file,
type,
prototype,
summary)
Changes the information about an existing definition.
sub DeleteDefinition #(file)
Removes a symbol definition.
sub AddReference #(referenceString,
score)
Adds a reference that can be interpreted as this symbol.
sub DeleteReference #(referenceString)
Deletes a reference that can be interpreted as this symbol.
sub DeleteAllReferences
Removes all references that can be interpreted as this symbol.
sub IsDefined
Returns whether the symbol is defined anywhere or not.
sub IsDefinedIn #(file)
Returns whether the symbol is defined in the passed FileName.
A string representing the absolute, platform-dependent path to a file.
sub Definitions
Returns an array of all the FileNames that define this symbol.
sub GlobalDefinition
Returns the FileName that contains the global definition of this symbol, or undef if the symbol isn’t defined.
sub TypeDefinedIn #(file)
Returns the TopicType of the symbol defined in the passed FileName, or undef if it’s not defined in that file.
A string representing a topic type as defined in Topics.txt.
sub GlobalType
Returns the TopicType of the global definition, or undef if the symbol isn’t defined.
sub PrototypeDefinedIn #(file)
Returns the prototype of symbol defined in the passed FileName, or undef if it doesn’t exist or is not defined in that file.
sub GlobalPrototype
Returns the prototype of the global definition.
sub SummaryDefinedIn #(file)
Returns the summary of symbol defined in the passed FileName, or undef if it doesn’t exist or is not defined in that file.
sub GlobalSummary
Returns the summary of the global definition.
sub HasReferences
Returns whether the symbol can be interpreted as any references.
sub References
Returns an array of all the reference strings that can be interpreted as this symbol.
sub ReferencesAndScores
Returns a hash of all the references that can be interpreted as this symbol and their scores.
A class representing a symbol definition.
Close