Base: apply clang format

This commit is contained in:
wmayer
2023-11-10 18:27:44 +01:00
committed by WandererFan
parent 41528339e4
commit e85c383bff
154 changed files with 11874 additions and 9872 deletions

View File

@@ -23,7 +23,7 @@
#include "PreCompiled.h"
#ifdef __GNUC__
# include <unistd.h>
#include <unistd.h>
#endif
#include <QString>
@@ -35,7 +35,8 @@
using namespace Base;
QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &factor, QString &unitString)
QString
UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QString& unitString)
{
double UnitValue = std::abs(quant.getValue());
Unit unit = quant.getUnit();
@@ -49,8 +50,8 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
// = 10e6 * kg*mm/s^3/K
// now do special treatment on all cases seems necessary:
if (unit == Unit::Length) {// Length handling ============================
if (UnitValue < 1e-6) {// smaller than 0.001 nm -> scientific notation
if (unit == Unit::Length) { // Length handling ============================
if (UnitValue < 1e-6) { // smaller than 0.001 nm -> scientific notation
unitString = QString::fromLatin1("mm");
factor = 1.0;
}
@@ -74,7 +75,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("km");
factor = 1e6;
}
else {// bigger than 1000 km -> scientific notation
else { // bigger than 1000 km -> scientific notation
unitString = QString::fromLatin1("m");
factor = 1e3;
}
@@ -92,13 +93,13 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("m^2");
factor = 1e6;
}
else { // bigger than 1 square kilometer
else { // bigger than 1 square kilometer
unitString = QString::fromLatin1("km^2");
factor = 1e12;
}
}
else if (unit == Unit::Volume) {
if (UnitValue < 1e3) {// smaller than 1 ul
if (UnitValue < 1e3) { // smaller than 1 ul
unitString = QString::fromLatin1("mm^3");
factor = 1.0;
}
@@ -110,7 +111,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("l");
factor = 1e6;
}
else { // bigger than 1000 l
else { // bigger than 1000 l
unitString = QString::fromLatin1("m^3");
factor = 1e9;
}
@@ -196,7 +197,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
factor = 1.0;
}
else if ((unit == Unit::Pressure) || (unit == Unit::Stress)) {
if (UnitValue < 10.0) {// Pa is the smallest
if (UnitValue < 10.0) { // Pa is the smallest
unitString = QString::fromLatin1("Pa");
factor = 0.001;
}
@@ -212,13 +213,13 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("GPa");
factor = 1e6;
}
else { // bigger -> scientific notation
else { // bigger -> scientific notation
unitString = QString::fromLatin1("Pa");
factor = 0.001;
}
}
else if ((unit == Unit::Stiffness)) {
if (UnitValue < 1){// mN/m is the smallest
if (UnitValue < 1) { // mN/m is the smallest
unitString = QString::fromLatin1("mN/m");
factor = 1e-3;
}
@@ -280,7 +281,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("kV");
factor = 1e9;
}
else { // > 1000 kV scientificc notation
else { // > 1000 kV scientificc notation
unitString = QString::fromLatin1("V");
factor = 1e6;
}
@@ -314,7 +315,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("kWh");
factor = 3.6e+12;
}
else { // bigger than 1000 kWh -> scientific notation
else { // bigger than 1000 kWh -> scientific notation
unitString = QString::fromLatin1("J");
factor = 1e6;
}
@@ -362,7 +363,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
else if (unit == Unit::Magnetization) {
unitString = QString::fromLatin1("A/m");
factor = 1e-3;
}
}
else if (unit == Unit::ElectricalConductance) {
if (UnitValue < 1e-9) {
unitString = QString::fromUtf8("\xC2\xB5S");
@@ -420,7 +421,8 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
}
else if (UnitValue < 1e-9) {
// \x reads everything to the end, therefore split
unitString = QString::fromUtf8("\xC2\xB5""F");
unitString = QString::fromUtf8("\xC2\xB5"
"F");
factor = 1e-12;
}
else if (UnitValue < 1e-6) {
@@ -517,7 +519,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
factor = 1e6;
}
else if (unit == Unit::InverseLength) {
if (UnitValue < 1e-6) {// smaller than 0.001 1/km -> scientific notation
if (UnitValue < 1e-6) { // smaller than 0.001 1/km -> scientific notation
unitString = QString::fromLatin1("1/m");
factor = 1e-3;
}
@@ -541,13 +543,13 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("1/nm");
factor = 1e6;
}
else {// larger -> scientific notation
else { // larger -> scientific notation
unitString = QString::fromLatin1("1/m");
factor = 1e-3;
}
}
else if (unit == Unit::InverseArea) {
if (UnitValue < 1e-12) {// smaller than 0.001 1/km^2 -> scientific notation
if (UnitValue < 1e-12) { // smaller than 0.001 1/km^2 -> scientific notation
unitString = QString::fromLatin1("1/m^2");
factor = 1e-6;
}