5/27/2023 0 Comments Freecadweb reviewThen you could replace each FCCONSOLEFMT (message, which) with ConsoleSingleton::Message (pMsg, Notification::WARNING) (etc.). Using a function would be the better approach. The overhead involved in using static cstring arrays should be minimal - most of the actual code in Enumeration is just moved over from PropertyEnumeration. In my opinion, this is poorly done, makes the code difficult to read, and can likely lead to difficult to find bugs in the future. isCustom() is currently protected just because it breaks encapsulation more than I prefer to do, but either way I think it's a bit cleaner than the current implementation. The forward declaration of PropertyEnumeration in Enumeration is only there to allow for declaring PropertyEnumeration as a friend, so that PropertyEnumeration can decide whether to save the enumeration values using Enumeration::isCustom(). To be honest, I'm not totally clear on the distinction between Base and App. The Enumeration class is currently in Base as I was following the example of Matrix. Will have another look tomorrow when I'm a bit fresher.Ĭould definitely move Enumeration into App, and/or could remove the PropertyEnumeration forward-declaration. I think there was another potential issue, but can't find it now. I also haven't looked terribly hard, to be fair. Also, the memory allocated by setEnumVector() doesn't get deleted anywhere as far as I can see. PropertyEnumeration::setEnumVector() starts out with "delete _EnumArray " - so I think that means if setEnumVector is called after the PropertyEnumeration is initialised in the normal way with the static const char*, then delete will be called on that static array. The only functional changes this should have are patching a potential crash or two
0 Comments
Leave a Reply. |