First slice plug-in refactor

This commit is contained in:
Thomas Krijnen
2026-04-14 13:50:23 +02:00
parent 2018bcb3c1
commit aa10784154
31 changed files with 958 additions and 322 deletions
+26
View File
@@ -21,11 +21,13 @@
#define IFCSCHEMA_H
#include "exception.h"
#include "../plugin/plugin.h"
#include <algorithm>
#include <boost/algorithm/string.hpp>
#include <cctype>
#include <iterator>
#include <map>
#include <string>
#include <vector>
#include <optional>
@@ -497,6 +499,30 @@ class IFC_PARSE_API schema_definition {
const std::string& name() const { return name_; }
};
class IFC_PARSE_API schema_registry {
public:
typedef const schema_definition& (*get_schema_fn)();
typedef void (*clear_schema_fn)();
void bind(const std::string& schema_name, get_schema_fn get, clear_schema_fn clear, const plugin::module& module = plugin::module());
void bind(schema_definition* schema);
const schema_definition* get(const std::string& schema_name);
std::vector<std::string> names() const;
void clear();
private:
struct entry {
const schema_definition* schema_ = nullptr;
get_schema_fn get_ = nullptr;
clear_schema_fn clear_ = nullptr;
plugin::module module_;
};
std::map<std::string, entry> entries_;
};
IFC_PARSE_API schema_registry& schema_registry_instance();
IFC_PARSE_API const schema_definition* schema_by_name(const std::string& schema_name);
IFC_PARSE_API std::vector<std::string> schema_names();