Commit Graph

77 Commits

Author SHA1 Message Date
PhoneDroid
842c5f53e1 [ App ]: Update SPDX License Identifiers 2025-12-25 11:55:37 -06:00
Markus Reitböck
73c97bc90f App: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
should be considered an optimization, not a requirement. In particular, do not explicitly include a
precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
generated precompile header on the compiler command line instead. This is more portable across
the major compilers and is likely to be easier to maintain. It will also avoid warnings being
generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-14 09:47:02 +02:00
Pieter Hijma
9cbea91d60 Doc: Improve App::ObjectIdentifier docs 2025-05-07 13:34:25 +02:00
Pieter Hijma
f438c0ed04 Doc: Move doc comments ObjectIdentifier
Move the doc comments from the cpp file to the header file.
2025-05-07 10:26:28 +02:00
Ladislav Michl
9683cf1e4f Base: rename Exception's PascalCase methods to camelCase 2025-05-05 23:50:01 +02:00
Kacper Donat
77e40b9747 Base: Use explicit pointer syntax for freecad_cast (#20694)
* Base: Use explicit pointer syntax for freecad_cast

This aligns our custom cast with other casts

* All: Use explicit pointer syntax for freecad_cast
2025-04-11 14:11:33 +00:00
Kacper Donat
9d97d1c895 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
Benjamin Nauck
7b7e256e4f App: Add #include <limits> where used 2025-03-31 23:50:19 +02:00
Benjamin Nauck
c77de32b78 App: Use std::numeric_limits and std::numbers instead of defines 2025-03-29 13:32:37 +01:00
tritao
2145b742eb Base: Standardize on Py::Long type for Python bindings. 2025-02-08 13:14:22 +00:00
Benjamin Nauck
6f535f19fb 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
fadfc7e270 App: Apply clang format (part 2) 2024-11-21 21:17:42 +01:00
bgbsww
19e450a667 Refactor all element name pairs into clearer struct names - renames 2024-07-20 16:32:12 -04:00
bgbsww
494cb9388c 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
89dbab9b0e 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
1cf1a90a17 App: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
wmayer
af8c05c507 App: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
wmayer
4991475341 App: modernize C++: use range-based for loop 2023-08-14 16:40:25 +02:00
wmayer
9efac962ac 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
4be3fe84c7 App: fix trailing whitespace 2022-12-02 19:19:17 -06:00
wmayer
8328264690 App: [skip ci] whitespace improvements 2022-08-24 10:43:56 +02:00
berniev
d2babf0eb5 App: Single arg ctors must be explicit 2022-08-24 07:20:57 +02:00
Uwe
e324532cd8 [App] [Spreadsheet] fix compilation errors
- introduced by #7318 and #7319
2022-08-06 19:59:06 +02:00
berniev
22dcf5866f App: use empty 2022-08-06 19:29:59 +02:00
Uwe
e69a920f18 [App] remove superfluous nullptr checks 2022-07-18 03:12:01 +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
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