Commit Graph

144 Commits

Author SHA1 Message Date
Markus Reitböck
73c97bc90f App: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
should be considered an optimization, not a requirement. In particular, do not explicitly include a
precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
generated precompile header on the compiler command line instead. This is more portable across
the major compilers and is likely to be easier to maintain. It will also avoid warnings being
generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-14 09:47:02 +02:00
Frank David Martínez M
0f2ea5588c [Core] Fix #15558: Direct expression in ternary operator (#22938)
* [Core] Fix #15558: Direct expression in ternary operator

* [Core] Added tests for Non-Numeric conditions in ternary op.

* [Core] prevent relational operator chains at grammar level.

* [Core] Rewrite expressions grammar as a layered grammar.

* [Core] Revert to left associative relops (like C/C++) plus tests.
2025-08-25 21:52:42 +02:00
Chris Hennes
dd4a477dce Merge pull request #22788 from pieterhijma/fix-func-expr-simplify
Core: Fix expression function simplify
2025-08-12 11:07:44 -05:00
Frank David Martínez M
d4c38502d8 [Core] Add Boolean Functions to expressions (AND, OR, NOT) (#22506)
* [Core] Add Boolean Functions to expressions (AND, OR, BOOL, NOT)

* [Core] Add `if` function to expressions to overcome ternary operator limitations

* [Core] Update expressions grammar to recognize relational operations as arguments

* [Core] The `if` function has been removed as no consensus was reached regarding its convenience or necessity. Its inclusion was considered potentially confusing or redundant.

* [Core] Make boolean cast based on Confusion threshold.
2025-08-05 03:50:13 +00:00
Pieter Hijma
1ebcae0c0b Core: Fix func expression simplify 2025-08-04 16:51:11 +02:00
Chris Hennes
787c190368 Remove boost::filesystem includes 2025-07-18 20:26:56 +02:00
Ladislav Michl
0c9584ab2d 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
9683cf1e4f Base: rename Exception's PascalCase methods to camelCase 2025-05-05 23:50:01 +02:00
Benjamin Nauck
02d095f6e2 App: use contains() instead of count() where possible 2025-05-03 22:19:51 +02:00
Benjamin Nauck
f22f3705db Use Base::toDegrees() instead of manually converting 2025-04-15 07:16:39 +02:00
Benjamin Nauck
21fbf8e539 Use Base::toRadians() instead of manually converting 2025-04-15 07:16:36 +02:00
Kacper Donat
77e40b9747 Base: Use explicit pointer syntax for freecad_cast (#20694)
* Base: Use explicit pointer syntax for freecad_cast

This aligns our custom cast with other casts

* All: Use explicit pointer syntax for freecad_cast
2025-04-11 14:11:33 +00:00
Ladislav Michl
3f025585dc App: Expression: rename lexer and parser files
Rename files according 7d233dc ("Gui: Rename generated lexer files
to match core naming pattern"). Note that C space errors (space
before tabs, spaces on blank lines, etc.) still need to be fixed
manually after regenerating lexer file.
2025-04-08 11:10:50 +02:00
Kacper Donat
9d97d1c895 Base: Rename Base::freecad_dynamic_cast into freecad_cast
This is to make it shorter and easier to use. QT does the same thing
with their qobject_cast.
2025-04-07 10:32:28 -05:00
Chris Hennes
95fbd95950 Merge pull request #20496 from hyarion/refactor/cppify-constants 2025-03-29 18:43:40 -05:00
Pieter Hijma
032cb79301 [Doc] Improve topics within App
- The location of the documentation is improved (not in the cpp file
  anymore but in core-app.dox).  This prevents cluttering source with
  high-level overviews typical of topic documentation.
- The formatting has been made consistent.
2025-03-29 15:11:01 -05:00
Benjamin Nauck
c77de32b78 App: Use std::numeric_limits and std::numbers instead of defines 2025-03-29 13:32:37 +01:00
Chris Hennes
09cdcee1bb App: Coverity fixes 2025-03-18 15:59:22 +01:00
Benjamin Bræstrup Sayoc
6f619b5f1c Base: remove unneeded includes 2025-02-18 11:07:57 -06:00
Benjamin Nauck
0ba52f0e22 Make modulo require units to be same or dimensionless
Fixes #19517
2025-02-17 11:31:17 -06:00
Benjamin Nauck
6f535f19fb Prefer to use BaseClass's isDerivedFrom<T> over non template or Base::Type's
Regex based changes, manually verified
2025-01-27 16:08:18 +01:00
Ladislav Michl
0b3adee2ab Base: Quantity: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
539b7d43cf Base: Units: hide internals 2024-12-23 17:48:42 +01:00
Kris Wilk
d1c04fd193 Prevent using reserved names for properties or aliases (Fix #16846) (#16902)
* Prevent naming properties with reserved words (Fix #16846)

* Prevent using reserved constant names for properties or aliases

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

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

* App: Add unit test for isTokenAConstant

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2024-10-03 10:03:10 -05:00
wmayer
88893f7524 Core: fix possible memory leaks when using parser 2024-04-26 21:42:34 +02:00
Andrei Pozolotin
9e1edf36f0 Resolve #11965 - no proper execute() for cross-property references
Solution B: parsequant() function
2024-02-19 11:12:52 -06:00
Chris Hennes
950507a498 Revert "Resolve #11825 - no automatic quantity conversion: App::anyToQuantity"
This reverts commit c1ef15fbdf5db5aaf2ec86cb44bff237d1966238.
2024-02-12 15:29:15 -06:00
Andrei Pozolotin
71a61cf423 Resolve #11825 - no automatic quantity conversion: App::anyToQuantity 2024-01-11 11:32:18 -06:00
wmayer
1cf1a90a17 App: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
wmayer
af8c05c507 App: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
Chris Hennes
15c7aabe27 App: clang-tidy cleanup of Expression::_renameObjectIdentifier 2023-08-17 15:59:45 +02:00
Djuro Drljaca
8c25886da2 Keep the label of a variable in expression on spreadsheet alias rename (#10222)
Fixes #5800
2023-08-16 21:35:58 -05:00
Daniel-Khodabakhsh
a9ac5b8398 Expressions: Add Vector API expression functions (#10237) 2023-08-15 23:00:16 -05:00
wmayer
4991475341 App: modernize C++: use range-based for loop 2023-08-14 16:40:25 +02:00
wmayer
ec73caa40e modernize C++: make unique 2023-08-07 19:51:30 -06:00
wmayer
7a3106d31b modernize C++: use bool literals 2023-08-06 01:35:39 +02:00
luzpaz
38a01939e0 Migrate domain name from freecadweb to freecad (#9352)
* Migrate domain name from freecadweb to freecad
* Migrate src/Mod/Material files
* Migrate Stylesheet related files
* Migrate *.svg files
* Migrate miscellaneous files
* Migrate some build files
* Migrate recently added TD AR_IRAM template files

Closes #6415
2023-04-24 15:19:20 -05:00
0penBrain
8dcbd7080e Expression: use a precision that ensures no floating point issue 2023-04-05 19:51:51 +02:00
Daniel-Khodabakhsh
071200ac8a Add various matrix related expression functions (#8603)
Adds a few new Expression functions with the goal to:

- Simplify Placement, Rotation, Vector and Matrix object creation.
- Add new matrix functions for rotation and translation.
2023-03-11 20:13:23 -06:00
M G Berberich
9c1d80d9e6 add cbrt (cube root) to expressions (#8629)
This adds a function cbrt(arg) to the freecad-expressions that computes
the cube root of arg. Instead of arg^(1/3) this handles the units of the
argument, so that one can compute units from p.e. ml to mm.
  cbrt(27 ml) → 30 mm
instead of
  (27 ml)^(1/3) → 30
2023-02-26 17:49:58 +01:00
0penBrain
6f278d7673 [BugFix] Expression: always add space char before unit when converting to string, fixes #8562 2023-02-24 19:44:44 +01:00
wmayer
aeb5ea0ddf App: [skip ci] reduce code duplication 2022-12-23 18:39:59 +01:00
wmayer
b9d88f9985 App: remove dead code and simplify code 2022-12-23 17:02:04 +01:00
wmayer
6653991a97 Gui/Mod: handle several compiler warnings:
* ignore -Wfree-nonheap-object for generated code
* replace 0 with Qt::NoModifier when creating a QKeyEvent
* in Qt 5.14 QCombobox::activated(QString) is deprecated, use textActivated
* don't mix QCheckBox::setChecked() with tristate API
2022-11-29 10:36:02 +01:00
marioalexis
209c78d43e App: Replace C cast 2022-09-18 11:06:51 -05:00
wmayer
656890be38 App: modernize C++: replace 'typedef' with 'using' 2022-08-29 12:58:39 +02:00
berniev
d2babf0eb5 App: Single arg ctors must be explicit 2022-08-24 07:20:57 +02:00
berniev
d9ac252982 App: redundant void 2 2022-08-08 09:45:36 +02:00
berniev
22dcf5866f App: use empty 2022-08-06 19:29:59 +02:00
berniev
ac81a8380f App: use emplace_back 2022-08-05 10:31:51 +02:00