Commit Graph

50 Commits

Author SHA1 Message Date
wmayer
5e0cfc64ee App: use forward declarations 2022-03-04 21:09:46 +01:00
wmayer
6c2e1a2d6e Base: implement a lightweight smart pointer for PyObject like Py::Object to reduce includes of Python.h in header files 2022-03-04 15:51:51 +01:00
Uwe
f04194b7bb [App] Object, Meta, Merge: remove unused includes 2022-02-28 01:02:06 +01:00
wmayer
b35623e680 App: Bugfix for NULL-Pointer dereference of Property->getName() 2022-01-16 14:30:51 +01:00
wmayer
ce05165f21 App: replace three boolean of CellAddress::toString() with a bitmask of enums 2022-01-09 10:39:54 +01:00
Zheng, Lei
c4b0907c2c App: catch Base::Exception in ObjectIdentifier::getDep() 2021-12-23 15:35:22 +01:00
wmayer
dbaf53a26a App: fix ObjectIdentifier::getDep
+ it's an obscure way to clear the error state by instantiating PyException, instead use the clear() method
+ do not handle unknown exceptions because this suppresses all exceptions and thus makes error search more complicated
2021-12-20 16:43:02 +01:00
Chris Hennes
d9afcacf6f Core: Fix std::string init from null pointer
Constructing a string from a null pointer is undefined behavior: it
turned out to work with gcc and MSVC, but with XCode/clang it results in
a segmentation fault. Theis fix assumes that the expected behavior is to
yield an empty string.
2021-12-16 00:09:05 -06: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
Chris Hennes
373246858e [App] Fix LGTM warning decl hides param 2021-09-19 12:31:24 -05:00
luz paz
a1fc733ddf App: remove Py2 code from several src/App .cpp files 2021-04-19 15:27:06 +02:00
Zheng, Lei
810a8dc643 App: fix ObjectIdentifier::relativeTo()
Fixes realthunder/FreeCAD_Assembly3#328
2020-11-22 18:07:12 +01:00
wmayer
983939b32d Coverity: Uninitialized scalar/pointer field 2020-07-20 17:34:30 +02:00
wmayer
0a6929a122 Coverity: Dereference after null check 2020-07-20 17:34:25 +02:00
wmayer
4807fd3b33 PVS: V730 Not all members of a class are initialized inside the constructor 2020-07-18 10:59:27 +02:00
Abdullah Tahiri
0beb19d724 Expressions: Avoid multiline error messages
===========================================

fixes #4324

