Add a stream2_from_string() (mostly for wasm)

This commit is contained in:
Thomas Krijnen
2025-09-23 11:32:52 +02:00
parent b6abb24858
commit ab59173135
4 changed files with 54 additions and 2 deletions
+7
View File
@@ -708,6 +708,7 @@ private:
%newobject open;
%newobject read;
%newobject parse_ifcxml;
%newobject stream_from_string;
%inline %{
IfcParse::IfcFile* open(const std::string& fn, bool readonly=false) {
@@ -728,6 +729,12 @@ private:
return f;
}
IfcParse::InstanceStreamer* stream_from_string(const std::string& data) {
char* copiedData = new char[data.length()];
memcpy(copiedData, data.c_str(), data.length());
return new IfcParse::InstanceStreamer((void *)copiedData, data.length());
}
const char* version() {
return IFCOPENSHELL_VERSION;
}