Canola  0.8.D001
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
location Class Reference

#include <location.h>

List of all members.

Public Types

typedef boost::shared_ptr
< location
pointer

Public Member Functions

virtual ~location ()
std::string get_filename (void) const
int get_line_number (void) const
size_t get_start (void) const
size_t get_end (void) const
std::string representation (void) const
 For debugging.

Static Public Member Functions

static pointer create (const std::string &filename, int line_number, size_t byte_start, size_t byte_length)
static location::pointer span (const location::pointer &from, const location::pointer &to)

Private Member Functions

 location (const std::string &filename, int line_number, size_t byte_start, size_t byte_length)
 location ()
 location (const location &rhs)
locationoperator= (const location &rhs)

Private Attributes

std::string filename
int line_number
size_t byte_start
size_t byte_length

Detailed Description

The location class is used to represent a span of text from a source file. The line number is included, but the byte range will be more useful in getting a text view widget to track it.

Definition at line 32 of file location.h.


Member Typedef Documentation

typedef boost::shared_ptr<location> location::pointer

Definition at line 35 of file location.h.


Constructor & Destructor Documentation

location::~location ( ) [virtual]

The destructor.

Definition at line 22 of file location.cc.

location::location ( const std::string &  filename,
int  line_number,
size_t  byte_start,
size_t  byte_length 
) [private]

The constructor. It is private on purpose, use the create class method instead.

Parameters:
filenameThe name of the text source file
line_numberThe line number of the text source file
byte_startThe byte address of the token within the source file.
byte_lengthThe byte length of the token in the source file.

Definition at line 27 of file location.cc.

location::location ( ) [private]

The default constructor. Do not use

location::location ( const location rhs) [private]

The copy constructor. Do not use

Parameters:
rhsThe right hand side of the initialization.

Member Function Documentation

location::pointer location::create ( const std::string &  filename,
int  line_number,
size_t  byte_start,
size_t  byte_length 
) [static]

The create class method is used to create new dynamically allocated instance of this class.

Parameters:
filenameThe name of the text source file
line_numberThe line number of the text source file
byte_startThe byte address of the token within the source file.
byte_lengthThe byte length of the token in the source file.

Definition at line 42 of file location.cc.

size_t location::get_end ( void  ) const [inline]

Definition at line 64 of file location.h.

std::string location::get_filename ( void  ) const [inline]

Definition at line 61 of file location.h.

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

Definition at line 62 of file location.h.

size_t location::get_start ( void  ) const [inline]

Definition at line 63 of file location.h.

location& location::operator= ( const location rhs) [private]

The assignment operator. Do not use

Parameters:
rhsThe right hand side of the assignment.
std::string location::representation ( void  ) const

For debugging.

Definition at line 72 of file location.cc.

location::pointer location::span ( const location::pointer from,
const location::pointer to 
) [static]

Definition at line 54 of file location.cc.


Member Data Documentation

size_t location::byte_length [private]

The byte_length instance variable is used to remember the byte length of the token in the source file.

Definition at line 108 of file location.h.

size_t location::byte_start [private]

The byte_start instance variable is used to remember the byte address of the token within the source file.

Definition at line 102 of file location.h.

std::string location::filename [private]

The filename instance variable is used to remember the name of the text source file.

Definition at line 90 of file location.h.

int location::line_number [private]

The line_number instance variable is used to remember the line number of the text source file.

Definition at line 96 of file location.h.


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