Commit Graph

70 Commits

Author SHA1 Message Date
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
Ladislav Michl
9683cf1e4f Base: rename Exception's PascalCase methods to camelCase 2025-05-05 23:50:01 +02:00
Benjamin Nauck
02d095f6e2 App: use contains() instead of count() where possible 2025-05-03 22:19:51 +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
Kacper Donat
cc2efa90f8 Base: Add isNullOrEmpty string helper
This adds isNullOrEmpty string helper that cheks if string is... well
null or empty. It is done to improve readability of the code and better
express intent.
2025-02-21 15:04:43 +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
Bas Ruigrok
29de03a098 Move isLink and isLinkGroup from AssemblyObject to DocumentObject 2024-09-08 11:56:14 +02:00
PaddleStroke
e0fad7dc8f App::Link : add getLinkGroup() to ElementLink 2024-09-02 18:20:18 +02:00
bgbsww
678f35fda2 Toponaming: Cleanup 2024-07-21 17:40:42 -04:00
bgbsww
53ad95b382 Toponaming: bring in missing code fragments in App 2024-05-12 17:21:49 -04:00
Zheng, Lei
903d72b96e App: fix linked copy on change group out of scope problem
Fixes FreeCAD/FreeCAD#13481
2024-04-24 08:09:53 -05:00
Florian Foinant-Willig
6cec876a41 [Link] Fix SIGSEGV with LinkCopyOnChange=Tracking 2024-03-12 21:47:07 +01:00
André Caldas
e6b5fd0a21 Does not rely on the pointervalue returned by getNameInDocument() to use as a DAG key.
In order to make getNameInDocument() always return a valid string,
we implement a getDagKey() method that shall be used instead of getNameInDocument()
when we want to use the pointer value as a "key" to identify the DocumentObject.
2024-01-22 10:40:24 -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
luzpaz
09a965d595 Fix typos 2023-08-21 20:20:47 +02:00
wmayer
1efde78d74 App: modernize C++: use equals default 2023-08-20 18:10:17 +02:00
wmayer
4991475341 App: modernize C++: use range-based for loop 2023-08-14 16:40:25 +02:00
wmayer
948cbfccd9 modernize C++: avoid bind
In many cases std::bind() is kept because the code is much simpler
2023-08-08 21:10:16 +02:00
wmayer
52e1c7c33b modernize C++: move from boost::bind to std::bind 2023-08-08 17:36:13 +02:00
Pesc0
c65f049d20 [Toponaming] create ElementMap class (#9175)
* Copypaste ElementMap
* Add MappedNameRef
* Fix missing include
* Copypaste `findTagInElementName`
* fix error introduced _somewhere_
* refactor toponaming constants
* Move `findTagInElementName` in `MappedName`
* reintroduce workaround to compile ElementMap
* Added missing functions copied from complexgeodata
* fix last compile errors, reorder and format files
* remove recursive refs to ComplexGeoData
* Add more comments
* fixed comments and added tests
* added FIXME, make functions private, misc fixes
* Move static functions from complexGeoData to PostfixStringReferences. Rename to ElementNamingUtils
* Fix broken includes due to previous change
* Revert constants from string to const char*
* added childmap tests and made hasher public
* Make functions private
* Added remaining tests
* removed bool return from `erase` functions
* fix missing appexport

Co-authored-by: John Dupuy <jdupuy98@gmail.com>
2023-06-15 09:05:24 -05:00
wmayer
3e70636bdc App: [skip ci] fix warnings reported by GH actions 2022-11-17 23:50:34 +01:00
wmayer
cd34494063 App: replace boolean with enum 2022-11-17 17:38:31 +01:00
wmayer
de595d5aa9 App: [skip ci] fix string literal 2022-10-21 13:43:26 +02:00
wmayer
656890be38 App: modernize C++: replace 'typedef' with 'using' 2022-08-29 12:58:39 +02:00
berniev
810c3780de App: Use override etc 2 2022-08-09 12:42:02 +02:00
wmayer
979fad404e App: [skip ci] improve whitespace 2022-08-08 10:11:22 +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
Uwe
32ffcc7eda [App] code style fixes by MSVC
- automatic .clang fixes while checking for nullptr, no actual code change
2022-07-18 13:03:42 +02:00
wmayer
2628fb0350 App: fix memory leaks in Enumeration class and simplify code 2022-06-25 18:18:57 +02:00
luz paz
a526451afd Fix various typos 2022-06-01 18:03:40 -04:00
wmayer
1aef8e0246 App: cannot assign a null pointer to a std::string
Depending on the compiler an exception is raised or a crash occurs
2022-05-06 15:14:37 +02:00
Zheng, Lei
22d6e5a030 App: handle exception on change Link CopyOnChange 2022-05-05 11:37:38 -05:00
Chris Hennes
f7edc74eee App: PR6497 move return statement to new line 2022-03-29 12:33:37 -05:00
Zheng, Lei
c3fcf39e9c App: minor change to LinkParams 2022-03-26 10:19:20 -04:00
Zheng, Lei
6616433d47 Gui: expose Link CopyOnChange setup through context menu
The CopyOnChange setup is meant to let user select which dependency to
copy when changing configuration.
2022-03-26 10:19:20 -04:00
Zheng, Lei
fbbc89c52c App/Gui: support Link refresh on change of originally linked configurable object 2022-03-26 10:19:20 -04:00
wmayer
1a20b7f119 App: modernize C++11
* use nullptr
2022-03-23 17:29:23 +01:00
Uwe
062944f674 [App] Link and Material: remove unused includes 2022-02-27 21:23:51 +01:00
wmayer
b35623e680 App: Bugfix for NULL-Pointer dereference of Property->getName() 2022-01-16 14:30:51 +01:00
Zheng, Lei
5229f5776f App: support CopyOnChange property in Link
New property status bit 'CopyOnChange' is added for any document object
to publish any property as a 'Configuration' option. When Link is
linked to any object with such property, it will duplicate those
properties and added it Link itself as dynamic properties. If the user
changes any of these dynamic properties, the Link will auto copy the
linked to object and apply the new configuration to it.

The Link has a new property 'LinkCopyOnChange' to allow user to
enable/disable this feature.

Spreadsheet's 'Configuration Table' feature will publish its
configuration property with 'CopyOnChange'.

Currently, once the linked object is copied, it will be independent with
the original object. There is no mechanism to auto sync changes back to
the copy.
2021-12-21 21:41:02 -07:00
Chris Hennes
ff29bb1453 [App] LGTM fix - rename loop variable
LGTM complains that the use of "obj" as the loop variable here hides the
parameter "obj". To silence the warning, rename the loop variable.
2021-09-18 23:18:51 -05:00
Zheng, Lei
fc0860db1c App: fix LinkMode enforcement in Link on restore 2021-08-01 16:36:12 +08:00