NaturalDocs:: Menu:: Entry

A class representing an entry in the menu.

Summary
A class representing an entry in the menu.
The object is implemented as a blessed arrayref with the indexes below.
Creates and returns a new object.
Replaces the entry’s title.
Replaces the entry’s target.
Replaces the <Menu Entry Flags>.
Returns the type of the entry.
Returns the title of the entry.
Returns the target of the entry, if applicable.
Returns the <Menu Entry Flags>.
All of these functions assume the type is <MENU_GROUP>.
Returns an arrayref of NaturalDocs::Menu::Entry objects representing the contents of the group, or undef otherwise.
If the type is <MENU_GROUP>, returns whether the group is empty.
Pushes the entry to the end of the group content.
Deletes an entry from the group content by index.
If the group doesn’t already have one, adds a <MENU_ENDOFORIGINAL> entry to the end and sets the <MENU_GROUP_HASENDOFORIGINAL> flag.

Implementation

Members

The object is implemented as a blessed arrayref with the indexes below.

TYPEThe type of entry.  Will be one of the <Menu Entry Types>.
TITLEThe title of the entry.
TARGETThe target of the entry.  If the type is <MENU_FILE>, it will be the source file name.  If the type is <MENU_LINK>, it will be the URL.  If the type is <MENU_GROUP>, it will be an arrayref of NaturalDocs::Menu::Entry objects representing the group’s content.  If the type is <MENU_INDEX>, it will be one of the <Topic Types> or undef for the general index.
FLAGSAny <Menu Entry Flags> that apply.

Modification Functions

New

sub New #(type,
title,
target,
flags)

Creates and returns a new object.

Parameters

typeThe type of the entry.  Must be one of the <Menu Entry Types>.
titleThe title of the entry.
targetThe target of the entry, if applicable.  If the type is <MENU_FILE>, use the source file name.  If the type is <MENU_LINK>, use the URL.  If the type is <MENU_INDEX>, use one of the <Topic Types> or undef for general.  Otherwise set it to undef.
flagsAny <Menu Entry Flags> that apply.

SetTitle

sub SetTitle #(title)

Replaces the entry’s title.

SetTarget

sub SetTarget #(target)

Replaces the entry’s target.

SetFlags

sub SetFlags #(flags)

Replaces the <Menu Entry Flags>.

Information Functions

Type

sub Type

Returns the type of the entry.  Will be one of the <Menu Entry Types>.

Title

sub Title

Returns the title of the entry.

Target

sub Target

Returns the target of the entry, if applicable.  If the type is <MENU_FILE>, it returns the source file name.  If the type is <MENU_LINK>, it returns the URL.  If the type is <MENU_INDEX>, it returns one of the <Topic Types> or undef for the general index.  Otherwise it returns undef.

Flags

sub Flags

Returns the <Menu Entry Flags>.

Group Functions

All of these functions assume the type is <MENU_GROUP>.  Do not call any of these without checking Type() first.

GroupContent

sub GroupContent

Returns an arrayref of NaturalDocs::Menu::Entry objects representing the contents of the group, or undef otherwise.  This arrayref will always exist for <MENU_GROUP>’s and can be changed.

GroupIsEmpty

sub GroupIsEmpty

If the type is <MENU_GROUP>, returns whether the group is empty.

PushToGroup

sub PushToGroup #(entry)

Pushes the entry to the end of the group content.

DeleteFromGroup

sub DeleteFromGroup #(index)

Deletes an entry from the group content by index.

MarkEndOfOriginal

sub MarkEndOfOriginal

If the group doesn’t already have one, adds a <MENU_ENDOFORIGINAL> entry to the end and sets the <MENU_GROUP_HASENDOFORIGINAL> flag.

sub New #(type,
title,
target,
flags)
Creates and returns a new object.
sub SetTitle #(title)
Replaces the entry’s title.
sub SetTarget #(target)
Replaces the entry’s target.
sub SetFlags #(flags)
Replaces the Menu Entry Flags.
sub Type
Returns the type of the entry.
sub Title
Returns the title of the entry.
sub Target
Returns the target of the entry, if applicable.
sub Flags
Returns the Menu Entry Flags.
sub GroupContent
Returns an arrayref of NaturalDocs::Menu::Entry objects representing the contents of the group, or undef otherwise.
A class representing an entry in the menu.
sub GroupIsEmpty
If the type is MENU_GROUP, returns whether the group is empty.
sub PushToGroup #(entry)
Pushes the entry to the end of the group content.
sub DeleteFromGroup #(index)
Deletes an entry from the group content by index.
sub MarkEndOfOriginal
If the group doesn’t already have one, adds a MENU_ENDOFORIGINAL entry to the end and sets the MENU_GROUP_HASENDOFORIGINAL flag.