about summary refs log tree commit diff
path: root/docs/tool/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm
blob: 24de5503c35f0123c2819ee86e1578a89db83058 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
###############################################################################
#
#   Class: NaturalDocs::Languages::Advanced::ScopeChange
#
###############################################################################
#
#   A class used to store a scope change.
#
###############################################################################

# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
# Natural Docs is licensed under the GPL

use strict;
use integer;

package NaturalDocs::Languages::Advanced::ScopeChange;

#
#   Constants: Implementation
#
#   The object is implemented as a blessed arrayref.  The constants below are used as indexes.
#
#   SCOPE - The new scope <SymbolString>.
#   LINE_NUMBER - The line number of the change.
#
use NaturalDocs::DefineMembers 'SCOPE', 'LINE_NUMBER';
# Dependency: New() depends on the order of these constants as well as that there is no inherited members.


#
#   Function: New
#
#   Creates and returns a new object.
#
#   Parameters:
#
#       scope - The <SymbolString> the scope was changed to.
#       lineNumber - What line it occurred on.
#
sub New #(scope, lineNumber)
    {
    # Dependency: This depends on the order of the parameters matching the constants, and that there are no inherited
    # members.
    my $self = shift;

    my $object = [ @_ ];
    bless $object, $self;

    return $object;
    };


# Function: Scope
# Returns the <SymbolString> the scope was changed to.
sub Scope
    {  return $_[0]->[SCOPE];  };

# Function: SetScope
# Replaces the <SymbolString> the scope was changed to.
sub SetScope #(scope)
    {  $_[0]->[SCOPE] = $_[1];  };

# Function: LineNumber
# Returns the line number of the change.
sub LineNumber
    {  return $_[0]->[LINE_NUMBER];  };


1;