Commit Graph

35 Commits

Author SHA1 Message Date
Ladislav Michl
01b547912f Base: QuantityFormat: avoid storing formatting defaults
User defined precision and fractional inch are stored on QuantityFormat
construction making changes persistent to object life time.
Change that so until not explicitely overriden, user defined values
are always returned.

Co-authored-by: Matthias Danner <28687794+matthiasdanner@users.noreply.github.com>
2025-09-05 17:31:54 +02:00
Ladislav Michl
8eea79fe05 Base: make UnitsApi::toNumber method of Quantity
This static method takes Quantity as a parameter, so make it
method of Quantity directly.
2025-09-05 17:31:54 +02:00
Benjamin Nauck
9efd6baee9 Base: Fix use after free in unit error message 2025-05-20 12:34:00 +02:00
Ladislav Michl
1d62b8372b Base: fix Python interface for Unit schema selection
Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-05-14 10:20:49 +02:00
bofdahof
1155f0d752 Base: simplify UnitsSchemas management
Fixes: Maintaining schemas is difficult and error-prone

- Facilitate easy schemas add, remove, change, etc.
- Remove 14 files containing approx 2,190 lines of if/else code and data
- Place data in one file (UnitsSchemasData.h) using a normalized structure (including special functions)
- Isolate and simplify data operations (code)
- Remove schemas enum to keep data independent of code
- Separate responsibilities: Specifications, data, schemas, schema
- Add schema data 'isDefault'
- Add schema data name
- Prefer algorithms to raw loops
- Add schemas unit tests
- Tweak quantity unit tests
2025-04-27 00:45:54 +02:00
Ladislav Michl
4d6ed9d531 Base: UnitsSchema: return std::string 2024-12-23 17:48:42 +01: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
Chris Hennes
fa65438556 Core: Enable compiling with MSVC /permissive- (#11014)
* Base: Fixes for MSVC permissive-

* App: Fixes for MSVC permissive-

* Gui: Fixes for MSVC permissive-

* Main: Fixes for MSVC permissive-

* Fem: Fixes for MSVC permissive-

* Material: Fixes for MSVC permissive-

* Part: Fixes for MSVC permissive-

* Mesh: Fixes for MSVC permissive-

* Points: Fixes for MSVC permissive-

* Robot: Fixes for MSVC permissive-

* TechDraw: Fixes for MSVC permissive-

* Path: Fixes for MSVC permissive-

* Core; Changes per review comments

* TD: Revision from wandererfan

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-27 17:37:29 +01:00
wmayer
f539138dd9 fix readability-*:
* readability-const-return-type
* readability-container-data-pointer
* readability-container-size-empty
* readability-delete-null-pointer
* readability-else-after-return
* readability-inconsistent-declaration-parameter-name
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-redundant-string-cstr
* readability-use-anyofallof
* readability-static-definition-in-anonymous-namespace
* readability-static-accessed-through-instance
* readability-simplify-boolean-expr
2023-11-16 01:22:08 +01:00
wmayer
73a1e90e45 fix readability-identifier-length 2023-11-16 01:22:08 +01:00
wmayer
e85c383bff Base: apply clang format 2023-11-13 12:01:26 -05:00
wmayer
010dca8303 Base: C++ core guidelines: init variables 2023-08-24 18:48:52 +02:00
Chris Hennes
001c79f459 Gui: Translate unit system UI 2023-05-15 20:16:46 -05: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
9ec0bcdcf2 [Base] Units and Uui: remove unused includes 2022-02-24 11:08:56 +01:00
wmayer
befbd95d64 Base: expose UnitsApi::toNumber to Python 2022-02-06 12:47:57 +01:00
wmayer
cbc60a3f44 Base: clean-up code in UnitsApi 2022-01-25 00:26:47 +01:00
wmayer
88ded38ca1 Base: only handle Base::ParserError exceptions for quantity expressions 2022-01-22 01:15:12 +01:00
luz paz
d5f6c096b8 Base: Fix header uniformity, whitespace, and doxygen
[skip ci]
2020-11-22 18:12:16 +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
wmayer
4bcb43ebd2 Base: [skip ci] make UnitSystem an enum class 2019-12-21 10:10:19 +01:00
Yorik van Havre
91bb88fe18 add App.Units.setSchema() python method 2018-12-18 11:01:35 -02:00
wmayer
a9c4bcb5d6 remove kwd argument for functions only with flag METH_VARARGS 2018-08-08 17:39:32 +02:00
wmayer
8c7bb0cd55 fix warning 2017-11-14 21:47:56 +01:00
wmayer
892e78d445 extend Python api of units:
+ get list of all available schemas
+ get currently set schema
+ translate a quantity to a given schema
2017-08-13 16:55:00 +02:00
wmayer
5c84e47422 + fixes #0001816: parseQuantity returns garbage 2014-11-04 14:51:19 +01:00
wmayer
a96f390097 + fix build problems with Python & MacOSX 2014-10-13 22:02:57 +02:00
Sebastian Hoogen
f2367c6c19 bugfix in unit parser
partly revert to 810fadab23
and change python string handling to "et" method
2014-10-05 14:44:04 -03:00
Sebastian Hoogen
6ad50db01b fixes #1744 Use unicode in Unit system 2014-09-20 08:58:06 +02:00
jriegel
401cb13035 Switching Quantity parser to UTF8 2013-12-09 23:50:52 +01:00
jriegel
eb5cc8ed6c Implement the three major unit system schemas 2013-12-05 18:16:31 +01:00
jriegel
3a3afa0783 Switching the UnitsApi to the new Quantity system 2013-12-03 19:03:08 +01:00
jriegel
3ee7b20927 first finished implementation of Quantity parser 2013-09-24 11:00:51 +02:00
wmayer
120ca87015 + unify DLL export defines to namespace names
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 13:44:52 +00:00