lestes::std::source_location Class Reference

#include <source_location.hh>

Inheritance diagram for lestes::std::source_location:

lestes::std::object lestes::std::mem::keystone List of all members.

Public Member Functions

ptr< file_infofile_get (void) const
 Returns file information.
ulint line_get (void) const
 Returns line in file.
ulint column_get (void) const
 Returns column on line.
ulint order_get (void) const
 Returns order.
bool equals (const ptr< source_location > &rhs) const
 Tests equality.
ptr< source_locationclone_order (ulint a_order) const
 Clones location with new order.
ptr< source_locationclone_file (const ptr< file_info > &a_file) const
 Clones location with new file information.
virtual ptr< reflection_listreflection_get (void) const
 Returns list of reflection info.
virtual ptr< field_list_listfield_values_get (void) const
 Returns list of field values.

Static Public Member Functions

static ptr< source_locationcreate (const ptr< file_info > &a_file, ulint a_line, ulint a_column)
 Returns new location, initializes with file information and position.
static ptr< source_locationcreate (const ptr< file_info > &a_file, ulint a_line, ulint a_column, ulint a_order)
 Returns new location, initializes with file information, position and order.
static ptr< source_locationzero (void)
 Returns zero location.

Protected Member Functions

 source_location (const ptr< file_info > &a_file, ulint a_line, ulint a_column, ulint a_order)
 Creates new object, initializes with file information, postion and order.
void gc_mark ()
 Marking routine.

Private Member Functions

 source_location (const source_location &)
 Hides copy constructor.
source_locationoperator= (const source_location &)
 Hides assigment operator.

Private Attributes

srp< file_infofile
 File information structure.
ulint line
 Line in file.
ulint column
 Column inside the line.
ulint order
 The order in the translation unit.

Static Private Attributes

static ptr< source_locationzero_instance = zero_instance
 Zero location instance.
static ptr< reflection_listreflection = reflection
 The reflection information.

Detailed Description

Represents location of token in file inclusion chain and the file itself. The object is intentionally inmutable to simplify the processing.

Definition at line 48 of file source_location.hh.


Constructor & Destructor Documentation

lestes::std::source_location::source_location ( const ptr< file_info > &  a_file,
ulint  a_line,
ulint  a_column,
ulint  a_order 
) [protected]

Creates new object, initializes with file information, postion and order.

Creates new object, initializes with file information and position.

Precondition:
a_file != NULL
Parameters:
a_file The file information.
a_line The line in the file.
a_column The column on the line.
a_order The order in the translation unit.

Definition at line 55 of file source_location.cc.

Referenced by clone_file(), clone_order(), create(), and zero().

00056                                                             :
00057         file((lassert(a_file), a_file)),
00058         line(a_line),
00059         column(a_column),
00060         order(a_order)
00061 {
00062 }

lestes::std::source_location::source_location ( const source_location  )  [private]

Hides copy constructor.


Member Function Documentation

ptr< file_info > lestes::std::source_location::file_get ( void   )  const

Returns file information.

Returns file information.

Returns:
The file information.

Definition at line 77 of file source_location.cc.

References file.

Referenced by clone_order(), and field_values_get().

00078 {
00079         return file;
00080 }

ulint lestes::std::source_location::line_get ( void   )  const

Returns line in file.

Returns position in the file.

Returns:
The line number.

Definition at line 86 of file source_location.cc.

References line.

Referenced by clone_file(), clone_order(), and field_values_get().

00087 {
00088         return line;
00089 }

ulint lestes::std::source_location::column_get ( void   )  const

Returns column on line.

Returns position on the line.

Returns:
The column number.

Definition at line 95 of file source_location.cc.

References column.

Referenced by clone_file(), clone_order(), and field_values_get().

00096 {
00097         return column;
00098 }

ulint lestes::std::source_location::order_get ( void   )  const

Returns order.

Returns order in translation unit.

Returns:
The order.

Definition at line 115 of file source_location.cc.

References order.

Referenced by clone_file(), and field_values_get().

00116 {
00117         return order;
00118 }

bool lestes::std::source_location::equals ( const ptr< source_location > &  rhs  )  const

Tests equality.

Tests equality to other source_location.

Parameters:
rhs The location to compare to.

Definition at line 104 of file source_location.cc.

References column, file, lestes::is_equal(), and line.

00105 {
00106         return rhs && is_equal(file,rhs->file_get()) &&
00107           is_equal(line,rhs->line_get()) &&
00108           is_equal(column,rhs->column_get());
00109 }

ptr< source_location > lestes::std::source_location::clone_order ( ulint  a_order  )  const

Clones location with new order.

Clones the location with new order.

Parameters:
a_order The order for the new location.
Returns:
The location with changed order.

Definition at line 125 of file source_location.cc.

References column_get(), file_get(), line_get(), and source_location().

00126 {
00127         return new source_location(file_get(),line_get(),column_get(),a_order);
00128 }

ptr< source_location > lestes::std::source_location::clone_file ( const ptr< file_info > &  a_file  )  const

Clones location with new file information.

Clones the location with new file information.

Parameters:
a_file The file_information for the new location.
Returns:
The location with changed file information.

Definition at line 135 of file source_location.cc.

References column_get(), line_get(), order_get(), and source_location().

00136 {
00137         return new source_location(a_file,line_get(),column_get(),order_get());
00138 }

ptr< source_location > lestes::std::source_location::create ( const ptr< file_info > &  a_file,
ulint  a_line,
ulint  a_column 
) [static]

Returns new location, initializes with file information and position.

Returns new instance, initializes with file information and position.

Precondition:
a_file != NULL
Parameters:
a_file The file information.
a_line The line in the file.
a_column The column on the line.
Returns:
The location.

Definition at line 148 of file source_location.cc.

References source_location().

00150 {
00151         return new source_location(a_file,a_line,a_column,0);
00152 }

ptr< source_location > lestes::std::source_location::create ( const ptr< file_info > &  a_file,
ulint  a_line,
ulint  a_column,
ulint  a_order 
) [static]

Returns new location, initializes with file information, position and order.

Returns new instance, initializes with file information, position and order.

Precondition:
a_file != NULL
Parameters:
a_file The file information.
a_line The line in the file.
a_column The column on the line.
a_order The order in the translation unit.
Returns:
The location.

Definition at line 163 of file source_location.cc.

References source_location().

00165 {
00166         return new source_location(a_file,a_line,a_column,a_order);
00167 }

ptr< source_location > lestes::std::source_location::zero ( void   )  [static]

Returns zero location.

Returns location at the beginning of the translation unit.

Returns:
The zero location.

Definition at line 173 of file source_location.cc.

References lestes::std::file_info::create(), source_location(), and zero_instance.

00174 {
00175         if (!zero_instance) {
00176                 zero_instance = new source_location(file_info::create("<internal>",NULL),1,1,0);
00177         }
00178         return zero_instance;
00179 }

ptr< object::reflection_list > lestes::std::source_location::reflection_get ( void   )  const [virtual]

Returns list of reflection info.

Returns reflection list for source location.

Returns:
The reflection list.

Reimplemented from lestes::std::object.

Definition at line 185 of file source_location.cc.

References lestes::std::class_reflection::create(), lestes::std::list< T >::create(), reflection, and lestes::std::object::reflection_get().

00186 {
00187         if (!reflection) {
00188                 typedef class_reflection::field_metadata md;
00189                 typedef class_reflection::field_metadata_list mdlist;
00190                 ptr<mdlist> mdl = mdlist::create();
00191                 mdl->push_back(md::create("file","lstring"));
00192                 mdl->push_back(md::create("line","ulint"));
00193                 mdl->push_back(md::create("column","ulint"));
00194                 mdl->push_back(md::create("order","ulint"));
00195                 reflection = reflection_list::create(object::reflection_get());
00196                 reflection->push_back(class_reflection::create("source_location",mdl));
00197         }
00198         return reflection;
00199 }

ptr< object::field_list_list > lestes::std::source_location::field_values_get ( void   )  const [virtual]

Returns list of field values.

Returns values of the fields.

Returns:
List of field values.

Reimplemented from lestes::std::object.

Definition at line 205 of file source_location.cc.

References column_get(), lestes::std::list< T >::create(), lestes::std::object::field_values_get(), file_get(), line_get(), and order_get().

00206 {
00207         ptr<field_list_list> result = object::field_values_get();
00208         result->push_back(value_list::create());
00209         result->back()->push_back(objectize<lstring>::create(file_get()->name_get()));
00210         result->push_back(value_list::create());
00211         result->back()->push_back(objectize<ulint>::create(line_get()));
00212         result->push_back(value_list::create());
00213         result->back()->push_back(objectize<ulint>::create(column_get()));
00214         result->push_back(value_list::create());
00215         result->back()->push_back(objectize<ulint>::create(order_get()));
00216         return result;
00217 }

void lestes::std::source_location::gc_mark ( void   )  [protected, virtual]

Marking routine.

Standard marking routine, called by the garbage collector.

Reimplemented from lestes::std::mem::keystone.

Definition at line 67 of file source_location.cc.

References file, lestes::std::mem::keystone::gc_mark(), and lestes::std::mem::simple_pointer::gc_mark().

00068 {
00069         file.gc_mark();
00070         object::gc_mark();
00071 }

source_location& lestes::std::source_location::operator= ( const source_location  )  [private]

Hides assigment operator.


Member Data Documentation

srp<file_info> lestes::std::source_location::file [private]

File information structure.

Definition at line 84 of file source_location.hh.

Referenced by equals(), file_get(), and gc_mark().

ulint lestes::std::source_location::line [private]

Line in file.

Definition at line 86 of file source_location.hh.

Referenced by equals(), and line_get().

ulint lestes::std::source_location::column [private]

Column inside the line.

Definition at line 88 of file source_location.hh.

Referenced by column_get(), and equals().

ulint lestes::std::source_location::order [private]

The order in the translation unit.

Definition at line 90 of file source_location.hh.

Referenced by order_get().

ptr< source_location > lestes::std::source_location::zero_instance = zero_instance [static, private]

Zero location instance.

The zero location instance at the beginning of the translation unit.

Definition at line 92 of file source_location.hh.

Referenced by zero().

ptr< object::reflection_list > lestes::std::source_location::reflection = reflection [static, private]

The reflection information.

Reflection list for source location.

Reimplemented from lestes::std::object.

Definition at line 94 of file source_location.hh.

Referenced by reflection_get().


The documentation for this class was generated from the following files:
Generated on Mon Feb 12 18:26:00 2007 for lestes by doxygen 1.5.1-20070107