LinuxCNC / linuxcnc

LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more.
http://linuxcnc.org/
GNU General Public License v2.0
1.75k stars 1.14k forks source link

Updates for the IniFile class #2829

Closed havardAasen closed 6 months ago

havardAasen commented 7 months ago

The most significant change is the return value for some of the Find(). The return value was changed from const char* to std::optional<const char*>. This change breaks the API.

The main reason behind this change is to tell the users that the value can return something else, the compiler can also give us some help if we use the returned value in the wrong way, increasing type-safety.

Some of the code has also been refactored, changed and optimized, this is unrelated to the previously mentioned change.

I also added tests. It's does not have complete coverage, the C API is untested (the 'mb2hal' tests, uses the C API) as well as the 'tildeexpand' functionality.

Closes #2812

andypugh commented 6 months ago

Can you fix the conflicts? It doesn't look hard, and can be done in the web editor here on github, but I am not particularly confident meddling with other folks' C++.

havardAasen commented 6 months ago

Sure, no problem Andy.

Rebased it against master, perhaps not the best thing considering how large the diff became, still, the needed change was minor.