Commit Graph

98 Commits

Author SHA1 Message Date
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
wmayer
a7172cd730 App: improve whitespaces 2022-08-01 01:29:47 +02:00
berniev
b6cae3bfdf App: Modernise ctors dtors defs etc 2022-08-01 00:34:46 +02:00
Uwe
e69a920f18 [App] remove superfluous nullptr checks 2022-07-18 03:12:01 +02:00
0penBrain
d96a7ac9d8 [Bugfix] Expression: fix precedence+associativity management in parenthesis removal
Fixes #6948
2022-06-11 15:59:06 +02:00
wmayer
f7b2421df2 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
caecc921f0 App: fixes #6844: Crash in PropertyXLinkContainer::updateDeps 2022-05-08 18:22:29 +02:00
Chris Hennes
f7edc74eee App: PR6497 move return statement to new line 2022-03-29 12:33:37 -05:00
wmayer
1a20b7f119 App: modernize C++11
* use nullptr
2022-03-23 17:29:23 +01:00
Uwe
a8c912d6f8 [App] Expression and Extension: remove unused includes 2022-02-25 18:06:57 +01:00
Zheng, Lei
7e4f71606c App: warning on invalid cell offset in Expression 2021-12-21 21:41:02 -07:00
Zheng, Lei
0c2c334f87 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
10f1ac8436 App: add expression build-in href() for backward compatibility
As deprecated alias for hiddenref()
2021-12-21 21:41:02 -07:00
Zheng, Lei
fdae470c1b 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
864f6d96a6 App: add expression built-in function str()
...for stringify
2021-10-12 13:42:10 -05:00
Chris Hennes
373246858e [App] Fix LGTM warning decl hides param 2021-09-19 12:31:24 -05:00
wmayer
e92325c9c9 App: remove some more deprecated Py2 code
and remove deprecated void from function signature and replace 0 or NULL with nullptr
2021-04-26 10:55:56 +02:00
luz paz
a1fc733ddf App: remove Py2 code from several src/App .cpp files 2021-04-19 15:27:06 +02:00
Benjamin Nauck
358cb01a9c [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
wmayer
45e0673645 LGTM: [skip ci] fix: Declaration hides parameter
A local variable hides a parameter. This may be confusing. Consider renaming one of them.
2020-07-27 10:57:34 +02:00
wmayer
e6b6fa627e Coverity: Not restoring ostream format 2020-07-20 17:34:29 +02:00
wmayer
f9ef60d063 Coverity: Empty virtual destructor 2020-07-20 17:34:27 +02:00
wmayer
7eeb35b869 Coverity: Big parameter passed by value 2020-07-20 17:34:25 +02:00
wmayer
70c3cc7c03 PVS: V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. 2020-07-18 10:59:28 +02:00
wmayer
2ebd1c3518 PVS: V501 There are identical sub-expressions to the left and to the right 2020-07-18 10:59:27 +02:00
wmayer
8a10b77400 Expression: move handling of invalid quantities (NaN) from FunctionExpression to DlgExpressionInput 2020-06-07 18:00:35 +02:00
wmayer
4a449d1d0b App: [skip ci] throw an exception if the expression gives NaN 2020-06-06 13:04:01 +02:00
Zheng, Lei
1f41f6f088 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
wmayer
be8634d05c Handle clang 10 warnings:
+ fix -Wtautological-bitwise-compare
+ fix -Wimplicit-int-float-conversion
+ fix -Wmisleading-indentation
+ fix -Wrange-loop-construct
+ suppress -Wdeprecated-copy of 3rd party libs
2020-05-25 15:34:43 +02:00
wmayer
bcae0c9139 App: [skip ci] reduce number of digits by 1 to display a NumberExpression
See also: https://forum.freecadweb.org/viewtopic.php?f=3&t=44057
2020-03-11 10:31:28 +01:00
Zheng, Lei
9d66dbbbbf App: fix Expression _moveCells()
The problem is caused by not refreshing ObjectIdentifier internal cache
after change.
2019-12-31 15:23:03 +01:00
luz.paz
019f73852c 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
1e33567a99 check returned value of PyUnicode_AsUTF8() before passing to a std::string to avoid possible segfaults 2019-12-09 12:23:58 +01:00
Zheng, Lei
227a6d3e93 App: fix pyObjectToAny() in Python3 2019-12-09 00:37:34 +00:00
luz.paz
ea0868a433 Fix typos and some trailing whitespace
Found via:  
```
codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,currenty,dof,doubleclick,dum,eiter,elemente,feld,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml
```
2019-12-03 12:22:59 +01:00
Zheng, Lei
8426ebe2ba Fix various Py::Object leak 2019-10-08 17:53:20 +02:00
Zheng, Lei
2df4fb754b 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
36f7098257 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
c3db1e02ec 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
38c47d6e95 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
Zheng, Lei
8cbdc3ad5d App: use Python number protocol in Expression
This adds support to do mul/div with matrix and vector, as well as
Python formated string with operator %.
2019-09-28 15:30:34 +02:00
wmayer
9fa56345cf core system
force strict ISO C++ (-Wpedantic)
TODO: still a lot of variadic macros are not valid ISO C++
2019-09-18 01:01:14 +02:00
wmayer
53e597a5d6 Fix clang compiler warnings:
+ fix -Winconsistent-missing-override
+ fix -Wunused-private-field
+ suppress -Woverloaded-virtual but fix later
2019-08-17 19:51:51 +02:00
Zheng, Lei
2f0aa9b2a5 Fix typos pathes -> paths 2019-08-17 15:32:49 +02:00
Zheng, Lei
b6834155cf Expression: fix python object evaluation 2019-08-17 15:32:48 +02:00
Zheng, Lei
ced27a69c6 PropertyExpressionEngine: convert to link type property
PropertyExpressionEngine is changed to derived from a new class
PropertyExpressionContainer, which is in turn derives from
PropertyXLinkContainer. This makes PropertyExpressionEngine a link type
property that is capable of external linking. It now uses the unified
link property APIs for dependency management and tracking of object
life time, re-labeling, etc.

ObjectIdentifier is modified to support sub-object reference, but is
not exposed to end-user, because expression syntax is kept mostly
unchanged, which will be submitted in future PR. There is, however,
one small change in expression syntax (ExpressionParser.y) to introduce
local property reference to avoid ambiguity mentioned in
FreeCAD/FreeCAD#1619

Modified Expression/ExpressionModifier interface to support various link
property API for link modification.
2019-08-17 14:52:09 +02:00
Yorik van Havre
b5a3d28fee Doxygen tweaks 2019-07-17 18:01:56 -03:00