ifcopenshell.file.from_string() (#246)

This commit is contained in:
Luke Brooks
2017-08-22 09:15:02 +01:00
committed by Thomas Krijnen
parent 475b8554a8
commit 08522c9fd7
4 changed files with 49 additions and 7 deletions
+12 -4
View File
@@ -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;
}
%}
%}