void populateLayoutProperties(struct InputProperty inputProperty, struct LayoutProperties* layoutProperties, double ppi, const std::string& defaultUnits) { switch (inputProperty.name) { case MinHeight: (*layoutProperties).minHeight.valueType = _getValueType(inputProperty.value); (*layoutProperties).minHeight.value = _computeValue(inputProperty.value, (*layoutProperties).minHeight.valueType, ppi, defaultUnits); break; case MinWidth: (*layoutProperties).minWidth.valueType = _getValueType(inputProperty.value); (*layoutProperties).minWidth.value = _computeValue(inputProperty.value, (*layoutProperties).minWidth.valueType, ppi, defaultUnits); break; case Width: (*layoutProperties).width.valueType = _getValueType(inputProperty.value); (*layoutProperties).width.value = _computeValue(inputProperty.value, (*layoutProperties).width.valueType, ppi, defaultUnits); break; case Height: (*layoutProperties).height.valueType = _getValueType(inputProperty.value); (*layoutProperties).height.value = _computeValue(inputProperty.value, (*layoutProperties).height.valueType, ppi, defaultUnits); break; case Left: (*layoutProperties).left.valueType = _getValueType(inputProperty.value); (*layoutProperties).left.value = _computeValue(inputProperty.value, (*layoutProperties).left.valueType, ppi, defaultUnits); break; case CenterX: (*layoutProperties).centerX.valueType = _getValueType(inputProperty.value); (*layoutProperties).centerX.value = _computeValue(inputProperty.value, (*layoutProperties).centerX.valueType, ppi, defaultUnits); break; case CenterY: (*layoutProperties).centerY.valueType = _getValueType(inputProperty.value); (*layoutProperties).centerY.value = _computeValue(inputProperty.value, (*layoutProperties).centerY.valueType, ppi, defaultUnits); break; case Right: (*layoutProperties).right.valueType = _getValueType(inputProperty.value); (*layoutProperties).right.value = _computeValue(inputProperty.value, (*layoutProperties).right.valueType, ppi, defaultUnits); break; case Top: (*layoutProperties).top.valueType = _getValueType(inputProperty.value); (*layoutProperties).top.value = _computeValue(inputProperty.value, (*layoutProperties).top.valueType, ppi, defaultUnits); break; case Bottom: (*layoutProperties).bottom.valueType = _getValueType(inputProperty.value); (*layoutProperties).bottom.value = _computeValue(inputProperty.value, (*layoutProperties).bottom.valueType, ppi, defaultUnits); break; } }
float getDimensionValue(std::string value, double ppi) { ValueType type = _getValueType(value); return (float)_computeValue(value, type, ppi); }