Salome HOME
Copyright update 2022
[modules/gui.git] / src / DDS / DDS_DicItem.cxx
index 6a8954546c2fe97cab83b5d3d50996816d0b6968..b38bb1d4001d525b62ad545b41b8dc55848951ea 100644 (file)
@@ -1,30 +1,28 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  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.
+// 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, or (at your option) any later version.
 //
-//  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 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.
 //
-//  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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #include "DDS_DicItem.h"
 #include "DDS_Dictionary.h"
 
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TColStd_SequenceOfExtendedString.hxx>
-
 #include <LDOM_Text.hxx>
 #include <LDOMString.hxx>
 #include <LDOM_Element.hxx>
 #include <UnitsAPI.hxx>
 #include <Units_Dimensions.hxx>
 
-#include <TColStd_MapOfReal.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-
-IMPLEMENT_STANDARD_HANDLE(DDS_DicItem, MMgt_TShared)
-IMPLEMENT_STANDARD_RTTIEXT(DDS_DicItem, MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(DDS_DicItem, Standard_Transient)
 
 /*!
   \class DDS_DicItem
@@ -63,6 +57,7 @@ DDS_DicItem::DDS_DicItem()
   \brief Copy constructor (put in private section to prevent object copying).
 */
 DDS_DicItem::DDS_DicItem( const DDS_DicItem& )
+: Standard_Transient()
 {
 }
 
@@ -199,7 +194,7 @@ Standard_Real DDS_DicItem::GetMinValue() const
 /*!
   \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
@@ -774,9 +769,9 @@ void DDS_DicItem::FillDataMap( TCollection_AsciiString theID, const LDOM_Element
             {
               //  Read the text in the element "value"
               //LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild();
-             LDOM_Node aNode = aListItemValue.getFirstChild();
-             const LDOM_Text& aText = (const LDOM_Text&) aNode;
-             LDOM_Text aListItemTxt(aText);
+              LDOM_Node aNode = aListItemValue.getFirstChild();
+              const LDOM_Text& aText = (const LDOM_Text&) aNode;
+              LDOM_Text aListItemTxt(aText);
               if ( !aListItemTxt.isNull() )
               {
                 // adding ID and text value to sequence
@@ -855,12 +850,12 @@ void DDS_DicItem::FillDataMap( TCollection_AsciiString theID, const LDOM_Element
         LDOMString v = attr.getValue();
         if( v.Type()==LDOMBasicString::LDOM_Integer )
         {
-               Standard_Integer ival;
-               v.GetInteger( ival );
-               value = TCollection_ExtendedString( ival );
+                Standard_Integer ival;
+                v.GetInteger( ival );
+                value = TCollection_ExtendedString( ival );
         }
         else
-               value = ( Standard_CString )v.GetString();
+                value = ( Standard_CString )v.GetString();
       }
       else
         continue;
@@ -894,7 +889,7 @@ void DDS_DicItem::FillDataMap( TCollection_AsciiString theID, const LDOM_Element
       else if ( anUnitData.myUnits.ToCString()[0] ) // treat '%' as unit with scale 100
         anUnitData.myScale = 0.01;
     }
-         catch( Standard_Failure ) {
+    catch( Standard_Failure& ) {
       anUnitData.myUnits.Clear();
     }
 
@@ -1290,3 +1285,188 @@ DDS_DicItem::UnitSystem DDS_DicItem::GetActiveUnitSystem() const
     aSystem = aComponent->GetActiveUnitSystem();
   return aSystem;
 }
+
+/*!
+  \brief Set item's identify string.
+  \param theId identify string.
+*/
+void DDS_DicItem::SetId( const TCollection_AsciiString& theId )
+{
+  myId = theId;
+}
+
+/*!
+  \brief Set item's component pointer.
+  \param theComponent component pointer.
+*/
+void DDS_DicItem::SetComponent( const Handle(Standard_Transient)& theComponent )
+{
+  myComponent = theComponent;
+}
+
+/*!
+  \brief Set item's label string.
+  \param theLabel label string.
+*/
+void DDS_DicItem::SetLabel( const TCollection_AsciiString& theLabel )
+{
+  myLabel = theLabel;
+}
+
+/*!
+  \brief Set item's filter string.
+  \param theFilter filter string.
+*/
+void DDS_DicItem::SetFilter( const TCollection_AsciiString& theFilter )
+{
+  myFilter = theFilter;
+}
+
+/*!
+  \brief Set item's required value.
+  \param theRequired required value string.
+*/
+void DDS_DicItem::SetRequired( const TCollection_AsciiString& theRequired )
+{
+  myRequired = theRequired;
+}
+
+/*!
+  \brief Set item's warning level value.
+  \param theWarningLevel warning level value.
+*/
+void DDS_DicItem::SetWarningLevel( const Standard_Integer& theWarningLevel )
+{
+  myWarnLevel = theWarningLevel;
+}
+
+/*!
+  \brief Set item's minimum zoom value.
+  \param theMinZoom minimum zoom value.
+*/
+void DDS_DicItem::SetMinZoom( const Standard_Real& theMinZoom )
+{
+  myMinZoom = theMinZoom;
+}
+
+/*!
+  \brief Set item's maximum zoom value.
+  \param theMaxZoom maximum zoom value.
+*/
+void DDS_DicItem::SetMaxZoom( const Standard_Real& theMaxZoom )
+{
+  myMaxZoom = theMaxZoom;
+}
+
+/*!
+  \brief Set item's zoom order value.
+  \param theZoomOrder zoom order value.
+*/
+void DDS_DicItem::SetZoomOrder( const Standard_Real& theZoomOrder )
+{
+  myZoomOrder = theZoomOrder;
+}
+
+/*!
+  \brief Set item's short description.
+  \param theShortDescr short description string.
+*/
+void DDS_DicItem::SetShortDescription( const TCollection_ExtendedString& theShortDescr )
+{
+  myShortDescr = theShortDescr;
+}
+
+/*!
+  \brief Set item's long description.
+  \param theLongDescr long description string.
+*/
+void DDS_DicItem::SetLongDescription( const TCollection_ExtendedString& theLongDescr )
+{
+  myLongDescr = theLongDescr;
+}
+
+/*!
+  \brief Add item's option.
+  \param theOptionName option name string.
+  \param theOptionValue option value string.
+*/
+bool DDS_DicItem::SetOption( const TCollection_AsciiString& theOptionName,
+                             const TCollection_AsciiString& theOptionValue )
+{
+  return myOptions.Bind( theOptionName, theOptionValue );
+}
+
+/*!
+  \brief Set item's type value.
+  \param theType item value type.
+*/
+void DDS_DicItem::SetType( const DDS_DicItem::Type& theType )
+{
+  myType = theType;
+}
+
+/*!
+  \brief Set item's minimum value.
+  \param theMinVal minimum possible value.
+*/
+void DDS_DicItem::SetMin( const Standard_Real& theMinVal )
+{
+  myData |= MinValue;
+  myMin = theMinVal;
+}
+
+/*!
+  \brief Set item's maximum value.
+  \param theMaxVal maximum possible value.
+*/
+void DDS_DicItem::SetMax( const Standard_Real& theMaxVal )
+{
+  myData |= MaxValue;
+  myMax = theMaxVal;
+}
+
+/*!
+  \brief Set item's default value as a real number.
+  \param theDefVal default value.
+*/
+void DDS_DicItem::SetDefaultValue( const Standard_Real& theDefVal )
+{
+  myData |= DefaultValue;
+  myDefValue = theDefVal;
+}
+
+/*!
+  \brief Set item's default value as a string.
+  \param theDefStr default value.
+*/
+void DDS_DicItem::SetDefaultValue( const TCollection_AsciiString& theDefStr )
+{
+  myDefString = theDefStr;
+}
+
+/*!
+  \brief Set item's value list.
+  \param theStrings list of value strings.
+  \param theIntegers list of integer values associated with string item.
+*/
+void DDS_DicItem::SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)& theStrings,
+                                   const Handle(TColStd_HArray1OfInteger)& theIntegers )
+{
+  myListRef   = theStrings;
+  myListRefID = theIntegers;
+}
+
+/*!
+  \brief Set item's value list and icons.
+  \param theStrings list of value strings.
+  \param theIntegers list of integer values associated with string item.
+  \param theIcons list of icons associated with string item.
+*/
+void DDS_DicItem::SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)& theStrings,
+                                   const Handle(TColStd_HArray1OfInteger)& theIntegers,
+                                   const Handle(TColStd_HArray1OfExtendedString)& theIcons )
+{
+  myListRef      = theStrings;
+  myListRefID    = theIntegers;
+  myListRefIcons = theIcons;
+}