mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-18 03:19:53 +00:00
First slice plug-in refactor
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user