mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
More work
This commit is contained in:
@@ -78,6 +78,21 @@ namespace IfcUtil {
|
||||
virtual const IfcParse::entity& declaration() const = 0;
|
||||
|
||||
Argument* get(const std::string& name) const;
|
||||
|
||||
template <typename T>
|
||||
T get_value_or(const std::string& name, const T& if_null) const {
|
||||
auto arg = get(name);
|
||||
if (arg->isNull()) {
|
||||
return if_null;
|
||||
} else {
|
||||
return *arg;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T get_value(const std::string& name) const {
|
||||
return *get(name);
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: Investigate whether these should be template classes instead
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#define STRINGIFY_(x) #x
|
||||
#define STRINGIFY(x) STRINGIFY_(x)
|
||||
|
||||
#define MAKE_INIT_FN__(a, b) init_ ## a ## b
|
||||
#define MAKE_INIT_FN__(a, b) init_ ## a ## _ ## b
|
||||
#define MAKE_INIT_FN_(a, b) MAKE_INIT_FN__(a, b)
|
||||
#define MAKE_INIT_FN(t) MAKE_INIT_FN_(t, IfcSchema)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user