ukui-search/libsearch/index/file-reader.cpp

21 lines
478 B
C++
Raw Normal View History

2020-12-30 15:31:36 +08:00
#include "file-reader.h"
#include "file-utils.h"
FileReader::FileReader(QObject *parent) : QObject(parent)
{
}
void FileReader::getTextContent(QString path, QString &textContent)
2020-12-30 15:31:36 +08:00
{
//获取所有文件内容
//先分类
QString type =FileUtils::getMimetype(path,true);
2020-12-30 15:31:36 +08:00
if(type == "application/zip")
FileUtils::getDocxTextContent(path,textContent);
2020-12-30 15:31:36 +08:00
else if(type == "text/plain")
FileUtils::getTxtContent(path,textContent);
2020-12-30 15:31:36 +08:00
return;
2020-12-30 15:31:36 +08:00
}