file.write() streamed directly onto the target path, so a crash mid-write
left a truncated file with dangling STEP references. Serialize to a temp
file in the same directory, then atomically rename it onto the target.
- New IfcUtil::path::atomic_rename_file: std::rename on POSIX, MoveFileExW
with MOVEFILE_REPLACE_EXISTING on Windows. Unlike rename_file it never
unlinks the destination first, so there is no window where it goes missing.
- Fully in C++/swig (per aothms), so the FILE_NAME header is untouched: it
comes from the model header, not the output path (verified empirically).
- Temp lives next to the target so the rename stays on one filesystem.
- Stream is closed before the rename (Windows cannot move an open file).
- On any write error the temp is removed and the original target is intact.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Applied MSVC tabify to IfcParse.cpp/h.
* Now Argument base class has throwing implementation for each conversion operator (removed those from derived classes).
* Added NullArgument class for the case when null arguments appear after setting elements.
* Now operator tokens are handled just like any other token.
* Refactoring: Token is now a struct with good fields, not a nameless pair.
* Now end position of token is set at its construction.
* Now type of token is determined on construction, as* function simply check stored type.
* Now int-s, float-s and some etc are parsed when token is created.
* Implemented simple way to remove spaces in parsing.
* Tokens are now created without allocations.
* Call RemoveTokenSeparators once for every token.
* Added temporary std::string object in lexer (for optimization purposes).
* Reimplemented asString without allocations.
* Parsing keywords without allocations.
* Added checks for type to tokenFunc::as*** functions.
* CMake: moved setting link directories before all the projects.
* Added IfcParse_Export header for declaring export macro.
* Added IFCPARSE_STATIC_DEFINE macro to all projects.
* Added include for export macro to swig file.
* Added IfcParse_EXPORT macro for all classes in headers generated by express parser.
* Allow removing boost.regex dependency by defining macro IFCPARSE_NO_REGEX.
* Fixed bug in deletion of ICU converter.
* Added export macro to most of the classes across headers
* Fixed memory leak: delete nested IfcAbstractEntity in EntityArgument.
* Fixed memory leak in destructor of IfcWritableEntity (args values).