Qt 4.8
Public Functions | Private Functions | Properties | List of all members
QZipStreamStrategy Class Reference
Inheritance diagram for QZipStreamStrategy:
QOutputStrategy

Public Functions

virtual void addFile (const QString &fileName, const QString &mimeType, const QByteArray &bytes)
 
 QZipStreamStrategy (QIODevice *device)
 
 ~QZipStreamStrategy ()
 
- Public Functions inherited from QOutputStrategy
QString createUniqueImageName ()
 
 QOutputStrategy ()
 
virtual ~QOutputStrategy ()
 

Private Functions

void addFile (const QString &fileName, const QString &mimeType)
 

Properties

QBuffer content
 
QBuffer manifest
 
QString manifestNS
 
QXmlStreamWriter manifestWriter
 
QZipWriter zip
 

Additional Inherited Members

- Public Variables inherited from QOutputStrategy
QIODevicecontentStream
 
int counter
 

Detailed Description

Definition at line 105 of file qtextodfwriter.cpp.

Constructors and Destructors

◆ QZipStreamStrategy()

QZipStreamStrategy::QZipStreamStrategy ( QIODevice device)
inline

Definition at line 107 of file qtextodfwriter.cpp.

108  : zip(device),
110  {
111  QByteArray mime("application/vnd.oasis.opendocument.text");
113  zip.addFile(QString::fromLatin1("mimetype"), mime); // for mime-magick
118 
119  manifestNS = QString::fromLatin1("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0");
120  // prettyfy
123 
128  addFile(QString::fromLatin1("/"), QString::fromLatin1("application/vnd.oasis.opendocument.text"));
129  addFile(QString::fromLatin1("content.xml"), QString::fromLatin1("text/xml"));
130  }
QIODevice * contentStream
bool open(OpenMode openMode)
Reimplemented Function
Definition: qbuffer.cpp:338
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
const char * mime
void addFile(const QString &fileName, const QByteArray &data)
Add a file to the archive with data as the file contents.
Definition: qzip.cpp:1207
void setCompressionPolicy(CompressionPolicy policy)
Sets the policy for compressing newly added files to the new policy.
Definition: qzip.cpp:1156
void writeAttribute(const QString &qualifiedName, const QString &value)
Writes an attribute with qualifiedName and value.
virtual void addFile(const QString &fileName, const QString &mimeType, const QByteArray &bytes)
void writeNamespace(const QString &namespaceUri, const QString &prefix=QString())
Writes a namespace declaration for namespaceUri with prefix.
void writeStartDocument()
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setAutoFormattingIndent(int spacesOrTabs)
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
void setAutoFormatting(bool)
void writeStartElement(const QString &qualifiedName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QXmlStreamWriter manifestWriter

◆ ~QZipStreamStrategy()

QZipStreamStrategy::~QZipStreamStrategy ( )
inline

Definition at line 132 of file qtextodfwriter.cpp.

133  {
135  manifest.close();
136  zip.addFile(QString::fromLatin1("META-INF/manifest.xml"), &manifest);
137  content.close();
138  zip.addFile(QString::fromLatin1("content.xml"), &content);
139  zip.close();
140  }
void close()
Reimplemented Function
Definition: qbuffer.cpp:359
void writeEndDocument()
Closes all remaining open start elements and writes a newline.
void addFile(const QString &fileName, const QByteArray &data)
Add a file to the archive with data as the file contents.
Definition: qzip.cpp:1207
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
void close()
Closes the zip file.
Definition: qzip.cpp:1262
QXmlStreamWriter manifestWriter

Functions

◆ addFile() [1/2]

virtual void QZipStreamStrategy::addFile ( const QString fileName,
const QString mimeType,
const QByteArray bytes 
)
inlinevirtual

Implements QOutputStrategy.

Definition at line 142 of file qtextodfwriter.cpp.

143  {
144  zip.addFile(fileName, bytes);
145  addFile(fileName, mimeType);
146  }
void addFile(const QString &fileName, const QByteArray &data)
Add a file to the archive with data as the file contents.
Definition: qzip.cpp:1207
virtual void addFile(const QString &fileName, const QString &mimeType, const QByteArray &bytes)

◆ addFile() [2/2]

void QZipStreamStrategy::addFile ( const QString fileName,
const QString mimeType 
)
inlineprivate

Definition at line 149 of file qtextodfwriter.cpp.

150  {
154  }
void writeAttribute(const QString &qualifiedName, const QString &value)
Writes an attribute with qualifiedName and value.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
void writeEmptyElement(const QString &qualifiedName)
Writes an empty element with qualified name qualifiedName.
QXmlStreamWriter manifestWriter

Properties

◆ content

QBuffer QZipStreamStrategy::content
private

Definition at line 156 of file qtextodfwriter.cpp.

◆ manifest

QBuffer QZipStreamStrategy::manifest
private

Definition at line 157 of file qtextodfwriter.cpp.

◆ manifestNS

QString QZipStreamStrategy::manifestNS
private

Definition at line 160 of file qtextodfwriter.cpp.

◆ manifestWriter

QXmlStreamWriter QZipStreamStrategy::manifestWriter
private

Definition at line 159 of file qtextodfwriter.cpp.

◆ zip

QZipWriter QZipStreamStrategy::zip
private

Definition at line 158 of file qtextodfwriter.cpp.


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