return aRes;
}
+/*!
+ Returns 'true' if specified data exist.
+*/
+Standard_Boolean DDS_DicItem::HasData( const Standard_Integer flag ) const
+{
+ return ( myData & flag ) == flag;
+}
+
/*!
Parse record in XML file and retrieve information relevant for this data dic item
*/
else if ( aType.IsEqual( "Integer" ) )
aEnumType = Integer;
+ if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_MAXV" ) ).isNull() )
+ myData |= MinValue;
aMinV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_MINV" ) );
aMinV.RemoveAll( ' ' );
if ( aMinV.IsRealValue() )
aRealMinV = aMinV.RealValue();
+ if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_MAXV" ) ).isNull() )
+ myData |= MaxValue;
aMaxV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_MAXV" ) );
aMaxV.RemoveAll( ' ' );
if ( aMaxV.IsRealValue() )
aRealMaxV = aMaxV.RealValue();
aDefV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_DEFV" ) );
+ if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_DEFV" ) ).isNull() )
+ myData |= DefaultValue;
+
aDefV.RemoveAll( ' ' );
if ( aDefV.IsRealValue() )
aRealDefV = aDefV.RealValue();
{
public:
enum Type { String, Float, Integer, List, Unknown };
+ enum Data { MinValue = 0x01, MaxValue = 0x02, DefaultValue = 0x04 };
// This struct is intended for map of Format, Units, Precision and Scale
struct UnitData
Standard_EXPORT Standard_Real FromSI( const Standard_Real, const UnitSystem& ) const;
// convert value to and from default SI units according to current units
+ Standard_EXPORT Standard_Boolean HasData( const Standard_Integer ) const;
+
private:
DDS_DicItem( const DDS_DicItem& );
// Copy constructor
Standard_Real myDefValue;
TCollection_ExtendedString myDefString;
+ Standard_Integer myData;
+
// valueList
TCollection_ExtendedString myListName;
initDatum();
QString min;
- if ( !myDicItem.IsNull() )
- min = format( format(), type(), myDicItem->GetMinValue() );
+ if ( !myDicItem.IsNull() && myDicItem->HasData( DDS_DicItem::MinValue ) )
+ min = format( format(), type(), myDicItem->GetMinValue() );
return min;
}
initDatum();
QString max;
- if ( !myDicItem.IsNull() )
+ if ( !myDicItem.IsNull() && myDicItem->HasData( DDS_DicItem::MaxValue ) )
max = format( format(), type(), myDicItem->GetMaxValue() );
return max;
}
sb->setPrecision( aPreci );
sb->setLineStep( .1 );
- sb->setMinValue( minValue().toDouble() );
- sb->setMaxValue( maxValue().toDouble() );
+ sb->setMinValue( minValue().isEmpty() ? -DBL_MAX : minValue().toDouble() );
+ sb->setMaxValue( maxValue().isEmpty() ? DBL_MAX : maxValue().toDouble() );
}