MyBooks
Public Member Functions | Private Attributes | List of all members
CSVWriter Class Reference

Constructs CSVWriter using a comma for the separator. More...

#include <csvwriter.hpp>

Public Member Functions

 CSVWriter (Writer writer)
 
 CSVWriter (Writer writer, char separator, char quotechar, char escapechar, String lineEnd)
 Constructs CSVWriter with supplied separator, quote char, escape char and line ending. More...
 
void writeNext (QString nextLine)
 Writes the next line to the file. More...
 
void flush () throws IOException
 Flush underlying stream to writer. More...
 
void close () throws IOException
 Close the underlying stream writer. More...
 

Private Attributes

PrintWriter pw
 
char separator
 
char quotechar
 
char escapechar
 
QString lineEnd
 

Detailed Description

Constructs CSVWriter using a comma for the separator.

Parameters
writer- the writer to an underlying CSV source.

Constructor & Destructor Documentation

◆ CSVWriter() [1/2]

CSVWriter::CSVWriter ( Writer  writer)
inline

◆ CSVWriter() [2/2]

CSVWriter::CSVWriter ( Writer  writer,
char  separator,
char  quotechar,
char  escapechar,
String  lineEnd 
)
inline

Constructs CSVWriter with supplied separator, quote char, escape char and line ending.

Parameters
writer- the writer to an underlying CSV source.
separator- the delimiter to use for separating entries
quotechar- the character to use for quoted elements
escapechar- the character to use for escaping quotechars or escapechars
lineEnd- the line feed terminator to use

Member Function Documentation

◆ close()

void CSVWriter::close ( ) throws IOException
inline

Close the underlying stream writer.

Close the underlying stream writer flushing any buffered content.

Exceptions
IOExceptionif bad things happen

◆ flush()

void CSVWriter::flush ( ) throws IOException
inline

Flush underlying stream to writer.

Exceptions
IOExceptionif bad things happen

◆ writeNext()

void CSVWriter::writeNext ( QString  nextLine)
inline

Writes the next line to the file.

Parameters
nextLine- a string array with each comma-separated element as a separate entry.

Member Data Documentation

◆ escapechar

char CSVWriter::escapechar
private

◆ lineEnd

QString CSVWriter::lineEnd
private

◆ pw

PrintWriter CSVWriter::pw
private

◆ quotechar

char CSVWriter::quotechar
private

◆ separator

char CSVWriter::separator
private

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