Import: Simplify handling of Resource_FormatType

The type Resource_FormatType already exists since 2015. So, its usage doesn't require pre-processor macros everywhere.
This commit is contained in:
wmayer
2024-06-18 15:54:56 +02:00
committed by Chris Hennes
parent d49303a5dc
commit 06b464a9b0
6 changed files with 53 additions and 71 deletions

View File

@@ -244,14 +244,14 @@ private:
if (options.hasKey("mode")) {
ocaf.setMode(static_cast<int>(Py::Long(options.getItem("mode"))));
}
if (options.hasKey("codePage")) {
#if OCC_VERSION_HEX >= 0x070800
if (options.hasKey("codePage")) {
int codePage = static_cast<int>(Py::Long(options.getItem("codePage")));
if (codePage >= 0) {
cp = static_cast<Resource_FormatType>(codePage);
}
#endif
}
#endif
}
if (mode && !pcDoc->isSaved()) {
@@ -263,11 +263,10 @@ private:
try {
Import::ReaderStep reader(file);
#if OCC_VERSION_HEX < 0x070800
reader.read(hDoc);
#else
reader.read(hDoc, cp);
#if OCC_VERSION_HEX >= 0x070800
reader.setCodePage(cp);
#endif
reader.read(hDoc);
}
catch (OSD_Exception& e) {
Base::Console().Error("%s\n", e.GetMessageString());
@@ -577,11 +576,7 @@ private:
if (file.hasExtension({"stp", "step"})) {
Import::ReaderStep reader(file);
#if OCC_VERSION_HEX < 0x070800
reader.read(hDoc);
#else
reader.read(hDoc, Resource_FormatType_UTF8);
#endif
}
else if (file.hasExtension({"igs", "iges"})) {
Import::ReaderIges reader(file);