-// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library 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 GNU
-// Lesser General Public License for more details.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// This library 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 GNU
+// Lesser General Public License for more details.
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "DDS_DicItem.h"
#include "DDS_Dictionary.h"
/*!
\class DDS_DicItem
-
- This class to provide information about datum (phisical characteristic parameter).
+ \brief This class provides an information about datum (phisical characteristic parameter).
*/
/*!
- Constructor. Creates the instance of empty dictionary item.
+ \brief Constructor.
+
+ Creates the instance of empty dictionary item.
*/
DDS_DicItem::DDS_DicItem()
: myType( 0 ),
-myDefValue( 0 ),
-myMax( 0 ),
-myMin( 0 ),
-myMinZoom( 0.1 ),
-myMaxZoom( 10 ),
-myZoomOrder( 2 )
+ myMax( 0 ),
+ myMin( 0 ),
+ myDefValue( 0 ),
+ myMinZoom( 0.1 ),
+ myMaxZoom( 10 ),
+ myZoomOrder( 2 )
{
}
/*!
- Copy constructor. Internal.
+ \brief Copy constructor (put in private section to prevent object copying).
*/
DDS_DicItem::DDS_DicItem( const DDS_DicItem& )
{
}
/*!
- Assignment operator. Internal.
+ \brief Assignment operator (put in private section to prevent object copying).
*/
void DDS_DicItem::operator=( const DDS_DicItem& )
{
}
/*!
- Gets the identifier of parameter.
+ \brief Get the identifier of parameter.
+ \return parameter ID
*/
TCollection_AsciiString DDS_DicItem::GetId() const
{
}
/*!
- Gets the type of parameter.
+ \brief Get the type of parameter.
+ \return parameter type
*/
DDS_DicItem::Type DDS_DicItem::GetType() const
{
}
/*!
- Gets the label of the parameter.
+ \brief Get the label of the parameter.
+ \return parameter label
*/
TCollection_ExtendedString DDS_DicItem::GetLabel() const
{
}
/*!
- Gets the filter (regular expression) for the parameter values.
+ \brief Get the filter (regular expression) for the parameter values.
+ \return parameter filter
*/
TCollection_ExtendedString DDS_DicItem::GetFilter() const
{
}
/*!
- Gets the Required attribute of the parameter.
+ \brief Get the Required attribute of the parameter.
+ \return Required attribute
*/
TCollection_ExtendedString DDS_DicItem::GetRequired() const
{
}
/*!
- Gets the wrong value warning level of the parameter.
+ \brief Get the wrong value warning level of the parameter.
+ \return warning level
*/
DDS_MsgType DDS_DicItem::GetWarningLevel() const
{
}
/*!
- Gets the long description of the parameter.
+ \brief Get the long description of the parameter.
+ \return long description
*/
TCollection_ExtendedString DDS_DicItem::GetLongDescription() const
{
}
/*!
- Gets the short description of the parameter.
+ \brief Get the short description of the parameter.
+ \return short description
*/
TCollection_ExtendedString DDS_DicItem::GetShortDescription() const
{
}
/*!
- Gets the name of component - owner of parameter.
+ \brief Get the name of the component (parameter owner).
+ \return component name
*/
TCollection_AsciiString DDS_DicItem::GetComponent() const
{
}
/*!
- Gets the parameter unit of measure for active unit system.
+ \brief Get the parameter measure units for active units system.
+ \return parameter units
*/
TCollection_AsciiString DDS_DicItem::GetUnits() const
{
}
/*!
- Gets the parameter unit of measure for specified unit system \atheSystem.
- If specified unit system doesn't exist then empty string returned.
+ \brief Get the parameter measure units for specified units system \a theSystem.
+
+ If specified units system doesn't exist, empty string is returned.
+
+ \param theSystem units system
+ \return parameter units
*/
TCollection_AsciiString DDS_DicItem::GetUnits( const UnitSystem& theSystem ) const
{
}
/*!
- Gets the minimum value of parameter for active unit system.
- Returned value converted to SI.
+ \brief Get the minimum value of the parameter for active units system.
+
+ Returned value is converted to SI.
+
+ \return minimum value
*/
Standard_Real DDS_DicItem::GetMinValue() const
{
}
/*!
- Gets the minimum value of parameter for specified unit system \atheSystem.
- Returned value converted to SI.
+ \brief Get the minimum value of the parameter for the specified
+ units system \a theSystem.
+
+ Returned value is converted to SI.
+
+ \param theUnitsSystem units system
+ \return minimum value
*/
Standard_Real DDS_DicItem::GetMinValue( const UnitSystem& theUnitsSystem ) const
{
}
/*!
- Gets the maximum value of parameter for active unit system.
+ \brief Get the maximum value of the parameter for active units system.
+
Returned value converted to SI.
+
+ \return maximum value
*/
Standard_Real DDS_DicItem::GetMaxValue() const
{
}
/*!
- Gets the maximum value of parameter for specified unit system \atheSystem.
+ \brief Get the maximum value of the parameter for specified
+ units system \a theSystem.
+
Returned value converted to SI.
+
+ \param theUnitsSystem units system
+ \return maximum value
*/
Standard_Real DDS_DicItem::GetMaxValue( const UnitSystem& theUnitsSystem ) const
{
}
/*!
- Gets the precision (number of digit after decimal point) of parameter for active unit system.
+ \brief Get the precision (number of digits after decimal point)
+ of the parameter for active units system.
+ \return parameter precision
*/
Standard_Integer DDS_DicItem::GetPrecision() const
{
}
/*!
- Gets the precision (number of digit after decimal point) of parameter for specified
- unit system \atheSystem. If specified unit system doesn't exist then zero returned.
+ \brief Get the precision (number of digits after decimal point) of the parameter
+ for specified units system \a theSystem.
+
+ If specified units system doesn't exist, zero is returned.
+
+ \param theSystem units system
+ \return parameter precision
*/
Standard_Integer DDS_DicItem::GetPrecision( const UnitSystem& theSystem ) const
{
}
/*!
- Gets the default value of parameter for active unit system. Default value returned as string.
- If type of value is numeric (Float or Integer) and default value defined then returned number
- converted to SI.
+ \brief Get the default value of the parameter for active units system.
+
+ Default value is returned as string.
+ If type of the value is numerical (Float or Integer) and default value
+ is defined, then the returning value is converted to SI.
+
+ \return default value
*/
TCollection_ExtendedString DDS_DicItem::GetDefaultValue() const
{
}
/*!
- Gets the default value of parameter for specified unit system \atheSystem. Default value returned
- as string. If type of value is numeric (Float or Integer) and default value defined then returned
- number converted to SI.
+ \brief Get the default value of the parameter for specified
+ units system \a theSystem.
+
+ Default value is returned as string.
+ If type of the value is numerical (Float or Integer) and default value
+ is defined, then the returning value is converted to SI.
+
+ \param theSystem units system
+ \return default value
*/
TCollection_ExtendedString DDS_DicItem::GetDefaultValue( const UnitSystem& theSystem ) const
{
}
/*!
- Gets the format string of parameter for active unit system. If argument \atheCanonical
- is true then format string will be reduced to sprintf() specification (without extra
- non standard qualifiers).
+ \brief Get the format string of the parameter for active units system.
+
+ If argument \a theCanonical is \c true, format string is reduced according
+ to the sprintf() specification (without extra non standard qualifiers).
+
+ \param theCanonical 'canonical form' flag
+ \return format string
*/
TCollection_AsciiString DDS_DicItem::GetFormat( const Standard_Boolean theCanonical ) const
{
}
/*!
- Gets the format string of parameter for specified unit system \atheSystem. If argument
- \atheCanonical is true then format string will be reduced to sprintf() specification
- (without extra non standard qualifiers).
+ \brief Get the format string of the parameter for specified
+ units system \a theSystem.
+
+ If argument \a theCanonical is \c true, format string is reduced according
+ to the sprintf() specification (without extra non standard qualifiers).
+
+ \param theSystem units system
+ \param theCanonical 'canonical form' flag
+ \return format string
*/
TCollection_AsciiString DDS_DicItem::GetFormat( const UnitSystem& theSystem,
const Standard_Boolean theCanonical ) const
}
/*!
- Gets name of a list referenced by the parameter. This string is empty if the list
- refernce is not defined - then use other properties: Type, DefaultValue, MaxValue, MinValue
+ \brief Get the name of a list referenced by the parameter.
+
+ This string is empty if the list reference is not defined.
+ In this case, other properties (Type, DefaultValue, MaxValue, MinValue)
+ should be used.
+
+ \return referenced list name
+ \sa GetListOfValues()
*/
TCollection_ExtendedString DDS_DicItem::GetNameOfValues() const
{
}
/*!
- Gets item names and item ids of a list referenced by the parameter. This sequences is empty if
- the list reference is not defined - then use other properties: Type, DefaultValue, MaxValue, MinValue
+ \brief Get item names and item identifiers of a list referenced
+ by the parameter.
+
+ These sequences are empty if the list reference is not defined.
+ In this case, other properties (Type, DefaultValue, MaxValue, MinValue)
+ should be used.
+
+ \param theStrings returning items names
+ \param theIntegers returning items identifiers
+ \return \c true if returning lists are not empty
+ \sa GetNameOfValues()
*/
Standard_Boolean DDS_DicItem::GetListOfValues( Handle(TColStd_HArray1OfExtendedString)& theStrings,
Handle(TColStd_HArray1OfInteger)& theIntegers ) const
}
/*!
- Gets item names, item ids and item icons of a list referenced by the parameter. This sequences is empty
- if the list reference is not defined - then use other properties: Type, DefaultValue, MaxValue, MinValue
+ \brief Get item names, item identifiers and item icons of a list
+ referenced by the parameter.
+
+ \overload
+
+ These sequences are empty if the list reference is not defined.
+ In this case, other properties (Type, DefaultValue, MaxValue, MinValue)
+ should be used.
+
+ \param theStrings returning items names
+ \param theIntegers returning items identifiers
+ \param theIcons returning items icons
+ \return \c true if returning lists are not empty
+ \sa GetNameOfValues()
*/
Standard_Boolean DDS_DicItem::GetListOfValues( Handle(TColStd_HArray1OfExtendedString)& theStrings,
Handle(TColStd_HArray1OfInteger)& theIntegers,
/*!
- Gets special values of the parameter.
+ \brief Get special values of the parameter.
+ \param theMap returning map of the special values
+ \return \c true if returning map is not empty
*/
Standard_Boolean DDS_DicItem::GetSpecialValues( TColStd_MapOfReal& theMap ) const
{
}
/*!
- Gets minimum value of lateral zooming
+ \brief Get minimum value of lateral zooming.
+ \return lateral zooming minimum value
*/
Standard_Real DDS_DicItem::GetMinZoom() const
{
}
/*!
- Gets maximum value of lateral zooming
+ \brief Get maximum value of lateral zooming.
+ \return lateral zooming maximum value
*/
Standard_Real DDS_DicItem::GetMaxZoom() const
{
}
/*!
- Gets order of lateral zooming
+ \brief Get order of lateral zooming.
+ \return lateral zooming order
*/
Standard_Real DDS_DicItem::GetZoomOrder() const
{
}
/*!
- Convert value \atheVal to default SI units according to active unit system.
+ \brief Convert value \a theVal to the default SI units
+ according to the active units system.
+ \param theVal value being converted
+ \return value converted to SI
*/
Standard_Real DDS_DicItem::ToSI( const Standard_Real theVal ) const
{
}
/*!
- Convert value \atheVal from default SI units according to active unit system.
+ \brief Convert value \a theVal from the default SI units
+ according to the active units system.
+ \param theVal value being converted
+ \return value converted from SI
*/
Standard_Real DDS_DicItem::FromSI( const Standard_Real theVal ) const
{
}
/*!
- Convert value to default SI units according to unit system \atheUnitsSystem.
+ \brief Convert value to the default SI units according to the
+ units system \a theUnitsSystem.
+ \param theVal value being converted
+ \param theUnitsSystem units system
+ \return value converted to the specified units system
*/
Standard_Real DDS_DicItem::ToSI( const Standard_Real theVal, const UnitSystem& theUnitsSystem ) const
{
}
/*!
- Convert value from default SI units according to unit system \atheUnitsSystem.
+ \brief Convert value from the default SI units according to the
+ units system \a theUnitsSystem.
+ \param theVal value being converted
+ \param theUnitsSystem units system
+ \return value converted from the specified units system
*/
Standard_Real DDS_DicItem::FromSI( const Standard_Real theVal, const UnitSystem& theUnitsSystem ) const
{
}
/*!
- Returns 'true' if data specified by \aflag exist.
+ \brief Check data existence.
+ \param flag data flag
+ \return \c true if data specified by \a flag exists
*/
Standard_Boolean DDS_DicItem::HasData( const Standard_Integer flag ) const
{
}
/*!
- Returns options for specified name \aname. If option not found then empty string returned.
+ \brief Get option for specified name \a name.
+
+ If option is not found, empty string is returned.
+
+ \param name option name
+ \return option value
*/
TCollection_ExtendedString DDS_DicItem::GetOption( const TCollection_AsciiString& name ) const
{
}
/*!
- Returns names list of existing options in the specified sequence \anames.
- If list not empty retunrs 'true' otherwise 'false'.
+ \brief Get names of all existing options.
+ \param names returning list of options
+ \return \c true if list is not empty
*/
Standard_Boolean DDS_DicItem::GetOptionNames( TColStd_SequenceOfAsciiString& names ) const
{
/*!
- Parse record in XML file and retrieve information relevant for this dictionary item
+ \brief Parse record from XML file and retrieve information relevant for
+ the dictionary item.
+ \param theID item identifier
+ \param theDatum datum XML node
+ \param theCompElement component XML node
+ \param theDocElement document XML node
+ \param theSystems units system names
*/
void DDS_DicItem::FillDataMap( TCollection_AsciiString theID, const LDOM_Element& theDatum,
const LDOM_Element& theCompElement, const LDOM_Element& theDocElement,
LDOM_Element anOpt = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "OPTIONS" ) );
if ( !anOpt.isNull() )
{
- LDOM_NodeList anOptions = anOpt.getElementsByTagName( DDS_Dictionary::KeyWord( "OPTION" ) );
+ LDOM_NodeList anOptions = anOpt.GetAttributesList();//anOpt.getElementsByTagName( DDS_Dictionary::KeyWord( "OPTION" ) );
for ( Standard_Integer oi = 0; oi < anOptions.getLength(); oi++ )
{
LDOM_Node node = anOptions.item( oi );
- if ( node.getNodeType() != LDOM_Node::ELEMENT_NODE )
- continue;
-
- LDOM_Element& elem = (LDOM_Element&)node;
- TCollection_AsciiString name = elem.getAttribute( DDS_Dictionary::KeyWord( "OPTION_NAME" ) );
+ LDOM_Node::NodeType t = node.getNodeType();
+ TCollection_AsciiString name;
TCollection_ExtendedString value;
- const LDOM_Node aNode = elem.getFirstChild();
- LDOM_Text anOptTxt( (const LDOM_Text&)(aNode) );
- if ( !anOptTxt.isNull() )
- value = anOptTxt.getData();
+
+ if( t==LDOM_Node::ELEMENT_NODE )
+ {
+ const LDOM_Element& elem = ( const LDOM_Element& )node;
+ name = elem.getAttribute( DDS_Dictionary::KeyWord( "OPTION_NAME" ) );
+
+ const LDOM_Node aNode = elem.getFirstChild();
+ LDOM_Text anOptTxt( (const LDOM_Text&)(aNode) );
+ if ( !anOptTxt.isNull() )
+ value = anOptTxt.getData();
+ }
+ else if( t==LDOM_Node::ATTRIBUTE_NODE )
+ {
+ const LDOM_Attr& attr = ( const LDOM_Attr& )node;
+ name = ( Standard_CString )attr.getName().GetString();
+ LDOMString v = attr.getValue();
+ if( v.Type()==LDOMBasicString::LDOM_Integer )
+ {
+ Standard_Integer ival;
+ v.GetInteger( ival );
+ value = TCollection_ExtendedString( ival );
+ }
+ else
+ value = ( Standard_CString )v.GetString();
+ }
+ else
+ continue;
if ( !name.IsEmpty() && value.Length() && !myOptions.IsBound( name ) )
myOptions.Bind( name, value );
}
/*!
- Returns default formats for each unit systems
+ \brief Restore default formats for all the units systems.
*/
void DDS_DicItem::GetDefaultFormat()
{
}
/*!
- Returns format for the string
+ \brief Get format for the string.
+ \param theFlags format flags
+ \param theWidth field width
+ \param thePrecision precision
+ \param theTypePrefix type prefix
+ \param theFormat returning format string
*/
void DDS_DicItem::GetStringFormat( const TCollection_AsciiString& theFlags,
const TCollection_AsciiString& theWidth,
}
/*!
- Returns format for the integer
+ \brief Get format for the integer.
+ \param theFlags format flags
+ \param theWidth field width
+ \param thePrecision precision
+ \param theTypePrefix type prefix
+ \param theType integer value type
+ \param theFormat returning format string
*/
void DDS_DicItem::GetIntegerFormat( const TCollection_AsciiString& theFlags,
const TCollection_AsciiString& theWidth,
}
/*!
- Returns format for the float
+ \brief Returns format for the float.
+ \param theFlags format flags
+ \param theWidth field width
+ \param thePrecision precision
+ \param theTypePrefix type prefix
+ \param theType floating point value type
+ \param theFormat returning format string
*/
void DDS_DicItem::GetFloatFormat( const TCollection_AsciiString& theFlags,
const TCollection_AsciiString& theWidth,
}
/*!
- Prepares formats for each unit systems
+ \brief Prepare formats for all units systems.
+ \param theFormat format string
*/
-void DDS_DicItem::PrepareFormats( const TCollection_AsciiString& theFormat )
+void DDS_DicItem::PrepareFormats( const TCollection_AsciiString& theFormat )
{
for ( NCollection_DataMap<UnitSystem, UnitData>::Iterator it( myUnitData ); it.More(); it.Next() )
{
}
/*!
- Split the string \atheStr by spaces and returns substrings in array \aaRes.
+ \brief Split the string \a theStr separated by spaces.
+ \param theStr source string
+ \param aRes returning substrings array
*/
void DDS_DicItem::Split( const TCollection_AsciiString& theStr, Handle(TColStd_HArray1OfExtendedString)& aRes )
{
}
/*!
- Returns unit structure for given unit system \asys.
+ \brief Get units structure for specified units system \a sys.
+ \param sys units system
+ \return units system information structure
*/
DDS_DicItem::UnitData* DDS_DicItem::GetUnitData( const UnitSystem& sys ) const
{
}
/*!
- Gets the active unit system.
+ \brief Get the active units system.
+ \return active units system
*/
DDS_DicItem::UnitSystem DDS_DicItem::GetActiveUnitSystem() const
{