mirror of
https://github.com/QtExcel/QXlsx.git
synced 2025-01-30 05:02:52 +08:00
Clang-tidy fixes
This commit is contained in:
parent
fda6b806e2
commit
d5af39d46d
@ -20,9 +20,7 @@ AbstractOOXmlFilePrivate::AbstractOOXmlFilePrivate(
|
|||||||
|
|
||||||
AbstractOOXmlFilePrivate::~AbstractOOXmlFilePrivate()
|
AbstractOOXmlFilePrivate::~AbstractOOXmlFilePrivate()
|
||||||
{
|
{
|
||||||
if (relationships) {
|
delete relationships;
|
||||||
delete relationships;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -1076,8 +1076,7 @@ void ChartPrivate::saveXmlScatterChart(QXmlStreamWriter &writer) const
|
|||||||
XlsxAxis::T_Val, XlsxAxis::Left, 1, 0, axisNames[XlsxAxis::Left]));
|
XlsxAxis::T_Val, XlsxAxis::Left, 1, 0, axisNames[XlsxAxis::Left]));
|
||||||
}
|
}
|
||||||
|
|
||||||
int axisListSize = axisList.size();
|
Q_ASSERT(axisList.size() == 2);
|
||||||
Q_ASSERT(axisListSize == 2);
|
|
||||||
|
|
||||||
for (int i = 0; i < axisList.size(); ++i) {
|
for (int i = 0; i < axisList.size(); ++i) {
|
||||||
writer.writeEmptyElement(QStringLiteral("c:axId"));
|
writer.writeEmptyElement(QStringLiteral("c:axId"));
|
||||||
|
@ -63,15 +63,15 @@ bool Drawing::loadFromXmlFile(QIODevice *device)
|
|||||||
if (reader.tokenType() == QXmlStreamReader::StartElement) {
|
if (reader.tokenType() == QXmlStreamReader::StartElement) {
|
||||||
if (reader.name() == QLatin1String("absoluteAnchor")) // CT_AbsoluteAnchor
|
if (reader.name() == QLatin1String("absoluteAnchor")) // CT_AbsoluteAnchor
|
||||||
{
|
{
|
||||||
DrawingAbsoluteAnchor *anchor = new DrawingAbsoluteAnchor(this);
|
auto *anchor = new DrawingAbsoluteAnchor(this);
|
||||||
anchor->loadFromXml(reader);
|
anchor->loadFromXml(reader);
|
||||||
} else if (reader.name() == QLatin1String("oneCellAnchor")) // CT_OneCellAnchor
|
} else if (reader.name() == QLatin1String("oneCellAnchor")) // CT_OneCellAnchor
|
||||||
{
|
{
|
||||||
DrawingOneCellAnchor *anchor = new DrawingOneCellAnchor(this);
|
auto *anchor = new DrawingOneCellAnchor(this);
|
||||||
anchor->loadFromXml(reader);
|
anchor->loadFromXml(reader);
|
||||||
} else if (reader.name() == QLatin1String("twoCellAnchor")) // CT_TwoCellAnchor
|
} else if (reader.name() == QLatin1String("twoCellAnchor")) // CT_TwoCellAnchor
|
||||||
{
|
{
|
||||||
DrawingTwoCellAnchor *anchor = new DrawingTwoCellAnchor(this);
|
auto *anchor = new DrawingTwoCellAnchor(this);
|
||||||
anchor->loadFromXml(reader);
|
anchor->loadFromXml(reader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,8 +323,6 @@ void DrawingAnchor::loadXmlObjectConnectionShape(QXmlStreamReader &reader)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingAnchor::loadXmlObjectGraphicFrame(QXmlStreamReader &reader)
|
void DrawingAnchor::loadXmlObjectGraphicFrame(QXmlStreamReader &reader)
|
||||||
@ -362,8 +360,6 @@ void DrawingAnchor::loadXmlObjectGraphicFrame(QXmlStreamReader &reader)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingAnchor::loadXmlObjectGroupShape(QXmlStreamReader &reader)
|
void DrawingAnchor::loadXmlObjectGroupShape(QXmlStreamReader &reader)
|
||||||
@ -404,8 +400,6 @@ void DrawingAnchor::loadXmlObjectPicture(QXmlStreamReader &reader)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingAnchor::loadXmlObjectShape(QXmlStreamReader &reader)
|
void DrawingAnchor::loadXmlObjectShape(QXmlStreamReader &reader)
|
||||||
@ -600,8 +594,6 @@ void DrawingAnchor::loadXmlObjectShape(QXmlStreamReader &reader)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingAnchor::saveXmlPos(QXmlStreamWriter &writer, const QPoint &pos) const
|
void DrawingAnchor::saveXmlPos(QXmlStreamWriter &writer, const QPoint &pos) const
|
||||||
|
@ -196,7 +196,10 @@ Format::Format(const Format &other)
|
|||||||
*/
|
*/
|
||||||
Format &Format::operator=(const Format &other)
|
Format &Format::operator=(const Format &other)
|
||||||
{
|
{
|
||||||
d = other.d;
|
if (this != &other) // Self-assignment check [cert-oop54-cpp]
|
||||||
|
{
|
||||||
|
this->d = other.d;
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,10 @@ RichString::~RichString()
|
|||||||
*/
|
*/
|
||||||
RichString &RichString::operator=(const RichString &other)
|
RichString &RichString::operator=(const RichString &other)
|
||||||
{
|
{
|
||||||
this->d = other.d;
|
if (this != &other) // Self-assignment check [cert-oop54-cpp]
|
||||||
|
{
|
||||||
|
this->d = other.d;
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +108,7 @@ bool RichString::isRichString() const
|
|||||||
*/
|
*/
|
||||||
bool RichString::isNull() const
|
bool RichString::isNull() const
|
||||||
{
|
{
|
||||||
return d->fragmentTexts.size() == 0;
|
return d->fragmentTexts.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -113,12 +116,8 @@ bool RichString::isNull() const
|
|||||||
*/
|
*/
|
||||||
bool RichString::isEmtpy() const
|
bool RichString::isEmtpy() const
|
||||||
{
|
{
|
||||||
for (const auto &str : d->fragmentTexts) {
|
return std::all_of(d->fragmentTexts.begin(), d->fragmentTexts.end(),
|
||||||
if (!str.isEmpty())
|
[](const QString &str) { return str.isEmpty(); });
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -210,7 +209,7 @@ Format RichString::fragmentFormat(int index) const
|
|||||||
QByteArray RichStringPrivate::idKey() const
|
QByteArray RichStringPrivate::idKey() const
|
||||||
{
|
{
|
||||||
if (_dirty) {
|
if (_dirty) {
|
||||||
RichStringPrivate *rs = const_cast<RichStringPrivate *>(this);
|
auto rs = const_cast<RichStringPrivate *>(this);
|
||||||
QByteArray bytes;
|
QByteArray bytes;
|
||||||
if (fragmentTexts.size() == 1) {
|
if (fragmentTexts.size() == 1) {
|
||||||
bytes = fragmentTexts[0].toUtf8();
|
bytes = fragmentTexts[0].toUtf8();
|
||||||
|
@ -169,7 +169,7 @@ void SharedStrings::writeRichStringPart_rPr(QXmlStreamWriter &writer, const Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (format.hasProperty(FormatPrivate::P_Font_Color)) {
|
if (format.hasProperty(FormatPrivate::P_Font_Color)) {
|
||||||
XlsxColor color = format.property(FormatPrivate::P_Font_Color).value<XlsxColor>();
|
auto color = format.property(FormatPrivate::P_Font_Color).value<XlsxColor>();
|
||||||
color.saveToXml(writer);
|
color.saveToXml(writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +369,8 @@ bool SharedStrings::loadFromXmlFile(QIODevice *device)
|
|||||||
if (token == QXmlStreamReader::StartElement) {
|
if (token == QXmlStreamReader::StartElement) {
|
||||||
if (reader.name() == QLatin1String("sst")) {
|
if (reader.name() == QLatin1String("sst")) {
|
||||||
QXmlStreamAttributes attributes = reader.attributes();
|
QXmlStreamAttributes attributes = reader.attributes();
|
||||||
if ((hasUniqueCountAttr = attributes.hasAttribute(QLatin1String("uniqueCount"))))
|
hasUniqueCountAttr = attributes.hasAttribute(QLatin1String("uniqueCount"));
|
||||||
|
if (hasUniqueCountAttr)
|
||||||
count = attributes.value(QLatin1String("uniqueCount")).toInt();
|
count = attributes.value(QLatin1String("uniqueCount")).toInt();
|
||||||
} else if (reader.name() == QLatin1String("si")) {
|
} else if (reader.name() == QLatin1String("si")) {
|
||||||
readString(reader);
|
readString(reader);
|
||||||
|
@ -514,7 +514,7 @@ void Workbook::saveToXmlFile(QIODevice *device) const
|
|||||||
}
|
}
|
||||||
writer.writeEndElement(); // sheets
|
writer.writeEndElement(); // sheets
|
||||||
|
|
||||||
if (d->externalLinks.size() > 0) {
|
if (!d->externalLinks.isEmpty()) {
|
||||||
writer.writeStartElement(QStringLiteral("externalReferences"));
|
writer.writeStartElement(QStringLiteral("externalReferences"));
|
||||||
for (int i = 0; i < d->externalLinks.size(); ++i) {
|
for (int i = 0; i < d->externalLinks.size(); ++i) {
|
||||||
writer.writeEmptyElement(QStringLiteral("externalReference"));
|
writer.writeEmptyElement(QStringLiteral("externalReference"));
|
||||||
|
@ -1654,15 +1654,6 @@ void WorksheetPrivate::saveXmlCellData(QXmlStreamWriter &writer,
|
|||||||
cell->value().toBool() ? QStringLiteral("1") : QStringLiteral("0"));
|
cell->value().toBool() ? QStringLiteral("1") : QStringLiteral("0"));
|
||||||
} else if (cell->cellType() == Cell::DateType) // 'd'
|
} else if (cell->cellType() == Cell::DateType) // 'd'
|
||||||
{
|
{
|
||||||
// dev67
|
|
||||||
|
|
||||||
double num = cell->value().toDouble();
|
|
||||||
bool is1904 = q->workbook()->isDate1904();
|
|
||||||
if (!is1904 && num > 60) // for mac os excel
|
|
||||||
{
|
|
||||||
num = num - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// number type. see for 18.18.11 ST_CellType (Cell Type) more information.
|
// number type. see for 18.18.11 ST_CellType (Cell Type) more information.
|
||||||
writer.writeAttribute(QStringLiteral("t"), QStringLiteral("n"));
|
writer.writeAttribute(QStringLiteral("t"), QStringLiteral("n"));
|
||||||
writer.writeTextElement(QStringLiteral("v"), cell->value().toString());
|
writer.writeTextElement(QStringLiteral("v"), cell->value().toString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user