NaturalDocs:: SymbolTable:: Reference

A class representing a symbol or a potential symbol. 

Summary
A class representing a symbol or a potential symbol.
The class is implemented as a blessed arrayref.
Creates and returns a new object.
Adds a reference definition.
Removes a reference definition.
Adds a symbol that this reference can be interpreted as.
Deletes a symbol that this reference can be interpreted as.
Deletes all interpretations except for the current one.
Changes the current interpretation.
Returns an array of all the files that define this reference.
Returns whether the reference has any definitions or not.
Returns whether the reference is defined in the passed file.
Returns an array of all the symbol strings that this reference can be interpreted as.
Returns a hash of all the symbol strings that this reference can be interpreted as and their scores.
Returns whether the reference has a current interpretation or not.
Returns the symbol string of the current interpretation, or undef if none.
Returns the score of the current interpretation, or undef if none.

Implementation

Members

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

DEFINITIONSAn existence hashref of the files that define this reference. 
INTERPRETATIONSA hashref of the possible interpretations of this reference.  The keys are the symbol strings, and the values are their scores. 
CURRENT_INTERPRETATIONThe interpretation currently used as the reference target.  It will be the interpretation with the highest score that is actually defined.  If none are defined, this item will be undef. 

Modification Functions

New

sub New

Creates and returns a new object. 

AddDefinition

sub AddDefinition #(file)

Adds a reference definition. 

Parameters

fileThe file that defines the reference. 

DeleteDefinition

sub DeleteDefinition #(file)

Removes a reference definition. 

Parameters

fileThe definition to delete. 

AddInterpretation

sub AddInterpretation #(referenceString, score)

Adds a symbol that this reference can be interpreted as. 

Parameters

symbolStringThe string of the symbol. 
scoreThe score of this interpretation. 

DeleteInterpretation

sub DeleteInterpretation #(symbolString)

Deletes a symbol that this reference can be interpreted as. 

Parameters

symbolStringThe string of the symbol to delete. 

DeleteAllInterpretationsButCurrent

sub DeleteAllInterpretationsButCurrent

Deletes all interpretations except for the current one. 

SetCurrentInterpretation

sub SetCurrentInterpretation #(symbolString)

Changes the current interpretation.  The new one must already have been added via AddInterpretation()

Parameters

symbolStringThe string of the symbol to make the current interpretation.  Can be set to undef to clear it. 

Information Functions

Definitions

sub Definitions

Returns an array of all the files that define this reference.  If none do, returns an empty array. 

IsDefined

sub IsDefined

Returns whether the reference has any definitions or not. 

IsDefinedIn

sub IsDefinedIn #(file)

Returns whether the reference is defined in the passed file. 

Interpretations

sub Interpretations

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

InterpretationsAndScores

sub InterpretationsAndScores

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

HasCurrentInterpretation

sub HasCurrentInterpretation

Returns whether the reference has a current interpretation or not. 

CurrentInterpretation

sub CurrentInterpretation

Returns the symbol string of the current interpretation, or undef if none. 

CurrentScore

sub CurrentScore

Returns the score of the current interpretation, or undef if none.