NaturalDocs:: Languages:: Advanced:: Scope

A class used to store a scope level.

Summary
A class used to store a scope level.
The object is implemented as a blessed arrayref.
Creates and returns a new object.
Returns the closing symbol of the scope.
Returns the namespace of the scope, or undef if none.
Sets the namespace of the scope.
Returns the package or class of the scope, or undef if none.
Sets the package or class of the scope.
Returns the protection of the scope, such as public/private/protected.
Sets the protection of the scope.

Implementation

The object is implemented as a blessed arrayref.  The constants below are used as indexes.

SYMBOLThe closing symbol of the scope.
NAMESPACEThe namespace of the scope, if applicable.
PACKAGEThe package or class of the scope.
PROTECTIONThe protection of the scope, such as public/private/protected.

Functions

New

sub New #(symbol,
namespace,
package,
protection)

Creates and returns a new object.

Parameters

symbolThe closing symbol of the scope.
namespaceThe namespace of the scope, if applicable.
packageThe package or class of the scope.
protectionThe protecetion of the scope, such as public/private/protected.

If either namespace, package, or protection are set to undef, it is assumed that it inherits the value of the previous scope on the stack.

Symbol

sub Symbol

Returns the closing symbol of the scope.

Namespace

sub Namespace

Returns the namespace of the scope, or undef if none.

SetNamespace

sub SetNamespace #(namespace)

Sets the namespace of the scope.

Package

sub Package

Returns the package or class of the scope, or undef if none.

SetPackage

sub SetPackage #(package)

Sets the package or class of the scope.

Protection

sub Protection

Returns the protection of the scope, such as public/private/protected.

SetProtection

sub SetProtection #(protection)

Sets the protection of the scope.

sub New #(symbol,
namespace,
package,
protection)
Creates and returns a new object.
sub Symbol
Returns the closing symbol of the scope.
sub Namespace
Returns the namespace of the scope, or undef if none.
sub SetNamespace #(namespace)
Sets the namespace of the scope.
sub Package
Returns the package or class of the scope, or undef if none.
sub SetPackage #(package)
Sets the package or class of the scope.
sub Protection
Returns the protection of the scope, such as public/private/protected.
sub SetProtection #(protection)
Sets the protection of the scope.