looqs/shared/odtprocessor.cpp

27 righe
709 B
C++

#include <quazip.h>
#include <quazipfile.h>
#include "odtprocessor.h"
#include "tagstripperprocessor.h"
DocumentProcessResult OdtProcessor::process(const QByteArray & /*data*/) const
{
2021-06-12 14:59:58 +02:00
throw LooqsGeneralException("Not implemented yet");
}
DocumentProcessResult OdtProcessor::process(QString path) const
{
QuaZipFile zipFile(path);
zipFile.setFileName("content.xml");
if(!zipFile.open(QIODevice::ReadOnly))
{
2021-06-12 14:59:58 +02:00
throw LooqsGeneralException("Error while opening file " + path);
}
QByteArray entireContent = zipFile.readAll();
if(entireContent.isEmpty())
{
2021-06-12 14:59:58 +02:00
throw LooqsGeneralException("Error while reading content.xml of " + path);
}
TagStripperProcessor tsp;
return tsp.process(entireContent);
}