version 5.4.0

remove CORS default header from PIHTTPServer
fix several docs
fix PIMathVector::dot return type
add units directory with PIUnits facility
This commit is contained in:
2025-09-26 21:33:45 +03:00
parent daab41e41e
commit 5db97ca959
30 changed files with 1888 additions and 556 deletions

View File

@@ -0,0 +1,86 @@
/*
PIP - Platform Independent Primitives
Pressure units
Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "piunits_class_pressure.h"
PIString PIUnits::Class::Pressure::name(int type) const {
switch (type) {
case Pascal: return "pascal"_tr("PIUnitsPressure");
case Atmosphere: return "atmosphere"_tr("PIUnitsPressure");
case Bar: return "bar"_tr("PIUnitsPressure");
case MillimetreOfMercury: return "mm Hg"_tr("PIUnitsPressure");
}
return Class::Internal::unknown;
}
PIString PIUnits::Class::Pressure::unit(int type) const {
switch (type) {
case Pascal: return "Pa"_tr("PIUnitsPressure");
case Atmosphere: return "atm"_tr("PIUnitsPressure");
case Bar: return "bar"_tr("PIUnitsPressure");
case MillimetreOfMercury: return "mmHg"_tr("PIUnitsPressure");
}
return Class::Internal::unknown;
}
double PIUnits::Class::Pressure::convert(double v, int from, int to) const {
double pa = v;
switch (from) {
case Atmosphere: pa /= 9.86923E-6; break;
case Bar: pa /= 1.E-5; break;
case MillimetreOfMercury: pa *= 133.322387415; break;
default: break;
}
switch (to) {
case Atmosphere: return pa * 9.86923E-6;
case Bar: return pa * 1.E-5;
case MillimetreOfMercury: return pa / 133.322387415;
default: break;
}
return pa;
}
PIString PIUnits::Class::Pressure::valueToString(double v, char format, int prec) const {
return PIString::fromNumber(v, format, prec);
}
bool PIUnits::Class::Pressure::supportPrefixes(int type) const {
if (type == Pascal) return true;
return false;
}
bool PIUnits::Class::Pressure::supportPrefixesNon3(int type) const {
return false;
}
bool PIUnits::Class::Pressure::supportPrefixesGreater(int type) const {
return ClassBase::supportPrefixesGreater(type);
}
bool PIUnits::Class::Pressure::supportPrefixesSmaller(int type) const {
return ClassBase::supportPrefixesSmaller(type);
}