mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
WIP
This commit is contained in:
+20
-58
@@ -65,79 +65,41 @@ class IFC_PARSE_API file_open_status {
|
||||
}
|
||||
};
|
||||
|
||||
typedef boost::variant<int, IfcUtil::IfcBaseClass*> reference_or_simple_type;
|
||||
typedef std::list<std::pair<MutableAttributeValue, boost::variant<reference_or_simple_type, std::vector<reference_or_simple_type>, std::vector<std::vector<reference_or_simple_type>>>>> unresolved_references;
|
||||
|
||||
struct parse_context {
|
||||
boost::variant<
|
||||
Blank,
|
||||
storage_t, // IFCWALL(x)
|
||||
std::vector<Token>, // IFCCARTESIANPOINT((x, y, z))
|
||||
std::vector<IfcUtil::IfcBaseClass*>, // IFCCARTESIANPOINT((IFCTEXT(), IFCTEXT()))
|
||||
std::list<parse_context> // IFCCARTESIANPOINTLIST3D(((x, y, z), (q, r, s)))
|
||||
> tokens;
|
||||
std::list<
|
||||
boost::variant<
|
||||
IfcUtil::IfcBaseClass*,
|
||||
Token,
|
||||
parse_context*
|
||||
>> tokens_;
|
||||
|
||||
parse_context() {};
|
||||
~parse_context();
|
||||
|
||||
parse_context(const parse_context&) = delete;
|
||||
parse_context& operator=(const parse_context&) = delete;
|
||||
|
||||
parse_context()
|
||||
: tokens(Blank{})
|
||||
{}
|
||||
parse_context(parse_context&&) = default;
|
||||
parse_context& operator=(parse_context&&) = default;
|
||||
|
||||
parse_context(storage_t&& instance_attribute_storage)
|
||||
: tokens(std::move(instance_attribute_storage))
|
||||
{}
|
||||
parse_context& push();
|
||||
|
||||
parse_context& push() {
|
||||
if (tokens.which() == 0) {
|
||||
// tokens = std::vector<Token>{};
|
||||
throw std::runtime_error("d");
|
||||
} else if (tokens.which() == 1) {
|
||||
throw std::runtime_error("e");
|
||||
} else if (tokens.which() == 2) {
|
||||
throw std::runtime_error("e");
|
||||
} else if (tokens.which() == 3) {
|
||||
if (boost::get<std::vector<Token>>(tokens).size() == 0) {
|
||||
tokens = std::list<parse_context>{};
|
||||
return push();
|
||||
} else {
|
||||
throw std::runtime_error("b");
|
||||
}
|
||||
} else if (tokens.which() == 4) {
|
||||
boost::get<std::list<parse_context>>(tokens).emplace_back();
|
||||
return boost::get<std::list<parse_context>>(tokens).back();
|
||||
}
|
||||
}
|
||||
void push(Token t);
|
||||
|
||||
void push(Token t) {
|
||||
if (tokens.which() == 1) {
|
||||
boost::get<std::vector<Token>>(tokens).push_back(t);
|
||||
} else if (tokens.which() == 3) {
|
||||
boost::get<std::list<parse_context>>(tokens).back().push(t);
|
||||
} else {
|
||||
throw std::runtime_error("a");
|
||||
}
|
||||
}
|
||||
void push(IfcUtil::IfcBaseClass* inst);
|
||||
|
||||
void push(IfcUtil::IfcBaseClass* inst) {
|
||||
if (tokens.which() == 2) {
|
||||
boost::get<std::vector<IfcUtil::IfcBaseClass*>>(tokens).push_back(inst);
|
||||
} else if (tokens.which() == 3) {
|
||||
boost::get<std::list<parse_context>>(tokens).back().push(inst);
|
||||
} else {
|
||||
throw std::runtime_error("a");
|
||||
}
|
||||
}
|
||||
void pop() {
|
||||
|
||||
}
|
||||
|
||||
storage_t&& data() {
|
||||
return std::move(boost::get<storage_t>(tokens));
|
||||
}
|
||||
IfcEntityInstanceData construct(int name, unresolved_references& references_to_resolve, const IfcParse::declaration* decl);
|
||||
};
|
||||
|
||||
/// This class provides several static convenience functions and variables
|
||||
/// and provide access to the entities in an IFC file
|
||||
class IFC_PARSE_API IfcFile {
|
||||
public:
|
||||
unresolved_references references_to_resolve;
|
||||
|
||||
typedef std::map<const IfcParse::declaration*, aggregate_of_instance::ptr> entities_by_type_t;
|
||||
typedef boost::unordered_map<unsigned int, IfcUtil::IfcBaseClass*> entity_by_id_t;
|
||||
typedef boost::unordered_map<uint32_t, IfcUtil::IfcBaseClass*> entity_by_iden_t;
|
||||
|
||||
Reference in New Issue
Block a user