xorp

XrlParserFileInput Class Reference

XrlParserFileInput class reads lines from a data source, strips out comments and handles continuation characters. More...

#include <xrl_parser_input.hh>

Inheritance diagram for XrlParserFileInput:
XrlParserInput

List of all members.

Classes

struct  FileState

Public Member Functions

 XrlParserFileInput (istream *input, const char *fname="") throw (XrlParserInputException)
 Constructor.
 XrlParserFileInput (const char *filename) throw (XrlParserInputException)
bool eof () const
bool getline (string &line) throw (XrlParserInputException)
 Retrieves 1 line of input from source.
string stack_trace () const
list< string > & path ()

Protected Types

enum  Mode { NORMAL = 0x00, IN_SQUOTE = 0x01, IN_DQUOTE = 0x02, IN_C_COMMENT = 0x04 }

Protected Member Functions

bool slurp_line (string &line) throw (XrlParserInputException)
void push_stack (const FileState &fs) throw (XrlParserInputException)
 Push FileState onto stack.
void pop_stack ()
FileStatestack_top ()
size_t stack_depth () const
ifstream * path_open_input (const char *filename) throw (XrlParserInputException)
void close_input (istream *pif)
string try_include (string::const_iterator &begin, const string::const_iterator &end) throw (XrlParserInputException)
void initialize_path ()
bool filter_line (string &output, const string &input)

Protected Attributes

vector< FileState_stack
list< string > _path
bool _own_bottom
list< string > _inserted_lines
enum XrlParserFileInput::Mode _current_mode

Detailed Description

XrlParserFileInput class reads lines from a data source, strips out comments and handles continuation characters.

It is similar to the C-preprocessor in that it strips out C and C++ comments and handles #include directives.


Constructor & Destructor Documentation

XrlParserFileInput::XrlParserFileInput ( istream *  input,
const char *  fname = "" 
) throw (XrlParserInputException)

Constructor.

Parameters:
inputinput file stream.
fnamefilename.
Exceptions:
XrlParserInputExceptionif input file stream is not good().

Member Function Documentation

bool XrlParserFileInput::eof ( ) const [virtual]
Returns:
true if no more data is available for reading.

Implements XrlParserInput.

bool XrlParserFileInput::filter_line ( string &  output,
const string &  input 
) [protected]
Returns:
true if another line is required because of a continuation, false otherwise.
bool XrlParserFileInput::getline ( string &  lineout) throw (XrlParserInputException) [virtual]

Retrieves 1 line of input from source.

Parameters:
lineoutstring that is set if line of text is available.
Returns:
true if line was read into lineout, false otherwise.

Implements XrlParserInput.

list<string>& XrlParserFileInput::path ( ) [inline]
Returns:
include path preprocessor looks for files in.
void XrlParserFileInput::push_stack ( const FileState fs) throw (XrlParserInputException) [protected]

Push FileState onto stack.

Exceptions:
XrlParserInputExceptionif input file stream is not good();
string XrlParserFileInput::stack_trace ( ) const [virtual]
Returns:
string containing stack trace to be used for tracking errors in the input.

Implements XrlParserInput.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations