Import: fix lint warnings
* Make constructors explicit * Fix a regression from PR 10783
This commit is contained in:
@@ -279,7 +279,6 @@ private:
|
||||
|
||||
std::string Utf8Name = std::string(Name);
|
||||
PyMem_Free(Name);
|
||||
std::string name8bit = Part::encodeFilename(Utf8Name);
|
||||
|
||||
try {
|
||||
Py::Sequence list(object);
|
||||
@@ -344,7 +343,7 @@ private:
|
||||
writer.write(hDoc);
|
||||
}
|
||||
else if (file.hasExtension({"glb", "gltf"})) {
|
||||
Import::WriterGltf writer(name8bit, file);
|
||||
Import::WriterGltf writer(file);
|
||||
writer.write(hDoc);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
#include <sstream>
|
||||
#include <Standard_Version.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_TagSource.hxx>
|
||||
@@ -60,9 +59,7 @@ void ReaderGltf::read(Handle(TDocStd_Document) hDoc) // NOLINT
|
||||
TCollection_AsciiString filename(file.filePath().c_str());
|
||||
Standard_Boolean ret = aReader.Perform(filename, Message_ProgressRange());
|
||||
if (!ret) {
|
||||
std::stringstream str;
|
||||
str << "Cannot read from file '"
|
||||
<< "" << file.filePath() << "'";
|
||||
throw Base::FileException("Cannot read from file: ", file);
|
||||
}
|
||||
|
||||
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(hDoc->Main());
|
||||
@@ -77,6 +74,7 @@ void ReaderGltf::read(Handle(TDocStd_Document) hDoc) // NOLINT
|
||||
}
|
||||
|
||||
#else
|
||||
(void)hDoc;
|
||||
throw Base::RuntimeError("gITF support requires OCCT 7.5.0 or later");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ void ReaderIges::read(Handle(TDocStd_Document) hDoc) // NOLINT
|
||||
aReader.SetNameMode(true);
|
||||
aReader.SetLayerMode(true);
|
||||
if (aReader.ReadFile(name8bit.c_str()) != IFSelect_RetDone) {
|
||||
throw Base::FileException("cannot read IGES file", utf8Name.c_str());
|
||||
throw Base::FileException("Cannot read IGES file", file);
|
||||
}
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
|
||||
@@ -52,7 +52,7 @@ void ReaderStep::read(Handle(TDocStd_Document) hDoc) // NOLINT
|
||||
aReader.SetLayerMode(true);
|
||||
aReader.SetSHUOMode(true);
|
||||
if (aReader.ReadFile(name8bit.c_str()) != IFSelect_RetDone) {
|
||||
throw Base::FileException("Cannot read STEP file");
|
||||
throw Base::FileException("Cannot read STEP file", file);
|
||||
}
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
#include <sstream>
|
||||
#include <Standard_Version.hxx>
|
||||
#include <TColStd_IndexedDataMapOfStringString.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
@@ -35,16 +34,19 @@
|
||||
|
||||
#include "WriterGltf.h"
|
||||
#include <Base/Exception.h>
|
||||
#include <Mod/Part/App/encodeFilename.h>
|
||||
|
||||
using namespace Import;
|
||||
|
||||
WriterGltf::WriterGltf(std::string name8bit, const Base::FileInfo& file) // NOLINT
|
||||
: name8bit {std::move(name8bit)}
|
||||
, file {file}
|
||||
WriterGltf::WriterGltf(const Base::FileInfo& file) // NOLINT
|
||||
: file {file}
|
||||
{}
|
||||
|
||||
void WriterGltf::write(Handle(TDocStd_Document) hDoc) const // NOLINT
|
||||
{
|
||||
std::string utf8Name = file.filePath();
|
||||
std::string name8bit = Part::encodeFilename(utf8Name);
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
TColStd_IndexedDataMapOfStringString aMetadata;
|
||||
RWGltf_CafWriter aWriter(name8bit.c_str(), file.hasExtension("glb"));
|
||||
@@ -57,9 +59,7 @@ void WriterGltf::write(Handle(TDocStd_Document) hDoc) const // NOLINT
|
||||
#endif
|
||||
Standard_Boolean ret = aWriter.Perform(hDoc, aMetadata, Message_ProgressRange());
|
||||
if (!ret) {
|
||||
std::stringstream str;
|
||||
str << "Cannot save to file '"
|
||||
<< "" << file.filePath() << "'";
|
||||
throw Base::FileException("Cannot save to file: ", file);
|
||||
}
|
||||
#else
|
||||
throw Base::RuntimeError("gITF support requires OCCT 7.5.0 or later");
|
||||
|
||||
@@ -34,12 +34,11 @@ namespace Import
|
||||
class ImportExport WriterGltf
|
||||
{
|
||||
public:
|
||||
WriterGltf(std::string name8bit, const Base::FileInfo& file);
|
||||
explicit WriterGltf(const Base::FileInfo& file);
|
||||
|
||||
void write(Handle(TDocStd_Document) hDoc) const;
|
||||
|
||||
private:
|
||||
std::string name8bit;
|
||||
Base::FileInfo file;
|
||||
};
|
||||
} // namespace Import
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "WriterIges.h"
|
||||
#include <Base/Exception.h>
|
||||
#include <App/Application.h>
|
||||
#include <Mod/Part/App/encodeFilename.h>
|
||||
#include <Mod/Part/App/Interface.h>
|
||||
|
||||
using namespace Import;
|
||||
@@ -44,6 +45,9 @@ WriterIges::WriterIges(const Base::FileInfo& file) // NOLINT
|
||||
|
||||
void WriterIges::write(Handle(TDocStd_Document) hDoc) const // NOLINT
|
||||
{
|
||||
std::string utf8Name = file.filePath();
|
||||
std::string name8bit = Part::encodeFilename(utf8Name);
|
||||
|
||||
IGESControl_Controller::Init();
|
||||
IGESCAFControl_Writer writer;
|
||||
IGESData_GlobalSection header = writer.Model()->GlobalSection();
|
||||
@@ -54,7 +58,6 @@ void WriterIges::write(Handle(TDocStd_Document) hDoc) const // NOLINT
|
||||
writer.Transfer(hDoc);
|
||||
Standard_Boolean ret = writer.Write(name8bit.c_str());
|
||||
if (!ret) {
|
||||
std::string utf8Name = file.filePath();
|
||||
throw Base::FileException("Cannot open file '%s'", utf8Name.c_str());
|
||||
throw Base::FileException("Cannot open file: ", file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,12 +34,11 @@ namespace Import
|
||||
class ImportExport WriterIges
|
||||
{
|
||||
public:
|
||||
WriterIges(const Base::FileInfo& file);
|
||||
explicit WriterIges(const Base::FileInfo& file);
|
||||
|
||||
void write(Handle(TDocStd_Document) hDoc) const;
|
||||
|
||||
private:
|
||||
std::string name8bit;
|
||||
Base::FileInfo file;
|
||||
};
|
||||
} // namespace Import
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "WriterStep.h"
|
||||
#include <Base/Exception.h>
|
||||
#include <App/Application.h>
|
||||
#include <Mod/Part/App/encodeFilename.h>
|
||||
#include <Mod/Part/App/Interface.h>
|
||||
|
||||
using namespace Import;
|
||||
@@ -42,6 +43,9 @@ WriterStep::WriterStep(const Base::FileInfo& file) // NOLINT
|
||||
|
||||
void WriterStep::write(Handle(TDocStd_Document) hDoc) const // NOLINT
|
||||
{
|
||||
std::string utf8Name = file.filePath();
|
||||
std::string name8bit = Part::encodeFilename(utf8Name);
|
||||
|
||||
STEPCAFControl_Writer writer;
|
||||
Part::Interface::writeStepAssembly(Part::Interface::Assembly::On);
|
||||
writer.Transfer(hDoc, STEPControl_AsIs);
|
||||
@@ -67,7 +71,6 @@ void WriterStep::write(Handle(TDocStd_Document) hDoc) const // NOLINT
|
||||
makeHeader.SetDescriptionValue(1, new TCollection_HAsciiString("FreeCAD Model"));
|
||||
IFSelect_ReturnStatus ret = writer.Write(name8bit.c_str());
|
||||
if (ret == IFSelect_RetError || ret == IFSelect_RetFail || ret == IFSelect_RetStop) {
|
||||
std::string utf8Name = file.filePath();
|
||||
throw Base::FileException("Cannot open file '%s'", utf8Name.c_str());
|
||||
throw Base::FileException("Cannot open file: ", file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,12 +34,11 @@ namespace Import
|
||||
class ImportExport WriterStep
|
||||
{
|
||||
public:
|
||||
WriterStep(const Base::FileInfo& file);
|
||||
explicit WriterStep(const Base::FileInfo& file);
|
||||
|
||||
void write(Handle(TDocStd_Document) hDoc) const;
|
||||
|
||||
private:
|
||||
std::string name8bit;
|
||||
Base::FileInfo file;
|
||||
};
|
||||
} // namespace Import
|
||||
|
||||
@@ -588,7 +588,6 @@ private:
|
||||
|
||||
std::string Utf8Name = std::string(Name);
|
||||
PyMem_Free(Name);
|
||||
std::string name8bit = Part::encodeFilename(Utf8Name);
|
||||
|
||||
// determine export options
|
||||
Part::OCAF::ImportExportSettings settings;
|
||||
@@ -680,7 +679,7 @@ private:
|
||||
writer.write(hDoc);
|
||||
}
|
||||
else if (file.hasExtension({"glb", "gltf"})) {
|
||||
Import::WriterGltf writer(name8bit, file);
|
||||
Import::WriterGltf writer(file);
|
||||
writer.write(hDoc);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user