mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
ifcopenshell.file.from_string()
This commit is contained in:
@@ -59,3 +59,6 @@ class file(object):
|
|||||||
return self.wrapped_data.remove(inst.wrapped_data)
|
return self.wrapped_data.remove(inst.wrapped_data)
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(self[id] for id in self.wrapped_data.entity_names())
|
return iter(self[id] for id in self.wrapped_data.entity_names())
|
||||||
|
@staticmethod
|
||||||
|
def from_string(s):
|
||||||
|
return file(ifcopenshell_wrapper.read(s))
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public:
|
|||||||
/// attributes as a flat list. NB: includes the root instance specified
|
/// attributes as a flat list. NB: includes the root instance specified
|
||||||
/// in the first function argument.
|
/// in the first function argument.
|
||||||
IfcEntityList::ptr traverse(IfcUtil::IfcBaseClass* instance, int max_level=-1);
|
IfcEntityList::ptr traverse(IfcUtil::IfcBaseClass* instance, int max_level=-1);
|
||||||
|
|
||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
bool Init(const std::string& fn, bool mmap=false);
|
bool Init(const std::string& fn, bool mmap=false);
|
||||||
#else
|
#else
|
||||||
@@ -147,8 +147,6 @@ public:
|
|||||||
bool Init(std::istream& fn, int len);
|
bool Init(std::istream& fn, int len);
|
||||||
bool Init(void* data, int len);
|
bool Init(void* data, int len);
|
||||||
bool Init(IfcParse::IfcSpfStream* f);
|
bool Init(IfcParse::IfcSpfStream* f);
|
||||||
|
|
||||||
bool Init(const std::string& data, unsigned int unused);
|
|
||||||
|
|
||||||
IfcEntityList::ptr getInverse(int instance_id, IfcSchema::Type::Enum type, int attribute_index);
|
IfcEntityList::ptr getInverse(int instance_id, IfcSchema::Type::Enum type, int attribute_index);
|
||||||
|
|
||||||
@@ -176,4 +174,4 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -108,19 +108,6 @@ void init_locale() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IfcSpfStream::IfcSpfStream()
|
|
||||||
: stream(0)
|
|
||||||
, buffer(0)
|
|
||||||
, valid(false)
|
|
||||||
, eof(false)
|
|
||||||
{
|
|
||||||
ptr = 0;
|
|
||||||
len = 0;
|
|
||||||
valid = false;
|
|
||||||
eof = false;
|
|
||||||
size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Opens the file and gets the filesize
|
// Opens the file and gets the filesize
|
||||||
//
|
//
|
||||||
@@ -221,18 +208,6 @@ IfcSpfStream::IfcSpfStream(void* data, int l)
|
|||||||
len = l;
|
len = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcSpfStream::IfcSpfStream(const std::string& data, unsigned int x)
|
|
||||||
: stream(0)
|
|
||||||
, buffer(0)
|
|
||||||
{
|
|
||||||
eof = false;
|
|
||||||
size = (unsigned int) data.length();
|
|
||||||
buffer = data.c_str();
|
|
||||||
valid = true;
|
|
||||||
ptr = 0;
|
|
||||||
len = (unsigned int) data.length();
|
|
||||||
}
|
|
||||||
|
|
||||||
IfcSpfStream::~IfcSpfStream()
|
IfcSpfStream::~IfcSpfStream()
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
@@ -1252,17 +1227,16 @@ void IfcEntityInstanceData::setArgument(unsigned int i, Argument* a, IfcUtil::Ar
|
|||||||
// Parses the IFC file in fn
|
// Parses the IFC file in fn
|
||||||
// Creates the maps
|
// Creates the maps
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
bool IfcFile::Init(const std::string& fn, bool mmap) {
|
bool IfcFile::Init(const std::string& fn, bool mmap) {
|
||||||
return IfcFile::Init(new IfcSpfStream(fn, mmap));
|
return IfcFile::Init(new IfcSpfStream(fn, mmap));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
bool IfcFile::Init(const std::string& fn) {
|
bool IfcFile::Init(const std::string& fn) {
|
||||||
//return IfcFile::Init(new IfcSpfStream(fn, (unsigned int) 0));
|
|
||||||
return IfcFile::Init(new IfcSpfStream(fn));
|
return IfcFile::Init(new IfcSpfStream(fn));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool IfcFile::Init(std::istream& f, int len) {
|
bool IfcFile::Init(std::istream& f, int len) {
|
||||||
return IfcFile::Init(new IfcSpfStream(f,len));
|
return IfcFile::Init(new IfcSpfStream(f,len));
|
||||||
}
|
}
|
||||||
@@ -1270,10 +1244,6 @@ bool IfcFile::Init(std::istream& f, int len) {
|
|||||||
bool IfcFile::Init(void* data, int len) {
|
bool IfcFile::Init(void* data, int len) {
|
||||||
return IfcFile::Init(new IfcSpfStream(data,len));
|
return IfcFile::Init(new IfcSpfStream(data,len));
|
||||||
}
|
}
|
||||||
bool IfcFile::Init(const std::string& data, unsigned int unused) {
|
|
||||||
return IfcFile::Init(new IfcSpfStream(data, (unsigned int) 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool IfcFile::Init(IfcParse::IfcSpfStream* s) {
|
bool IfcFile::Init(IfcParse::IfcSpfStream* s) {
|
||||||
// Initialize a "C" locale for locale-independent
|
// Initialize a "C" locale for locale-independent
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ namespace IfcParse {
|
|||||||
bool valid;
|
bool valid;
|
||||||
bool eof;
|
bool eof;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
IfcSpfStream();
|
|
||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
IfcSpfStream(const std::string& fn, bool mmap=false);
|
IfcSpfStream(const std::string& fn, bool mmap=false);
|
||||||
#else
|
#else
|
||||||
@@ -62,7 +61,6 @@ namespace IfcParse {
|
|||||||
IfcSpfStream(std::istream& f, int len);
|
IfcSpfStream(std::istream& f, int len);
|
||||||
IfcSpfStream(void* data, int len);
|
IfcSpfStream(void* data, int len);
|
||||||
~IfcSpfStream();
|
~IfcSpfStream();
|
||||||
IfcSpfStream(const std::string& data, unsigned int x);
|
|
||||||
/// Returns the character at the cursor
|
/// Returns the character at the cursor
|
||||||
char Peek();
|
char Peek();
|
||||||
/// Returns the character at specified offset
|
/// Returns the character at specified offset
|
||||||
|
|||||||
Reference in New Issue
Block a user