Commit Graph

131 Commits

Author SHA1 Message Date
Kacper Donat
35a9673a75 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
e7156aa326 Merge pull request #20496 from hyarion/refactor/cppify-constants 2025-03-29 18:43:40 -05:00
Pieter Hijma
ec4ea7f8d3 [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
81e0b408fa App: Use std::numeric_limits and std::numbers instead of defines 2025-03-29 13:32:37 +01:00
Chris Hennes
c1ada6bc40 App: Coverity fixes 2025-03-18 15:59:22 +01:00
Benjamin Bræstrup Sayoc
dda05369c4 Base: remove unneeded includes 2025-02-18 11:07:57 -06:00
Benjamin Nauck
145af5cddc Make modulo require units to be same or dimensionless
Fixes #19517
2025-02-17 11:31:17 -06:00
Benjamin Nauck
dd6aa9f3c7 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
2ea8a633ac Base: Quantity: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
2d0ce24496 Base: Units: hide internals 2024-12-23 17:48:42 +01:00
Kris Wilk
ffa1189634 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
499e73f337 Core: fix possible memory leaks when using parser 2024-04-26 21:42:34 +02:00
Andrei Pozolotin
c5ad7b50b6 Resolve #11965 - no proper execute() for cross-property references
Solution B: parsequant() function
2024-02-19 11:12:52 -06:00
Chris Hennes
3df8ae2fab Revert "Resolve #11825 - no automatic quantity conversion: App::anyToQuantity"
This reverts commit 6a54591bac.
2024-02-12 15:29:15 -06:00
Andrei Pozolotin
6a54591bac Resolve #11825 - no automatic quantity conversion: App::anyToQuantity 2024-01-11 11:32:18 -06:00
wmayer
ee0fad4c90 App: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
wmayer
89bdd489b0 App: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
Chris Hennes
ddf8c47f40 App: clang-tidy cleanup of Expression::_renameObjectIdentifier 2023-08-17 15:59:45 +02:00
Djuro Drljaca
c311bab053 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
8003606222 Expressions: Add Vector API expression functions (#10237) 2023-08-15 23:00:16 -05:00
wmayer
26f16f7410 App: modernize C++: use range-based for loop 2023-08-14 16:40:25 +02:00
wmayer
0af4990817 modernize C++: make unique 2023-08-07 19:51:30 -06:00
wmayer
2a88c7c7df modernize C++: use bool literals 2023-08-06 01:35:39 +02:00
luzpaz
129d5882a7 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
96bf29304d Expression: use a precision that ensures no floating point issue 2023-04-05 19:51:51 +02:00
Daniel-Khodabakhsh
827af464e3 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
6832743262 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
09c1b9ce90 [BugFix] Expression: always add space char before unit when converting to string, fixes #8562 2023-02-24 19:44:44 +01:00
wmayer
1e49c84f6c App: [skip ci] reduce code duplication 2022-12-23 18:39:59 +01:00
wmayer
aff217b214 App: remove dead code and simplify code 2022-12-23 17:02:04 +01:00
wmayer
ad1cccdd27 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
9ccb9eecb2 App: Replace C cast 2022-09-18 11:06:51 -05:00
wmayer
5240a30431 App: modernize C++: replace 'typedef' with 'using' 2022-08-29 12:58:39 +02:00
berniev
d66df602ad App: Single arg ctors must be explicit 2022-08-24 07:20:57 +02:00
berniev
7f699c3dad App: redundant void 2 2022-08-08 09:45:36 +02:00
berniev
1cc6329eab App: use empty 2022-08-06 19:29:59 +02:00
berniev
e7357c1a99 App: use emplace_back 2022-08-05 10:31:51 +02:00
wmayer
632e167ed8 App: improve whitespaces 2022-08-01 01:29:47 +02:00
berniev
65a356835b App: Modernise ctors dtors defs etc 2022-08-01 00:34:46 +02:00
Uwe
fa36a57724 [App] remove superfluous nullptr checks 2022-07-18 03:12:01 +02:00
0penBrain
38ec63cba1 [Bugfix] Expression: fix precedence+associativity management in parenthesis removal
Fixes #6948
2022-06-11 15:59:06 +02:00
wmayer
1fbff0a616 App: fix regression in Expression::getDepObjects
Avoid to add labels muliple times as reported here: https://forum.freecadweb.org/viewtopic.php?p=593994#p593994
2022-05-09 10:53:21 +02:00
wmayer
ddf020e107 App: fixes #6844: Crash in PropertyXLinkContainer::updateDeps 2022-05-08 18:22:29 +02:00
Chris Hennes
132a1d7e55 App: PR6497 move return statement to new line 2022-03-29 12:33:37 -05:00
wmayer
749361d2f3 App: modernize C++11
* use nullptr
2022-03-23 17:29:23 +01:00
Uwe
b4fff07d9e [App] Expression and Extension: remove unused includes 2022-02-25 18:06:57 +01:00
Zheng, Lei
0dcea9b2e1 App: warning on invalid cell offset in Expression 2021-12-21 21:41:02 -07:00
Zheng, Lei
68fca40983 Spreadsheet: support cell binding
Cell binding allows one to bind a range of cells of one sheet to another
range of cells of an arbitary sheet, including any empty cells in the
range.

The binding is implemented with PropertyExpressionEngine and
PropertySheet::setPathValue(), which binds a special path of
PropertySheet, such as

    .cells.Bind.A1.D1

to an expression, such as

     tuple(.cells, <<A2>>, <<A5>>)

The A1 and D1 in the example above specifies the binding start and end
cell address. And <<A2>> and <<A5>> are the range of cells to bind to.
Note that you can use any expression that evalutes to string for the
binding destination, e.g. <<A%d>> % B1, which uses the value inside B1
to construct the binding destination. The '.cells' in the tuple shown
above is an example to bind cells of the same PropertySheet. It can be
change to to reference to any other spreadsheet, even those outside the
current document, e.g. Document#Spreadsheet001.cells
2021-12-21 21:41:02 -07:00
Zheng, Lei
df6a7e4a56 App: add expression build-in href() for backward compatibility
As deprecated alias for hiddenref()
2021-12-21 21:41:02 -07:00
Zheng, Lei
14dfae0597 App: add hiddenref() expression built-in function
Any object reference inside this function is treated as hidden to
exclude it from dependency calculation. This function allows some form
of cyclic depdenency.

Merger note: renamed from "HREF" to "HIDDENREF" to avoid confusion with
the standard "hypertext reference" use of HREF.
2021-11-14 20:45:09 -06:00