nis-util  1.0.D108
Public Member Functions | Private Attributes
source_location Class Reference

#include <source_location.h>

Public Member Functions

virtual ~source_location ()
 source_location ()
 source_location (const rcstring &file_name, int line_number)
 source_location (const source_location &rhs)
source_locationoperator= (const source_location &rhs)
rcstring get_file_name (void) const
int get_line_number (void) const
rcstring get_both (void) const
source_location operator+ (int nlines) const

Private Attributes

rcstring file_name
int line_number

Detailed Description

The source_location class is used to represent the position of an something within a source text file, identified by file name and line number.

Definition at line 29 of file source_location.h.


Constructor & Destructor Documentation

The destructor.

Definition at line 25 of file source_location.cc.

The default constructor.

Definition at line 30 of file source_location.cc.

source_location::source_location ( const rcstring file_name,
int  line_number 
)

The constructor.

Parameters:
file_nameThe name of the source file in which the thing appears.
line_numberThe number of the line within the source file in which the thing appears.

Definition at line 37 of file source_location.cc.

The copy constructor.

Parameters:
rhsThe right hand side of the initialization.

Definition at line 48 of file source_location.cc.


Member Function Documentation

The get_both method is used to obtain both the file name and the line number, formatted as "%s: %d" for use in error messages.

Definition at line 68 of file source_location.cc.

rcstring source_location::get_file_name ( void  ) const [inline]

The get_file_name method is used to obtain the name of the source file in which the thing appears.

Definition at line 73 of file source_location.h.

int source_location::get_line_number ( void  ) const [inline]

The get_line_number method is used to obtain the number of the line within the source file in which the thing appears.

Definition at line 79 of file source_location.h.

source_location source_location::operator+ ( int  nlines) const

The addition operator is used to create a new source location by adding the given number of lines to this location.

Definition at line 80 of file source_location.cc.

source_location & source_location::operator= ( const source_location rhs)

The assignment operator.

Parameters:
rhsThe right hand side of the assignment.

Definition at line 56 of file source_location.cc.


Field Documentation

The file_name instance variable is used to remember the name of the source file in which the thing appears.

Definition at line 98 of file source_location.h.

The line_number instance variable is used to remember the number (starting from 1) of the line within the source file in which the thing appears.

Definition at line 105 of file source_location.h.


The documentation for this class was generated from the following files: