lestes::msg::report_ostream Class Reference

Report output. More...

#include <report_ostream.hh>

Inheritance diagram for lestes::msg::report_ostream:

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

Public Member Functions

virtual void process (const ptr< message > &a_message, const ptr< source_location > &a_location)
 Writes report to stream.

Static Public Member Functions

static ptr< report_ostreamcreate (const ptr< report_filter > &a_output, const ptr< ostream_wrapper > &a_stream)
 Returns new instance.

Protected Member Functions

 report_ostream (const ptr< report_filter > &a_output, const ptr< ostream_wrapper > &a_stream)
 Creates the object.
virtual void gc_mark (void)
 Marks the object.

Private Member Functions

 report_ostream (const report_ostream &)
 Hides copy constructor.
report_ostreamoperator= (const report_ostream &)
 Hides assignment operator.

Private Attributes

srp< ostream_wrapper > stream
 Output stream.

Detailed Description

Report output.

Writes reports to a supplied stream.

Definition at line 56 of file report_ostream.hh.


Constructor & Destructor Documentation

lestes::msg::report_ostream::report_ostream ( const ptr< report_filter > &  a_output,
const ptr< ostream_wrapper > &  a_stream 
) [protected]

Creates the object.

Creates the report stream output.

Parameters:
a_output The output of the filter.
a_stream The stream to write to.

Definition at line 48 of file report_ostream.cc.

Referenced by create().

00049                                                      :
00050         report_filter(checked(a_output)),
00051         stream(checked(a_stream))
00052 {
00053 }
        

lestes::msg::report_ostream::report_ostream ( const report_ostream  )  [private]

Hides copy constructor.


Member Function Documentation

void lestes::msg::report_ostream::process ( const ptr< message > &  a_message,
const ptr< source_location > &  a_location 
) [virtual]

Writes report to stream.

Writes the report to a stream.

Precondition:
a_message != NULL

a_location != NULL

Parameters:
a_message The message to write.
a_location The location to write.

Implements lestes::msg::report_filter.

Definition at line 62 of file report_ostream.cc.

References lestes::msg::message::FLG_WARNING, lassert, lestes::msg::report_filter::process_output(), and stream.

00064 {
00065         lassert(a_message);
00066         lassert(a_location);
00067   
00068         ostream_wrapper::stream_type o(stream->stream_get());
00069 
00070         ptr<source_location> parent = a_location->file_get()->origin_get();
00071         if (parent) {
00072                 ptr<file_info> file;
00073                 bool first = true;
00074                 
00075                 while (parent) {
00076                         file = parent->file_get();
00077                         // TODO make this via symbols, so that it needs not be localized
00078                         // not to mention that the current text is too long
00079                         (*o) << 
00080                                 (first ?
00081                                         "In file included from " : 
00082                                 ",\n                 from " ) << 
00083                                         file->name_get() << 
00084                                 ':' << parent->line_get();
00085                         parent = file->origin_get();
00086                         first = false;
00087                 }
00088 
00089                 (*o) << ":\n";
00090         }
00091 
00092         (*o) << a_location->file_get()->name_get() << ':' << 
00093                           a_location->line_get() << ':' << 
00094                           a_location->column_get() << 
00095                           (a_message->flags_get() == message::FLG_WARNING ? ": warning: " : ": ") <<
00096                           a_message->text_get() << '\n';
00097         
00098         // continue processing
00099         process_output(a_message,a_location);
00100 }

ptr< report_ostream > lestes::msg::report_ostream::create ( const ptr< report_filter > &  a_output,
const ptr< ostream_wrapper > &  a_stream 
) [static]

Returns new instance.

Creates the report stream output, initializes with output and stream.

Precondition:
a_output != NULL

a_stream != NULL

Parameters:
a_output The output of the filter.
a_stream The stream to write to.
Returns:
New report stream output filter.

Definition at line 118 of file report_ostream.cc.

References report_ostream().

Referenced by lestes::lang::cplus::lex::run().

00120 {
00121         return new report_ostream(a_output,a_stream);
00122 }

void lestes::msg::report_ostream::gc_mark ( void   )  [protected, virtual]

Marks the object.

Marks the object.

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

Definition at line 105 of file report_ostream.cc.

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

00106 {
00107         stream.gc_mark();
00108         report_filter::gc_mark();
00109 }

report_ostream& lestes::msg::report_ostream::operator= ( const report_ostream  )  [private]

Hides assignment operator.


Member Data Documentation

srp<ostream_wrapper> lestes::msg::report_ostream::stream [private]

Output stream.

Definition at line 70 of file report_ostream.hh.

Referenced by gc_mark(), and process().


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