Commit Graph

68 Commits

Author SHA1 Message Date
tritao
10513144d9 Base: Standardize on Py::Long type for Python bindings. 2025-02-08 13:14:22 +00: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
wmayer
5771c94523 App: Apply clang format (part 2) 2024-11-21 21:17:42 +01:00
bgbsww
0bddc51805 Refactor all element name pairs into clearer struct names - renames 2024-07-20 16:32:12 -04:00
bgbsww
365c5f4777 Detect circular references in sketches, and add corresponding tests (#11716)
* Possible fix for 10482 circular reference regression with tests

* Remove redundant test

* Cleanup pre PR

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-06 18:13:44 -06:00
André Caldas
560898907b Avoids using getNameInDocument() to test if DocumentObject is attached to a Document.
This patch substitutes by isAttachedToDocument() (almost) everywhere where
getNameInDocument() is used for this purpose.

The very few places not touched by this patch demand a (just a little) less trivial change.
When we change the returning type of getNameInDocument() to std::string,
those places will be easily found, because they shall generate a compiler error
(converting std::string to bool).

Rationale:
The fact that getNameInDocument() return nullptr to indicate
that the object is not attached to a document is responsible for lots of bugs
where the developer does not check for "nullptr".

The idea is to eliminate all those uses of getNameInDocument() and, in the near future,
make getNameInDocument() return always a valid std::string.
2023-12-11 17:37:58 +01: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
wmayer
26f16f7410 App: modernize C++: use range-based for loop 2023-08-14 16:40:25 +02:00
wmayer
9498691ea8 App: fix failure to detect cyclic dependencies on expressions
See also forum thread: https://forum.freecadweb.org/viewtopic.php?f=3&t=74331
2023-01-02 16:36:10 +01:00
luz paz
0e08b51a58 App: fix trailing whitespace 2022-12-02 19:19:17 -06:00
wmayer
949b43aabb App: [skip ci] whitespace improvements 2022-08-24 10:43:56 +02:00
berniev
d66df602ad App: Single arg ctors must be explicit 2022-08-24 07:20:57 +02:00
Uwe
6f9a4ebc7f [App] [Spreadsheet] fix compilation errors
- introduced by #7318 and #7319
2022-08-06 19:59:06 +02:00
berniev
1cc6329eab App: use empty 2022-08-06 19:29:59 +02:00
Uwe
fa36a57724 [App] remove superfluous nullptr checks 2022-07-18 03:12:01 +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
wmayer
95c70e7f4c App: use forward declarations 2022-03-04 21:09:46 +01:00
wmayer
032cea587d 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
178e082271 [App] Object, Meta, Merge: remove unused includes 2022-02-28 01:02:06 +01:00
wmayer
f147986fa9 App: Bugfix for NULL-Pointer dereference of Property->getName() 2022-01-16 14:30:51 +01:00
wmayer
26f9e7869f App: replace three boolean of CellAddress::toString() with a bitmask of enums 2022-01-09 10:39:54 +01:00
Zheng, Lei
4ca362df0a App: catch Base::Exception in ObjectIdentifier::getDep() 2021-12-23 15:35:22 +01:00
wmayer
2db73c099b 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
b1beadd2e9 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
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
Chris Hennes
6780ded233 [App] Fix LGTM warning decl hides param 2021-09-19 12:31:24 -05:00
luz paz
fc6d1292d1 App: remove Py2 code from several src/App .cpp files 2021-04-19 15:27:06 +02:00
Zheng, Lei
0a6b7dad41 App: fix ObjectIdentifier::relativeTo()
Fixes realthunder/FreeCAD_Assembly3#328
2020-11-22 18:07:12 +01:00
wmayer
b25dee58d5 Coverity: Uninitialized scalar/pointer field 2020-07-20 17:34:30 +02:00
wmayer
421f6c52cb Coverity: Dereference after null check 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
Abdullah Tahiri
ac4196fb66 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
d5a4996d25 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
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
asapelkin
bbbabf99ae removed useless std::move on const and unmovable objects 2019-11-21 17:49:57 +01: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
Zheng, Lei
783d218b1d App: more sanity check in ObjectIdentifier 2019-08-30 15:46:33 +02:00
Zheng, Lei
04d678571c App: fix Python object leak in ObjectIdentifier 2019-08-30 15:45:44 +02:00
Zheng, Lei
88a1a9482e App: fix crash on accessing non-existent attribute in ObjectIdentifier 2019-08-30 15:45:28 +02:00
luz.paz
8825c95727 Fix typos in src/App 2019-08-17 15:32:48 +02:00
Zheng, Lei
93e60caa35 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
88f637d8fd Py3 fix: correctly convert a Python str to const char* 2019-04-14 13:00:13 +02:00
luz.paz
505488c4f9 Misc. typos
Found via `codespell`
2018-04-25 09:41:33 -03:00
Unknown
a8ecffb652 Misc. typo fixes
Various workbenches
2017-12-23 14:30:30 +01:00
luzpaz
987b8db0b5 More typos, grammar fixes, uniformity 2017-11-15 10:46:43 -05:00
wmayer
88962a8c45 update expressions when relabelling a document object 2017-10-08 01:45:39 +02:00
looooo
ca3e58e2f3 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
1673ab801e use specialized exception classes 2017-04-28 18:49:11 +02:00