suplibxx  1.3.13
Input/Output

Enumerations

enum  suplib::readopt {
  suplib::READ_PHYS = 0x00, suplib::READ_LOGICAL = 0x01, suplib::STRIP = 0x02, suplib::CLEAN = 0x04,
  suplib::RAW = 0x08
}
 Control options for getrecord. More...
 

Functions

std::istream & suplib::getrecord (std::istream &is, std::string &str, int opt=READ_PHYS, char delim='\n', char continuation='\\')
 Reads physical and logical lines. More...
 

Detailed Description

Enumeration Type Documentation

◆ readopt

Control options for getrecord.

Enumerator
READ_PHYS 

A single physical line makes up a record. A physical line is defined to be all characters up to the delim character. The delim character is not returned. This ignores any line continuation character. This is the default.

READ_LOGICAL 

A record may span multiple physical lines if the end-of-line delimiter is preceded by the continuation character. For ease of use, whitespace characters between the continuation character and the delim character are ignored.

STRIP 

remove all trailing whitespace from the end of a record.

CLEAN 

on a line with a continuation character, remove any white space following the continuation character, and add a delimiter directly following the continuation character. It has no effect on physical records or the final line in a continued logical record.

RAW 

return the input record (logical or physical) as is, without removing white space. end of line delimiters will be returned, but because they must be explicitly place din the string (becasue getline() is used to read from the input stream and it silently removes delimiters), there may be an extra delimiter at the end of the record if the input stream ended without a trailing delimiter

Definition at line 41 of file io.h.

Function Documentation

◆ getrecord()

std::istream & suplib::getrecord ( std::istream &  is,
std::string &  str,
int  opt = READ_PHYS,
char  delim = '\n',
char  continuation = '\\' 
)

Reads physical and logical lines.

Parameters
isthe istream from which to read.
strthe string into which to read.
optthe control options.
delimthe character which indicates the end of a physical line.
continuationthe character directly proceeding the delim which indicates a logical record continues on the following physical line.

getrecord reads a line from the specified istream. It always reads a complete line, enlarging the string as necessary. The opt argument specifies a set of control flag, which are created by logically OR'ing suplib::readopt values.

Returns
It returns the input istream after attempting to read lines from it.

Definition at line 53 of file getrecord.cc.