NaturalDocs:: Parser:: ParsedTopic

A class for parsed topics of source files.

Summary
A class for parsed topics of source files.
The object is a blessed arrayref with the following indexes.
Creates a new object.
Returns the type of the topic.
Returns the name of the topic.
Returns the class of the topic.
Replaces the topic’s class.
Returns the scope the topic appears in.
Replaces the topic’s scope.
Returns the prototype if Type() is <TOPIC_FUNCTION> or <TOPIC_VARIABLE> and one is defined.
Replaces the function or variable prototype.
Returns the topic summary, if it exists, formatted in NDMarkup.
Returns the topic’s body, formatted in NDMarkup.
Replaces the topic’s body, formatted in NDMarkup.
Returns the line the topic appears at in the file.

Implementation

Members

The object is a blessed arrayref with the following indexes.

TYPEThe type of the topic.  Will be one of the <Topic Types>.
NAMEThe name of the topic.
CLASSThe class of the topic, if any.  This applies to Name only.  Will be undef if global.
SCOPEThe scope the topic’s body appears in.  This may be different from Class.  Will be undef if global.
PROTOTYPEThe prototype, if it exists and is applicable.
SUMMARYThe summary, if it exists.
BODYThe body of the topic, formatted in NDMarkup.  Some topics may not have bodies, and if not, this will be undef.
LINE_NUMBERThe line number the topic appears at in the file.

Functions

New

sub New #(type,
name,
class,
scope,
prototype,
summary,
body,
lineNumber)

Creates a new object.

Parameters

typeThe type of the topic.  Will be one of the <Topic Types>.
nameThe name of the topic.
classThe class of the topic’s name, if any.  Set to undef if global.
scopeThe scope the topic’s body appears in.  This may be different from class.  Set to undef if global.
prototypeIf the type is <TOPIC_FUNCTION> or <TOPIC_VARIABLE>, the prototype, if it exists.  Otherwise set to undef.
summaryThe summary of the topic, if any.
bodyThe body of the topic, formatted in NDMarkup.  May be undef, as some topics may not have bodies.
lineNumberThe line number the topic appears at in the file.

Returns

The new object.

Type

sub Type

Returns the type of the topic.  Will be one of <Topic Types>.

Name

sub Name

Returns the name of the topic.

Class

sub Class

Returns the class of the topic.  Applies to Name() only.  Will be undef if global.

SetClass

sub SetClass #(class)

Replaces the topic’s class.

Scope

sub Scope

Returns the scope the topic appears in.  Applies to Body() only.  Will be undef if global.

SetScope

sub SetScope #(scope)

Replaces the topic’s scope.

Prototype

sub Prototype

Returns the prototype if Type() is <TOPIC_FUNCTION> or <TOPIC_VARIABLE> and one is defined.  Will be undef otherwise.

SetPrototype

sub SetPrototype #(prototype)

Replaces the function or variable prototype.

Summary

sub Summary

Returns the topic summary, if it exists, formatted in NDMarkup.

Body

sub Body

Returns the topic’s body, formatted in NDMarkup.  May be undef.

SetBody

sub SetBody #(body)

Replaces the topic’s body, formatted in NDMarkup.  May be undef.

LineNumber

sub LineNumber

Returns the line the topic appears at in the file.

sub New #(type,
name,
class,
scope,
prototype,
summary,
body,
lineNumber)
Creates a new object.
sub Type
Returns the type of the topic.
sub Name
Returns the name of the topic.
sub Class
Returns the class of the topic.
sub SetClass #(class)
Replaces the topic’s class.
sub Scope
Returns the scope the topic appears in.
sub SetScope #(scope)
Replaces the topic’s scope.
sub Prototype
Returns the prototype if Type() is TOPIC_FUNCTION or TOPIC_VARIABLE and one is defined.
sub SetPrototype #(prototype)
Replaces the function or variable prototype.
sub Summary
Returns the topic summary, if it exists, formatted in NDMarkup.
A markup format used by the parser, both internally and in NaturalDocs::Parser::ParsedTopic objects.
sub Body
Returns the topic’s body, formatted in NDMarkup.
sub SetBody #(body)
Replaces the topic’s body, formatted in NDMarkup.
sub LineNumber
Returns the line the topic appears at in the file.