mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
Mark settings as internal #6623
This commit is contained in:
@@ -40,7 +40,7 @@ namespace ifcopenshell {
|
|||||||
struct HasDefault<T, decltype((void)T::defaultvalue, 0)> : std::true_type { };
|
struct HasDefault<T, decltype((void)T::defaultvalue, 0)> : std::true_type { };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename Derived, typename T>
|
template <typename Derived, typename T, bool Internal=false>
|
||||||
struct SettingBase {
|
struct SettingBase {
|
||||||
typedef T base_type;
|
typedef T base_type;
|
||||||
|
|
||||||
@@ -61,7 +61,9 @@ namespace ifcopenshell {
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if constexpr (std::is_same_v<T, bool>) {
|
if constexpr (Internal) {
|
||||||
|
// do nothing, this is an internal setting and not supposed to be set from the command line
|
||||||
|
} else if constexpr (std::is_same_v<T, bool>) {
|
||||||
// @todo bool_switch doesn't work with optional unfortunately...
|
// @todo bool_switch doesn't work with optional unfortunately...
|
||||||
value.emplace();
|
value.emplace();
|
||||||
desc.add_options()(Derived::name, apply_default(po::bool_switch(&*value)), Derived::description);
|
desc.add_options()(Derived::name, apply_default(po::bool_switch(&*value)), Derived::description);
|
||||||
@@ -120,19 +122,19 @@ namespace ifcopenshell {
|
|||||||
static constexpr bool defaultvalue = false;
|
static constexpr bool defaultvalue = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LengthUnit : public SettingBase<LengthUnit, double> {
|
struct LengthUnit : public SettingBase<LengthUnit, double, true> {
|
||||||
static constexpr const char* const name = "length-unit";
|
static constexpr const char* const name = "length-unit";
|
||||||
static constexpr const char* const description = "";
|
static constexpr const char* const description = "";
|
||||||
static constexpr double defaultvalue = 1.0;
|
static constexpr double defaultvalue = 1.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PlaneUnit : public SettingBase<PlaneUnit, double> {
|
struct PlaneUnit : public SettingBase<PlaneUnit, double, true> {
|
||||||
static constexpr const char* const name = "angle-unit";
|
static constexpr const char* const name = "angle-unit";
|
||||||
static constexpr const char* const description = "";
|
static constexpr const char* const description = "";
|
||||||
static constexpr double defaultvalue = 1.0;
|
static constexpr double defaultvalue = 1.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Precision : public SettingBase<Precision, double> {
|
struct Precision : public SettingBase<Precision, double, true> {
|
||||||
static constexpr const char* const name = "precision";
|
static constexpr const char* const name = "precision";
|
||||||
static constexpr const char* const description = "";
|
static constexpr const char* const description = "";
|
||||||
static constexpr double defaultvalue = 0.00001;
|
static constexpr double defaultvalue = 0.00001;
|
||||||
|
|||||||
Reference in New Issue
Block a user