###############################################################################
# #
# This file is part of IfcOpenShell. #
# #
# IfcOpenShell is free software: you can redistribute it and/or modify #
# it under the terms of the Lesser GNU General Public License as published by #
# the Free Software Foundation, either version 3.0 of the License, or #
# (at your option) any later version. #
# #
# IfcOpenShell is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# Lesser GNU General Public License for more details. #
# #
# You should have received a copy of the Lesser GNU General Public License #
# along with this program. If not, see . #
# #
###############################################################################
header = """
#ifndef %(schema_name_upper)s_H
#define %(schema_name_upper)s_H
#include
#include
#include
#include "../ifcparse/ifc_parse_api.h"
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcException.h"
#include "../ifcparse/%(schema_name)senum.h"
#define IfcSchema %(schema_name)s
namespace %(schema_name)s {
const char* const Identifier = "%(schema_name_upper)s";
// Forward definitions
%(forward_definitions)s
%(declarations)s
%(class_definitions)s
void InitStringMap();
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
}
#endif
"""
enum_header = """
#ifndef %(schema_name_upper)sENUM_H
#define %(schema_name_upper)sENUM_H
#include "../ifcparse/ifc_parse_api.h"
#include
#define IfcSchema %(schema_name)s
namespace %(schema_name)s {
namespace Type {
typedef enum {
%(types)s, UNDEFINED
} Enum;
IFC_PARSE_API boost::optional Parent(Enum v);
IFC_PARSE_API Enum FromString(const std::string& s);
IFC_PARSE_API std::string ToString(Enum v);
IFC_PARSE_API bool IsSimple(Enum v);
}
}
#endif
"""
lb_header = """
#ifndef %(schema_name_upper)sRT_H
#define %(schema_name_upper)sRT_H
#define IfcSchema %(schema_name)s
#include "../ifcparse/ifc_parse_api.h"
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/IfcEntityDescriptor.h"
#include "../ifcparse/IfcWritableEntity.h"
namespace %(schema_name)s {
namespace Type {
IFC_PARSE_API int GetAttributeCount(Enum t);
IFC_PARSE_API int GetAttributeIndex(Enum t, const std::string& a);
IFC_PARSE_API IfcUtil::ArgumentType GetAttributeType(Enum t, unsigned char a);
IFC_PARSE_API Enum GetAttributeEntity(Enum t, unsigned char a);
IFC_PARSE_API const std::string& GetAttributeName(Enum t, unsigned char a);
IFC_PARSE_API bool GetAttributeOptional(Enum t, unsigned char a);
IFC_PARSE_API bool GetAttributeDerived(Enum t, unsigned char a);
IFC_PARSE_API std::pair GetEnumerationIndex(Enum t, const std::string& a);
IFC_PARSE_API std::pair GetInverseAttribute(Enum t, const std::string& a);
IFC_PARSE_API std::set GetInverseAttributeNames(Enum t);
IFC_PARSE_API void PopulateDerivedFields(IfcWrite::IfcWritableEntity* e);
}}
#endif
"""
implementation= """
#include "../ifcparse/%(schema_name)s.h"
#include "../ifcparse/IfcException.h"
#include "../ifcparse/IfcWrite.h"
#include "../ifcparse/IfcWritableEntity.h"
#include