Canola
0.8.D001
|
#include <location.h>
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) | |
location & | operator= (const location &rhs) |
Private Attributes | |
std::string | filename |
int | line_number |
size_t | byte_start |
size_t | byte_length |
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.
typedef boost::shared_ptr<location> location::pointer |
Definition at line 35 of file location.h.
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.
filename | The name of the text source file |
line_number | The line number of the text source file |
byte_start | The byte address of the token within the source file. |
byte_length | The 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
rhs | The right hand side of the initialization. |
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.
filename | The name of the text source file |
line_number | The line number of the text source file |
byte_start | The byte address of the token within the source file. |
byte_length | The 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.
The assignment operator. Do not use
rhs | The 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.
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.