From ee81bd1e767ac895a93ed55c7514c23d5bb929b0 Mon Sep 17 00:00:00 2001 From: stv Date: Thu, 29 Dec 2005 14:27:26 +0000 Subject: [PATCH] Search item referenced list in the component. If not found then list searched in the dictionary. --- src/DDS/DDS_DicGroup.cxx | 2 +- src/DDS/DDS_DicItem.cxx | 56 ++++++++++++++++++++++++---------------- src/DDS/DDS_DicItem.h | 4 +-- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/src/DDS/DDS_DicGroup.cxx b/src/DDS/DDS_DicGroup.cxx index 59db1f52f..ac7f4ad6b 100644 --- a/src/DDS/DDS_DicGroup.cxx +++ b/src/DDS/DDS_DicGroup.cxx @@ -110,7 +110,7 @@ void DDS_DicGroup::FillDataMap( const LDOM_Element& theComponentData, const LDOM Handle(DDS_DicItem) aDicItem = new DDS_DicItem(); aDicItem->myComponent = this; - aDicItem->FillDataMap( anID, aQuantity, theComponentData, unitSystems ); + aDicItem->FillDataMap( anID, aQuantity, theComponentData, theDocElement, unitSystems ); myDataMap.Add( anID, aDicItem ); } } diff --git a/src/DDS/DDS_DicItem.cxx b/src/DDS/DDS_DicItem.cxx index 68e19dfd2..fd59f3cd6 100644 --- a/src/DDS/DDS_DicItem.cxx +++ b/src/DDS/DDS_DicItem.cxx @@ -309,7 +309,8 @@ Standard_Real DDS_DicItem::FromSI( const Standard_Real theVal, const UnitSystem& Parse record in XML file and retrieve information relevant for this data dic item */ void DDS_DicItem::FillDataMap( TCollection_AsciiString theID, const LDOM_Element& theDatum, - const LDOM_Element& theDocElement, const TColStd_SequenceOfAsciiString& theSystems ) + const LDOM_Element& theCompElement, const LDOM_Element& theDocElement, + const TColStd_SequenceOfAsciiString& theSystems ) { TCollection_AsciiString aLabel = theDatum.getAttribute( DDS_Dictionary::KeyWord( "DATUM_LABEL" ) ); TCollection_AsciiString aFormat = theDatum.getAttribute( DDS_Dictionary::KeyWord( "DATUM_FORMAT" ) ); @@ -462,32 +463,43 @@ void DDS_DicItem::FillDataMap( TCollection_AsciiString theID, const LDOM_Element LDOMString aListId = aListRef.getAttribute( DDS_Dictionary::KeyWord( "VLR_LIST" ) ); aDefV = aListRef.getAttribute( DDS_Dictionary::KeyWord( "VD_DEFV" ) ); aDefV.RemoveAll( ' ' ); - for ( LDOM_Element aListItem = theDocElement.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST" ) ); - aListItem != NULL; aListItem = aListItem.GetSiblingByTagName() ) + LDOM_Element foundListItem; + for ( LDOM_Element aListItem = theCompElement.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST" ) ); + aListItem != NULL && foundListItem == NULL; aListItem = aListItem.GetSiblingByTagName() ) { if ( aListItem.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_ID" ) ).equals( aListId ) ) + foundListItem = aListItem; + + } + for ( LDOM_Element aLstItem = theDocElement.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST" ) ); + aLstItem != NULL && foundListItem == NULL; aLstItem = aLstItem.GetSiblingByTagName() ) + { + if ( aLstItem.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_ID" ) ).equals( aListId ) ) + foundListItem = aLstItem; + } + + if ( foundListItem != NULL ) + { + // The appropriate list of values is found: store the list name + aListName = foundListItem.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_NAME" ) ); + // Iteration through the list of values + LDOM_Element aListItemValue = foundListItem.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUE" ) ); + while ( aListItemValue != NULL ) { - // The appropriate list of values is found: store the list name - aListName = aListItem.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_NAME" ) ); - // Iteration through the list of values - LDOM_Element aListItemValue = aListItem.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUE" ) ); - while ( aListItemValue != NULL ) + // read value ID + TCollection_AsciiString aListValueID = aListItemValue.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUEID" ) ); + if ( aListValueID.IsIntegerValue() ) { - // read value ID - TCollection_AsciiString aListValueID = aListItemValue.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUEID" ) ); - if ( aListValueID.IsIntegerValue() ) + // Read the text in the element "value" + LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild(); + if ( !aListItemTxt.isNull() ) { - // Read the text in the element "value" - LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild(); - if ( !aListItemTxt.isNull() ) - { - // adding ID and text value to sequence - aSeqOfValueID.Append( aListValueID.IntegerValue() ); - aSeqOfValue.Append( aListItemTxt.getData() ); - // adding icon file name (optional) to sequence - TCollection_ExtendedString aListValueIcon = aListItemValue.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUEICON" ) ); - aSeqOfValueIconName.Append( aListValueIcon ); - } + // adding ID and text value to sequence + aSeqOfValueID.Append( aListValueID.IntegerValue() ); + aSeqOfValue.Append( aListItemTxt.getData() ); + // adding icon file name (optional) to sequence + TCollection_ExtendedString aListValueIcon = aListItemValue.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUEICON" ) ); + aSeqOfValueIconName.Append( aListValueIcon ); } aListItemValue = aListItemValue.GetSiblingByTagName(); } diff --git a/src/DDS/DDS_DicItem.h b/src/DDS/DDS_DicItem.h index d57eaf068..871149407 100644 --- a/src/DDS/DDS_DicItem.h +++ b/src/DDS/DDS_DicItem.h @@ -141,8 +141,8 @@ private: void operator=( const DDS_DicItem& ); // Assignment operator - void FillDataMap( TCollection_AsciiString, - const LDOM_Element&,const LDOM_Element&, + void FillDataMap( TCollection_AsciiString, const LDOM_Element&, + const LDOM_Element&, const LDOM_Element&, const TColStd_SequenceOfAsciiString& ); // prepares formants for each unit systems -- 2.39.2