Commit Graph

26 Commits

Author SHA1 Message Date
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
Andrei Pozolotin
c5ad7b50b6 Resolve #11965 - no proper execute() for cross-property references
Solution B: parsequant() function
2024-02-19 11:12:52 -06:00
wmayer
ee0fad4c90 App: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
Daniel-Khodabakhsh
8003606222 Expressions: Add Vector API expression functions (#10237) 2023-08-15 23:00:16 -05: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
berniev
d66df602ad App: Single arg ctors must be explicit 2022-08-24 07:20:57 +02:00
berniev
65a356835b App: Modernise ctors dtors defs etc 2022-08-01 00:34:46 +02:00
wmayer
749361d2f3 App: modernize C++11
* use nullptr
2022-03-23 17:29:23 +01:00
wmayer
4977e55e51 App: Optimize includes to reduce compile time 2022-03-07 15:53:58 +01:00
Uwe
b4fff07d9e [App] Expression and Extension: remove unused includes 2022-02-25 18:06:57 +01: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
Zheng, Lei
2c6f621721 App: add expression built-in function str()
...for stringify
2021-10-12 13:42:10 -05:00
Benjamin Nauck
7ee7e60310 [App] Switch from boost::tuple to std::tuple
It's better to use the standard lib when possible
2021-03-06 19:31:06 +01:00
luz paz
bfdffb50be App: Fix header uniformity, trailing whitespace, and doxygen headers 2020-11-19 13:38:37 +01:00
wmayer
aa3fde2dae Coverity: Big parameter passed by value 2020-07-20 17:34:25 +02:00
wmayer
cbb5f99ade PVS: V730 Not all members of a class are initialized inside the constructor 2020-07-18 10:59:27 +02:00
Zheng, Lei
3beb1bff21 App: improve FunctionExpression forward compatibility
Remove runtime check when constructing FunctionExpression, in order to
support future built-in function. Exception will be thrown when
evaluating the expression to inform user about the error.
2020-06-03 22:18:39 +02:00
luz.paz
4f308dc03c src/App: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/App` files
2019-12-25 11:38:43 +01:00
wmayer
9ba5d3505c fix -Winconsistent-missing-override -Wunused-variable 2019-10-13 14:29:52 +02:00
Zheng, Lei
44354b808b App: add Expression built-in function mscale/minvert/create
mscale(matrix,vector|tuple) for scaling matrix

minvert(matrix|placement|rotation) for inverting matrix, placement or
rotation

create(type,arg...) for creating Python object of given type (currently
only support 'matrix', 'placement', 'rotation', 'vector'
2019-10-07 17:24:30 +02:00
Zheng, Lei
a1417c5ffa App: extend Expression syntax
* Support sub-object reference syntax using the following syntax,
    Part.<<Box.>>.Placement
  or, with sub-object label referencing
    Part.<<$Cube.>>.Placement

* Extend indexing support, including range based indexing, e.g.
    A1[B2+1][C3][D4:-1]

* Add new constants, None, True, true, False, false.
2019-09-28 15:31:24 +02:00
Zheng, Lei
22fede14d8 App: add list/tuple() function to Expression
For easy creation of Python list/tuple using expression. Range
expression can now be expanded into list or tuple.
2019-09-28 15:30:55 +02:00
Zheng, Lei
ea7eee8061 Expression: split Expression.h to ExpressionParser.h
Split Expression details into a separate header to reduce recompilation
time on changes.
2019-09-28 15:30:41 +02:00