mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 16:43:00 +00:00
ifcopenshell.file.from_string() (#246)
This commit is contained in:
committed by
Thomas Krijnen
parent
475b8554a8
commit
08522c9fd7
@@ -412,14 +412,21 @@ private:
|
||||
|
||||
// The IfcFile* returned by open() is to be freed by SWIG/Python
|
||||
%newobject open;
|
||||
%newobject read;
|
||||
|
||||
%inline %{
|
||||
IfcParse::IfcFile* open(const std::string& s) {
|
||||
IfcParse::IfcFile* open(const std::string& fn) {
|
||||
IfcParse::IfcFile* f = new IfcParse::IfcFile();
|
||||
f->Init(s);
|
||||
f->Init(fn);
|
||||
return f;
|
||||
}
|
||||
IfcParse::IfcFile* read(const std::string& data) {
|
||||
char* copiedData = new char[data.length()];
|
||||
memcpy(copiedData, data.c_str(), data.length());
|
||||
IfcParse::IfcFile* f = new IfcParse::IfcFile();
|
||||
f->Init((void *)copiedData, data.length());
|
||||
return f;
|
||||
}
|
||||
|
||||
const char* schema_identifier() {
|
||||
return IfcSchema::Identifier;
|
||||
}
|
||||
@@ -459,4 +466,5 @@ private:
|
||||
ifcopenshell_log_stream.str("");
|
||||
return log;
|
||||
}
|
||||
%}
|
||||
%}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user