Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.0 KiB
C++
Raw Permalink Normal View History

2018-03-04 10:43:40 +01:00
#define SCHEMA_METHOD
#include "../serializers/serializers_api.h"
2023-03-21 20:15:01 +01:00
#include "../ifcgeom/Serializer.h"
2018-03-04 10:43:40 +01:00
#include "../ifcparse/IfcFile.h"
#include <boost/function.hpp>
#include <map>
class SERIALIZERS_API XmlSerializer : public Serializer {
2018-03-16 16:04:48 +01:00
private:
XmlSerializer* implementation_;
2018-03-04 10:43:40 +01:00
2018-03-16 16:04:48 +01:00
protected:
std::string xml_filename;
public:
XmlSerializer(IfcParse::IfcFile* file, const std::string& xml_filename);
virtual ~XmlSerializer() {}
2018-03-04 10:43:40 +01:00
2018-03-16 16:04:48 +01:00
bool ready() { return true; }
void writeHeader() {}
2018-03-04 10:43:40 +01:00
2018-03-16 16:04:48 +01:00
void finalize() { implementation_->finalize(); }
void setFile(IfcParse::IfcFile*) { throw IfcParse::IfcException("Should be supplied on construction"); }
2018-03-04 10:43:40 +01:00
};
struct SERIALIZERS_API XmlSerializerFactory {
2018-03-16 16:04:48 +01:00
typedef boost::function2<XmlSerializer*, IfcParse::IfcFile*, std::string> fn;
2018-03-04 10:43:40 +01:00
class Factory : public std::map<std::string, fn> {
public:
Factory();
void bind(const std::string& schema_name, fn);
2018-03-16 16:04:48 +01:00
XmlSerializer* construct(const std::string& schema_name, IfcParse::IfcFile*, std::string);
2018-03-04 10:43:40 +01:00
};
2018-03-16 16:04:48 +01:00
static Factory& implementations();
2018-03-04 10:43:40 +01:00
};