Loading...
Searching...
No Matches
ZipTsvOutputStream Class Reference

`#include <ziptsvoutputstream.h>`

Inheritance diagram for ZipTsvOutputStream:

## Public Member Functions

| ZipTsvOutputStream (const QString &zipfilename)
virtual | ~ZipTsvOutputStream ()
virtual void | writeSheet (const QString &sheetName) override
| open a new sheet
void | close () override
Public Member Functions inherited from TsvDirectoryWriter
| TsvDirectoryWriter (const QDir &directory)
virtual | ~TsvDirectoryWriter ()
void | writeLine () override
| open a new line
void | writeCell (const char *) override
| write a text cell
void | writeCell (const QString &) override
| write a text cell
void | writeEmptyCell () override
| write an empty cell
void | writeCell (std::size_t) override
| write an unsigned integer in a cell
void | writeCell (int) override
| write an integer in a cell
void | writeCell (float) override
| write a float in a cell
void | writeCell (double) override
| write a double in a cell
void | writeCellPercentage (double value) override
| write a double as a percentage
void | writeCell (bool) override
| write a boolean in a cell
void | writeCell (const QDate &) override
| write a date in a cell
void | writeCell (const QDateTime &) override
| write a timestamp in a cell
void | writeCell (const QUrl &, const QString &) override
| write a text cell with an URL link
void | setCellAnnotation (const QString &annotation) override
| set annotation to write in the next cell
void | setSeparator (TsvSeparator separator)
| sets the separator to use between values (cells)
TsvSeparator | getSeparator () const
| get the separator used between values (cells)
bool | setQuoteStrings (bool quote_strings)
| set a flag to quote strings
bool | isQuoteStrings () const
| tells if the quote string flag is enabled
bool | setFlushLines (bool flushOk)
| enable a physical flush on device at each new line enables this if you want to ensure that each line is written. This costs a little overhead
bool | isFlushLines () const
| tells if the flush lines flag is enabled
Public Member Functions inherited from CalcWriterInterface
virtual | ~CalcWriterInterface ()
virtual OdsTableCellStyleRef | getTableCellStyleRef (const OdsTableCellStyle &style)
virtual void | setTableCellStyleRef (OdsTableCellStyleRef style_ref)
void | clearTableCellStyleRef ()
virtual void | addColorScale (const OdsColorScale &ods_color_scale)
| apply solor scale conditional format on a cell range
virtual QString | getOdsCellCoordinate ()
| get the last written cell coordinate in ODS coordinate format get the coordinate of the last written cell or an empty string if the writer is not an OdsDocWriter
virtual void | setCurrentOdsTableSettings (const OdsTableSettings &settings)
| set ODS table settings of the current sheet (table)
virtual void | writeCellVariant (const QVariant &var)
| write a cell for a given QVariant

## Private Member Functions

void | closeCurrentZipSheet ()

## Private Attributes

QFile * | mpa_fileZipArchive = nullptr
QuaZip * | mpa_quaZip = nullptr
QuaZipFile * | mpa_outFileInZip = nullptr

## Additional Inherited Members

Protected Member Functions inherited from TsvDirectoryWriter
| TsvDirectoryWriter ()
void | writeRawCell (const QString &text)
void | initializeSheet ()
Protected Attributes inherited from TsvDirectoryWriter
QString | m_separator = "\t"
QString | _end_of_line = "\n"
QTextStream * | mpa_otxtstream = nullptr
unsigned int | numFloatPrecision = 12

## Detailed Description

Todo
  write docs

Definition at line 37 of file ziptsvoutputstream.h.

## Constructor & Destructor Documentation

## ZipTsvOutputStream()

ZipTsvOutputStream::ZipTsvOutputStream | ( | const QString & | zipfilename | ) |

Default constructor

Definition at line 34 of file ziptsvoutputstream.cpp.

: TsvDirectoryWriter()
{
qDebug();
mpa_fileZipArchive = new QFile(zipfilename);
if(mpa_fileZipArchive->open(QIODevice::WriteOnly))
{
}
else
{
throw OdsException(
QString("unable to write into ZIP file %1")
.arg(QFileInfo(*mpa_fileZipArchive).absoluteFilePath()));
}
qDebug();
mpa_quaZip = new QuaZip(mpa_fileZipArchive);
bool open_ok = mpa_quaZip->open(QuaZip::mdCreate);
if(open_ok == false)
{
throw OdsException(QObject::tr("error opening ZIP file."));
}
//_p_writer = new QXmlStreamWriter(&outFile);
qDebug();
}
TsvDirectoryWriter::TsvDirectoryWriter
TsvDirectoryWriter()
Definition tsvdirectorywriter.cpp:26
ZipTsvOutputStream::mpa_fileZipArchive
QFile * mpa_fileZipArchive
Definition ziptsvoutputstream.h:62
ZipTsvOutputStream::mpa_quaZip
QuaZip * mpa_quaZip
Definition ziptsvoutputstream.h:63

