nis-util  1.0.D108
Public Member Functions | Protected Types | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
colon Class Reference

#include <colon.h>

Inheritance diagram for colon:
colon_group colon_passwd colon_group_slurp colon_passwd_slurp colon_group_slurp_check colon_passwd_slurp_check

Public Member Functions

virtual ~colon ()
 colon (const rcstring &filename)
void discard_blank_lines (void)
void discard_comments (void)
void explain_sequence_errors (void)

Protected Types

typedef std::vector< rcstringline_t

Protected Member Functions

void close (void)
bool read_one_line (line_t &result)
bool read_one_line (source_location &result_locn, line_t &result)
void error (const source_location &locn, const char *fmt,...) ATTRIBUTE_PRINTF(3
void void pedantic_error (const source_location &locn, const char *fmt,...) ATTRIBUTE_PRINTF(3
void void void warning (const source_location &locn, const char *fmt,...) ATTRIBUTE_PRINTF(3

Private Types

enum  token_ty { token_eof, token_eoln, token_colon, token_string }

Private Member Functions

void open (void)
void lex (void)
source_location get_source_location (void) const
void verror (const source_location &locn, const char *fmt, va_list ap) ATTRIBUTE_PRINTF(3
void void vwarning (const source_location &locn, const char *fmt, va_list ap) ATTRIBUTE_PRINTF(3
void void void vpedantic_error (const source_location &locn, const char *fmt, va_list ap) ATTRIBUTE_PRINTF(3
 colon ()
 colon (const colon &)
colonoperator= (const colon &)

Private Attributes

rcstring filename
input::pointer ip
bool non_printing_whine
token_ty token
rcstring token_value
int error_count
bool discard_comments_flag
bool discard_blank_lines_flag
source_location token_locn
bool explained_sequence_errors

Detailed Description

The colon class is used to represent the parse state when reading colon separated files (/etc/passwd and the like).

Definition at line 34 of file colon.h.


Member Typedef Documentation

typedef std::vector<rcstring> colon::line_t [protected]

This is the type of lines returned by the get_one_line method.

Definition at line 77 of file colon.h.


Member Enumeration Documentation

enum colon::token_ty [private]
Enumerator:
token_eof 
token_eoln 
token_colon 
token_string 

Definition at line 219 of file colon.h.


Constructor & Destructor Documentation

colon::~colon ( ) [virtual]

The destructor.

Definition at line 34 of file colon.cc.

colon::colon ( const rcstring filename)

The constructor.

Definition at line 40 of file colon.cc.

colon::colon ( ) [private]

The default constructor. Do not use.

colon::colon ( const colon ) [private]

The copy constructor. Do not use.


Member Function Documentation

void colon::close ( void  ) [protected]

The close method is used to close the input file, if it isn't closed already. If there were any errors, they are reported and the program will exitr.

Definition at line 65 of file colon.cc.

void colon::discard_blank_lines ( void  )

The discard_blank_lines method is used to prevent blank lines being returned by the read_one_line method.

Definition at line 305 of file colon.cc.

void colon::discard_comments ( void  )

The discard_comments method is used to prevent comment lines (with a '#' in column one) being returned by the read_one_line method.

Definition at line 312 of file colon.cc.

void colon::error ( const source_location locn,
const char *  fmt,
  ... 
) [protected]

The error method is used to report fatal errors. The message is printed on the standard error, along with the file name and line number, and the error count incremented.

Parameters:
locnThe location of the error.
fmtThe format of the message, including the number and types of the arguments.

Definition at line 151 of file colon.cc.

The explain_sequence_errors method is used to explain why the file should be sorted, when an out-of-order error is issued. It is only ever issued once for each file.

Definition at line 319 of file colon.cc.

source_location colon::get_source_location ( void  ) const [private]

The get_source_location method is used to obtain the location of the read point at this moment.

Definition at line 83 of file colon.cc.

void colon::lex ( void  ) [private]

Fetch the next input token. Sets the `token' instance variable, and also the token_value instance variable for strings.

Definition at line 93 of file colon.cc.

void colon::open ( void  ) [private]

The open method is used to open the input file, if it isn't open already.

Definition at line 53 of file colon.cc.

colon& colon::operator= ( const colon ) [private]

The assignment operator. Do not use.

void colon::pedantic_error ( const source_location locn,
const char *  fmt,
  ... 
) [protected]

The pedantic_error method is used to report fatal errors if pedantic errors are enabled, otherwise these are warnings. The message is printed on the standard error, along with the file name and line number.

Parameters:
locnThe location of the error.
fmtThe format of the message, including the number and types of the arguments.

Definition at line 181 of file colon.cc.

bool colon::read_one_line ( line_t result) [protected]

The get_one_line method is used to read one line from the file, splitting it into colon-separated fields.

Parameters:
resultThe text of the line is placed here.
Returns:
true if a line has been read, false at end of file.
bool colon::read_one_line ( source_location result_locn,
line_t result 
) [protected]

The get_one_line method is used to read one line from the file, splitting it into colon-separated fields.

Parameters:
result_locnThe source location of the beginning of the line is placed here.
resultThe text of the line is placed here.
Returns:
true if a line has been read, false at end of file.

Definition at line 230 of file colon.cc.

void colon::verror ( const source_location locn,
const char *  fmt,
va_list  ap 
) [private]

The verror method is used to report fatal errors. The message is printed on the standard error, along with the file name and line number, and the error count incremented.

Parameters:
locnThe location of the error.
fmtThe format of the message, including the number and types of the arguments.
apThe arguments.

Definition at line 161 of file colon.cc.

void colon::vpedantic_error ( const source_location locn,
const char *  fmt,
va_list  ap 
) [private]

The vpedantic_error method is used to report fatal errors if pedantic errors are enabled, otherwise these are warnings. The message is printed on the standard error, along with the file name and line number.

Parameters:
locnThe location of the error.
fmtThe format of the message, including the number and types of the arguments.
apThe arguments.

Definition at line 191 of file colon.cc.

void colon::vwarning ( const source_location locn,
const char *  fmt,
va_list  ap 
) [private]

The waring method is used to report non-fatal errors. The message is printed on the standard error, along with the file name and line number. The error count is NOT incremented.

Parameters:
locnThe location of the error.
fmtthe format of the message, it also defines the number and types of the remaining arguments.
apThe arguments.

Definition at line 211 of file colon.cc.

void colon::warning ( const source_location locn,
const char *  fmt,
  ... 
) [protected]

The waring method is used to report non-fatal errors. The message is printed on the standard error, along with the file name and line number. The error count is NOT incremented.

Parameters:
locnThe location of the error.
fmtthe format of the message, it also defines the number and types of the remaining arguments.

Definition at line 201 of file colon.cc.


Field Documentation

The fubar instance variable is used to remember

Definition at line 268 of file colon.h.

The fubar instance variable is used to remember

Definition at line 263 of file colon.h.

int colon::error_count [private]

The fubar instance variable is used to remember

Definition at line 258 of file colon.h.

The explained_sequence_errors instance variable is used to remember whether or not an explanation has been issed for sequence errors.

Definition at line 280 of file colon.h.

The filename instance variable is used to remember the name of the file to be read.

Definition at line 231 of file colon.h.

The ip instance variable is used to rememeber the source of input, when open, and the current read position.

Definition at line 237 of file colon.h.

bool colon::non_printing_whine [private]

The fubar instance variable is used to remember

Definition at line 242 of file colon.h.

The fubar instance variable is used to remember

Definition at line 247 of file colon.h.

The token_locn instance variable is used to remember the source file location o fthe most recent token returned by the lex method.

Definition at line 274 of file colon.h.

The token_value instance variable is used to remember the string value of the most recent token returned by the lex method.

Definition at line 253 of file colon.h.


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