Commit Graph

79 Commits

Author SHA1 Message Date
Chris Hennes
95a7dfd515 Remove boost::filesystem includes 2025-07-18 20:26:56 +02:00
bofdahof
847e2f5c85 Base: Units: refactor
Refactor Units making it constexpr, immutable, with repetition reduced.
Separate data from code.

Constexpr constructed units allow constructing predefined Quantities
from predefined unit types.
2025-06-03 09:31:38 +02:00
Ladislav Michl
913c30429c Base: Quantity: use isDimensionless whenever feasible
Quantity is often queried for Unit just to see if it has a dimension.
Ask Quantity directly using isDimensionless() method and modify that
method not to care about Quantity value validity; no user was ever
asking for value validity.
2025-06-03 09:31:38 +02:00
Ladislav Michl
d80e5d0a8a Base: fix QuantityPy::getValueAs
Fixes: 77f4515963 ("Base: refactor QuantityPy class")
2025-05-19 12:15:51 +02:00
bofdahof
77f4515963 Base: refactor QuantityPy class 2025-04-27 00:45:47 +02:00
Ladislav Michl
47c1565edf Base: remove explicit namespace-name qualifier from *PyImp.cpp
Explicit Base namespace-name is used randomly across PyImp sources.
Remove it.
2025-04-27 00:05:32 +02:00
Ladislav Michl
24d55dc616 Base: cleanup includes in *PyImp.cpp
Sort includes and implicitely add missing ones. While there
consistently explain where generated files some from.
2025-04-27 00:05:32 +02:00
Ladislav Michl
986a3b4f7a Base, Gui: remove lefovers from xml -> pyi conversion 2025-04-25 11:57:24 +02:00
Jacob Oursland
5b81cd741a python: apply const method annotations to impls. 2025-04-16 20:32:04 -07:00
Benjamin Nauck
d9af862627 Base: Add #include <limits> where used 2025-03-31 23:50:30 +02:00
Benjamin Nauck
ae686942a7 Base: Use std::numeric_limits and std::numbers instead of defines 2025-03-29 13:32:37 +01:00
tritao
10513144d9 Base: Standardize on Py::Long type for Python bindings. 2025-02-08 13:14:22 +00:00
Ladislav Michl
2ea8a633ac Base: Quantity: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
0907c7bfda Base: Units: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
f1fdd2e2a9 Base: Replace if else with switch statement 2024-01-21 16:14:12 +01:00
Ladislav Michl
95b37fa806 Base: Do not use else before return 2024-01-21 16:14:12 +01:00
wmayer
7c00932fa0 fix readability-isolate-declarations 2023-11-16 01:22:08 +01:00
wmayer
5c306f6e2a fix readability-*:
* readability-uppercase-literal-suffix
* readability-named-parameter
2023-11-16 01:22:08 +01:00
wmayer
e85c383bff Base: apply clang format 2023-11-13 12:01:26 -05:00
mosfet80
d453672ab8 [BASE] Removed dead code (#10330) 2023-08-28 10:41:20 -05:00
wmayer
010dca8303 Base: C++ core guidelines: init variables 2023-08-24 18:48:52 +02:00
wmayer
2bc90e6090 Base: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
wmayer
020bf1789a Base: expose enum NumberFormat to Python 2022-08-15 11:12:53 +02:00
wmayer
c955372ecf cppcoreguidelines-pro-type-union-access
According to https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md using union for type-punning is undefined behaviour.
 Replace it with std::memcpy
2022-06-24 14:29:50 +02:00
wmayer
cbc0bfc24d Base: cosmetic changes 2022-05-12 17:49:55 +02:00
wmayer
882e34f2ce Base: modernize C++11
* use nullptr
2022-03-23 16:57:25 +01:00
wmayer
e4435cdcba Base/App: fix warnings from code analysers:
* convert old-style-casts to explicit C++ casts where possible
* make some implicit conversions explicit
2022-03-06 23:49:30 +01:00
Uwe
f20840442f [Base] Quantity, Rotation, Stream: remove unused includes 2022-03-01 11:27:54 +01:00
wmayer
4d87039635 Base: modernize C++11
* remove redundant void-arg
* use nullptr
* replace deprecated headers
2022-01-25 20:21:30 +01:00
wmayer
88ded38ca1 Base: only handle Base::ParserError exceptions for quantity expressions 2022-01-22 01:15:12 +01:00
wmayer
fb84f715fa Base: extend Python wrapper to allow to create a quantity with Units.Quantity(1, 'm') and add a unit test 2022-01-21 14:57:49 +01:00
luz paz
142c2c2c4d Base: remove Py2 code 2021-04-26 09:23:58 +02:00
wmayer
7f01c558df Py: fix memory leak 2021-04-12 00:06:00 +02:00
luz paz
d5f6c096b8 Base: Fix header uniformity, whitespace, and doxygen
[skip ci]
2020-11-22 18:12:16 +01:00
wmayer
c165edd52c Base: [skip ci] implement method Quantity.toStr() to control string representation 2020-02-29 22:51:55 +01:00
wmayer
9c154f705c Base: [skip ci] improve repr() for quantity
https://forum.freecadweb.org/viewtopic.php?f=10&t=43718
https://forum.freecadweb.org/viewtopic.php?f=10&t=43431&p=369556#p369575
2020-02-29 00:20:21 +01:00
wmayer
1c8d0d1d84 Base: [skip ci] support of __round__ of QuantityPy 2020-02-16 21:50:06 +01:00
luz.paz
6f11ed298a src/Base: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/Base` files
2019-12-25 11:38:58 +01:00
Zheng, Lei
71c54272a0 Fix various Py::Object leak 2019-10-08 17:53:20 +02:00
Zheng, Lei
6b6c0a503c App: fix QuantityPy __add__ and __sub__ 2019-09-28 15:32:12 +02:00
Zheng, Lei
783947ecd4 Base: improve base python object number protocol 2019-09-28 15:30:23 +02:00
wmayer
a6a9c15c4c disable commit e3793e6c 2019-02-19 22:28:46 +01:00
wmayer
e3793e6c88 use format options when using repr() on a quantity 2019-02-19 13:46:22 +01:00
wmayer
1081403d21 Expose some standard units and quantities to Python 2019-02-12 15:12:19 +01:00
wmayer
83f61b4372 implement true divide handler of the number protocol for Quantity 2018-10-27 15:27:27 +02:00
wmayer
189a729027 extend QuantityFormat to set denominator independent of user settings 2018-09-17 12:38:46 +02:00
wmayer
9ec4d83682 missing call to clear error indicator 2018-06-04 17:48:10 +02:00
wmayer
1cbc20b0b1 fix conversion factors for psi and ksi 2018-03-31 15:43:16 +02:00
wmayer
8c7bb0cd55 fix warning 2017-11-14 21:47:56 +01:00
wmayer
533a78026a add method toFormat to get number format from character 2017-08-20 18:50:13 +02:00