References TsvDirectoryWriter::TsvDirectoryWriter(), mpa_fileZipArchive, and mpa_quaZip.

## ~ZipTsvOutputStream()

ZipTsvOutputStream::~ZipTsvOutputStream | ( |  | ) |

virtual

Destructor

Definition at line 65 of file ziptsvoutputstream.cpp.

{
qDebug();
closeCurrentZipSheet();
close();
qDebug();
}
ZipTsvOutputStream::close
void close() override
Definition ziptsvoutputstream.cpp:74
ZipTsvOutputStream::closeCurrentZipSheet
void closeCurrentZipSheet()
Definition ziptsvoutputstream.cpp:100

References close(), and closeCurrentZipSheet().

## Member Function Documentation

## close()

void ZipTsvOutputStream::close | ( |  | ) |

override virtual

Reimplemented from TsvDirectoryWriter.

Definition at line 74 of file ziptsvoutputstream.cpp.

{
qDebug();
TsvDirectoryWriter::close();
closeCurrentZipSheet();
if(mpa_quaZip != nullptr)
{
qDebug();
mpa_quaZip->close();
delete mpa_quaZip;
mpa_quaZip = nullptr;
}
if(mpa_fileZipArchive != nullptr)
{
qDebug();
mpa_fileZipArchive->close();
delete mpa_fileZipArchive;
mpa_fileZipArchive = nullptr;
}
qDebug();
}
TsvDirectoryWriter::close
virtual void close() override
Definition tsvdirectorywriter.cpp:72

References TsvDirectoryWriter::close(), closeCurrentZipSheet(), mpa_fileZipArchive, and mpa_quaZip.

Referenced by ~ZipTsvOutputStream().

## closeCurrentZipSheet()

void ZipTsvOutputStream::closeCurrentZipSheet | ( |  | ) |

private

Definition at line 100 of file ziptsvoutputstream.cpp.

{
qDebug();
if(mpa_outFileInZip != nullptr)
{
qDebug();
if(mpa_otxtstream != nullptr)
{
mpa_otxtstream->flush();
}
mpa_outFileInZip->close();
qDebug();
delete mpa_outFileInZip;
mpa_outFileInZip = nullptr;
qDebug();
}
qDebug();
}
TsvDirectoryWriter::mpa_otxtstream
QTextStream * mpa_otxtstream
Definition tsvdirectorywriter.h:105
ZipTsvOutputStream::mpa_outFileInZip
QuaZipFile * mpa_outFileInZip
Definition ziptsvoutputstream.h:64

References TsvDirectoryWriter::mpa_otxtstream, and mpa_outFileInZip.

Referenced by ~ZipTsvOutputStream(), close(), and writeSheet().

## writeSheet()

void ZipTsvOutputStream::writeSheet | ( | const QString & | sheetName | ) |

override virtual

open a new sheet

Parameters

  sheetName | the sheet name

Reimplemented from TsvDirectoryWriter.

Definition at line 122 of file ziptsvoutputstream.cpp.

{
qDebug();
closeCurrentZipSheet();
if(mpa_outFileInZip == nullptr)
{
mpa_outFileInZip = new QuaZipFile(mpa_quaZip);
QuaZipNewInfo info(QString("%1.tsv").arg(sheetName));
info.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner |
QFileDevice::ReadGroup);
if(mpa_outFileInZip->open(QIODevice::WriteOnly, info))
{
mpa_otxtstream = new QTextStream(mpa_outFileInZip);
}
else
{
throw OdsException(
QString("unable to write into file %1 new sheet %2")
.arg(QFileInfo(*mpa_fileZipArchive).absoluteFilePath())
.arg(sheetName));
}
}
else
{
throw OdsException(QString("mpa_outFileInZip == nullptr"));
}
initializeSheet();
qDebug();
}
TsvDirectoryWriter::initializeSheet
void initializeSheet()
Definition tsvdirectorywriter.cpp:116

References closeCurrentZipSheet(), TsvDirectoryWriter::initializeSheet(), TsvDirectoryWriter::mpa_otxtstream, mpa_outFileInZip, and mpa_quaZip.

## Member Data Documentation

## mpa_fileZipArchive

QFile* ZipTsvOutputStream::mpa_fileZipArchive = nullptr

private

Definition at line 62 of file ziptsvoutputstream.h.

Referenced by ZipTsvOutputStream(), and close().

## mpa_outFileInZip

QuaZipFile* ZipTsvOutputStream::mpa_outFileInZip = nullptr

private

Definition at line 64 of file ziptsvoutputstream.h.

Referenced by closeCurrentZipSheet(), and writeSheet().

## mpa_quaZip

QuaZip* ZipTsvOutputStream::mpa_quaZip = nullptr

private

Definition at line 63 of file ziptsvoutputstream.h.

Referenced by ZipTsvOutputStream(), close(), and writeSheet().

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

- odsstream/ziptsvoutputstream.h
- odsstream/ziptsvoutputstream.cpp