A multiline error message produces poor visualisation when used in the UI, while
there is no need for it to be multiline.
2020-06-06 20:20:10 +02: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
asapelkin
5a75d2ff45 removed useless std::move on const and unmovable objects 2019-11-21 17:49:57 +01: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
deede02ed8 App: more sanity check in ObjectIdentifier 2019-08-30 15:46:33 +02:00
Zheng, Lei
d967e86fcc App: fix Python object leak in ObjectIdentifier 2019-08-30 15:45:44 +02:00
Zheng, Lei
bfca168ab7 App: fix crash on accessing non-existent attribute in ObjectIdentifier 2019-08-30 15:45:28 +02:00
luz.paz
3a1a6eb7d8 Fix typos in src/App 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
wmayer
d46f86fb53 Py3 fix: correctly convert a Python str to const char* 2019-04-14 13:00:13 +02:00
luz.paz
9167064fc1 Misc. typos
Found via `codespell`
2018-04-25 09:41:33 -03:00
Unknown
e3eca59173 Misc. typo fixes
Various workbenches
2017-12-23 14:30:30 +01:00
luzpaz
35ec477426 More typos, grammar fixes, uniformity 2017-11-15 10:46:43 -05:00
wmayer
3abfbb7fb2 update expressions when relabelling a document object 2017-10-08 01:45:39 +02:00
looooo
e6202f46e9 py3: App: files D-Z ported to python3
issue 0000995
diff to py3-branch will remain in the following files in src/App:
- ExtensionContainer.cpp
- FeaturePythonPyImp.h +.inl
most likely these files depend on Tools and Base
2017-05-11 19:19:17 +02:00
wmayer
fb7094bf31 use specialized exception classes 2017-04-28 18:49:11 +02:00
Stefan Tröger
2420559431 Extensions: Revert few changes after restructuring 2016-10-08 12:48:34 +02:00
Stefan Tröger
6fa964c53f Extensions: Introduce classes and port App groups 2016-10-08 12:48:34 +02:00
wmayer
2af6bb6e49 replace deprecated auto_ptr with unique_ptr 2016-09-22 13:01:20 +02:00
wmayer
eb0647b144 Coverity issues:
129727: Structurally dead code
151979, 133461: Uninitialized scalar field
129785, 129786, 129787: Use after free
2016-08-16 12:23:12 +02:00
Eivind Kvedalen
dcc3c6b27b Expression class: Improved error message when resolving a variable fails. 2016-02-18 16:54:44 +01:00
Eivind Kvedalen
452650440b PropertyExpressionEngine: Refactored and moved visitor code to separate file. 2016-02-18 16:54:41 +01:00
Eivind Kvedalen
ae73a9313b ObjectIdentifier: Reworked resolve() function to solve issue #2389 and #2418.
* Refactored code; moved mutable fields into a separate inner class.
* Added resolvedProperty to ResolveResults class.
* Set resolved document name, even if it does not resolve correctly, so we can give a better error message later.
* If the document name is explicitly set, and it does not resolve, don't try any further.
* If document name is set, use that instead of the ObjectIdentifier's owner when looking up the document object.
2016-02-18 16:54:39 +01:00
wmayer
c775de52f0 Revert "ObjectIdentifier: Issue #2389: Needs to set documentNameSet and documentObjectNameSet to true to resolve properly."
This reverts commit 670eaf04a6.
2016-01-26 20:58:28 +01:00
wmayer
d6b77ec214 + raise a TypeError instead of a standard exception in ObjectIdentifier 2016-01-26 12:49:15 +01:00
Eivind Kvedalen
4ea2f7cb46 ObjectIdentifier: Issue #2389: Needs to set documentNameSet and documentObjectNameSet to true to resolve properly. 2016-01-26 11:58:12 +01:00
Eivind Kvedalen
580dab840c ObjectIdentifier: Issue #2407: Fixed resolution of DocumentObject, to differentiate better between internal name and Label. 2016-01-26 11:25:58 +01:00
Eivind Kvedalen
c2d5b0ad91 Issue #2389: ObjectIdentifiers constructed from a property sometimes do not
resolve correctly, because the resolver may fail if a different document
objects has a Label equal to the property's document object's identifier.
2016-01-08 23:09:00 +01:00
Eivind Kvedalen
fd9ceeae43 ObjectIdentifier: Resolve document name on both identifier and Label. 2016-01-08 23:09:00 +01:00
Eivind Kvedalen
34d9d86925 ObjectIdentifier::resolve() should set documentName to internal name, not the Label property. 2016-01-08 23:09:00 +01:00
Eivind Kvedalen
ca0c9de886 Expression/ObjectIdentifier: changed return type of renameDocumentObject and renameDocument,
to be able to signal that a rename actually took place.
2015-12-21 14:11:12 +01:00
Eivind Kvedalen
b087991559 ObjectIdentifier: Added std::setprecision to keep precision of double to string conversion. 2015-12-18 22:05:31 +01:00
Eivind Kvedalen
4a861c75d5 App: Replaced freecad_dynamic_cast by static_cast. In this case we know the type, and don't check for 0. 2015-12-09 12:15:14 +01:00
Eivind Kvedalen
ae388d26ea Added Expression classes to App directory. Added Expression interface to Property base class. 2015-09-21 14:51:02 +02:00