1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
28 #include <MMgt_TShared.hxx>
30 #include <TCollection_AsciiString.hxx>
32 #include <TColStd_HArray1OfInteger.hxx>
33 #include <TColStd_HArray1OfExtendedString.hxx>
35 #include <NCollection_DataMap.hxx>
36 #include <NCollection_DefineIndexedDataMap.hxx>
40 class TColStd_MapOfReal;
41 class TColStd_SequenceOfInteger;
42 class TColStd_SequenceOfAsciiString;
43 class TColStd_SequenceOfExtendedString;
45 // Class, containing all information about one parameter:
47 // obligative: label, type, short description, required
48 // optional : format, units,
49 // min value, max value, default value.
51 class DDS_DicItem : public MMgt_TShared
54 /*! Enum describes type of datum value */
57 String, //!< String type of value
58 Float, //!< Real (double) numeric type of value
59 Integer, //!< Integer (int) numeric type of value
60 List, //!< List type of enumerable value
61 Unknown //!< Unknown or undefined type of value
64 /*! Enum describes the flags for existance of domain data */
67 MinValue = 0x01, //!< Flag of minimum value definition existence
68 MaxValue = 0x02, //!< Flag of maximum value definition existence
69 DefaultValue = 0x04 //!< Flag of default value definition existence
72 // This struct is intended for map of Format, Units, Precision and Scale
76 Standard_Real myScale;
77 TCollection_AsciiString myUnits;
78 TCollection_AsciiString myFormat;
79 Standard_Integer myPrecision;
82 typedef TCollection_AsciiString UnitSystem;
85 Standard_EXPORT DDS_DicItem();
87 Standard_EXPORT TCollection_AsciiString GetId() const;
88 Standard_EXPORT DDS_DicItem::Type GetType() const;
89 Standard_EXPORT TCollection_ExtendedString GetLabel() const;
90 Standard_EXPORT TCollection_ExtendedString GetFilter() const;
91 Standard_EXPORT TCollection_ExtendedString GetRequired() const;
92 Standard_EXPORT DDS_MsgType GetWarningLevel() const;
93 Standard_EXPORT TCollection_ExtendedString GetLongDescription() const;
94 Standard_EXPORT TCollection_ExtendedString GetShortDescription() const;
95 Standard_EXPORT TCollection_AsciiString GetComponent() const;
97 Standard_EXPORT virtual TCollection_AsciiString GetUnits() const;
98 Standard_EXPORT virtual TCollection_AsciiString GetUnits( const UnitSystem& ) const;
100 Standard_EXPORT TCollection_ExtendedString GetDefaultValue() const;
101 Standard_EXPORT TCollection_ExtendedString GetDefaultValue( const UnitSystem& ) const;
103 Standard_EXPORT Standard_Real GetMinValue() const;
104 Standard_EXPORT Standard_Real GetMinValue( const UnitSystem& ) const;
106 Standard_EXPORT Standard_Real GetMaxValue() const;
107 Standard_EXPORT Standard_Real GetMaxValue( const UnitSystem& ) const;
109 Standard_EXPORT virtual Standard_Integer GetPrecision() const;
110 Standard_EXPORT virtual Standard_Integer GetPrecision( const UnitSystem& ) const;
112 Standard_EXPORT virtual TCollection_AsciiString GetFormat( const Standard_Boolean = Standard_True ) const;
113 Standard_EXPORT virtual TCollection_AsciiString GetFormat( const UnitSystem&,
114 const Standard_Boolean = Standard_True ) const;
115 Standard_EXPORT TCollection_ExtendedString GetNameOfValues() const;
116 Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&,
117 Handle(TColStd_HArray1OfInteger)& ) const;
118 Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&,
119 Handle(TColStd_HArray1OfInteger)&,
120 Handle(TColStd_HArray1OfExtendedString)& ) const;
121 Standard_EXPORT Standard_Boolean GetSpecialValues( TColStd_MapOfReal& ) const;
123 Standard_EXPORT Standard_Real GetMinZoom() const;
124 Standard_EXPORT Standard_Real GetMaxZoom() const;
125 Standard_EXPORT Standard_Real GetZoomOrder() const;
127 Standard_EXPORT virtual Standard_Real ToSI( const Standard_Real ) const;
128 Standard_EXPORT virtual Standard_Real FromSI( const Standard_Real ) const;
130 Standard_EXPORT virtual Standard_Real ToSI( const Standard_Real, const UnitSystem& ) const;
131 Standard_EXPORT virtual Standard_Real FromSI( const Standard_Real, const UnitSystem& ) const;
133 Standard_EXPORT Standard_Boolean HasData( const Standard_Integer ) const;
135 Standard_EXPORT TCollection_ExtendedString GetOption( const TCollection_AsciiString& ) const;
136 Standard_EXPORT Standard_Boolean GetOptionNames( TColStd_SequenceOfAsciiString& ) const;
140 Standard_EXPORT void SetId( const TCollection_AsciiString& );
142 Standard_EXPORT void SetComponent( const Handle(Standard_Transient)& );
144 Standard_EXPORT void SetLabel( const TCollection_AsciiString& );
146 Standard_EXPORT void SetFilter( const TCollection_AsciiString& );
148 Standard_EXPORT void SetRequired( const TCollection_AsciiString& );
150 Standard_EXPORT void SetWarningLevel( const Standard_Integer& );
152 Standard_EXPORT void SetMinZoom( const Standard_Real& );
153 Standard_EXPORT void SetMaxZoom( const Standard_Real& );
154 Standard_EXPORT void SetZoomOrder( const Standard_Real& );
156 Standard_EXPORT void SetShortDescription( const TCollection_ExtendedString& );
157 Standard_EXPORT void SetLongDescription( const TCollection_ExtendedString& );
159 Standard_EXPORT bool SetOption( const TCollection_AsciiString&, const TCollection_AsciiString& );
160 Standard_EXPORT void SetType( const DDS_DicItem::Type& );
162 Standard_EXPORT void SetMin( const Standard_Real& );
163 Standard_EXPORT void SetMax( const Standard_Real& );
165 Standard_EXPORT void SetDefaultValue( const Standard_Real& );
166 Standard_EXPORT void SetDefaultValue( const TCollection_AsciiString& );
168 Standard_EXPORT void SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)&,
169 const Handle(TColStd_HArray1OfInteger)& );
170 Standard_EXPORT void SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)&,
171 const Handle(TColStd_HArray1OfInteger)&,
172 const Handle(TColStd_HArray1OfExtendedString)& );
176 Standard_EXPORT DDS_DicItem( const DDS_DicItem& );
178 Standard_EXPORT void operator=( const DDS_DicItem& );
180 Standard_EXPORT virtual void FillDataMap( TCollection_AsciiString, const LDOM_Element&,
181 const LDOM_Element&, const LDOM_Element&,
182 const TColStd_SequenceOfAsciiString& );
186 Standard_EXPORT void PrepareFormats( const TCollection_AsciiString& );
187 Standard_EXPORT void GetDefaultFormat();
188 Standard_EXPORT UnitSystem GetActiveUnitSystem() const;
190 Standard_EXPORT void GetStringFormat( const TCollection_AsciiString&,
191 const TCollection_AsciiString&,
192 const TCollection_AsciiString&,
193 const TCollection_AsciiString&,
194 TCollection_AsciiString& );
195 Standard_EXPORT void GetIntegerFormat( const TCollection_AsciiString&,
196 const TCollection_AsciiString&,
197 const TCollection_AsciiString&,
198 const TCollection_AsciiString&,
199 const Standard_Character,
200 TCollection_AsciiString& );
201 Standard_EXPORT void GetFloatFormat( const TCollection_AsciiString&,
202 const TCollection_AsciiString&,
203 const TCollection_AsciiString&,
204 const TCollection_AsciiString&,
205 const Standard_Character,
206 TCollection_AsciiString& );
207 Standard_EXPORT void Split( const TCollection_AsciiString&,
208 Handle(TColStd_HArray1OfExtendedString)& );
210 Standard_EXPORT UnitData* GetUnitData( const UnitSystem& ) const;
213 typedef NCollection_DataMap<TCollection_AsciiString, TCollection_ExtendedString> OptionsMap;
216 TCollection_AsciiString myId;
217 TCollection_ExtendedString myLabel;
218 TCollection_ExtendedString myFilter;
219 TCollection_ExtendedString myRequired;
221 Standard_Integer myType;
222 Standard_Integer myWarnLevel;
224 TCollection_ExtendedString myLongDescr;
225 TCollection_ExtendedString myShortDescr;
229 Standard_Real myDefValue;
230 TCollection_ExtendedString myDefString;
232 Standard_Integer myData;
235 TCollection_ExtendedString myListName;
237 Handle(TColStd_HArray1OfExtendedString) myListRef;
238 Handle(TColStd_HArray1OfInteger) myListRefID;
239 Handle(TColStd_HArray1OfExtendedString) myListRefIcons;
242 Standard_Real myMinZoom;
243 Standard_Real myMaxZoom;
244 Standard_Real myZoomOrder;
246 Handle(Standard_Transient) myComponent;
248 OptionsMap myOptions;
250 NCollection_DataMap<UnitSystem, UnitData> myUnitData;
252 friend class DDS_DicGroup;
255 // Declaration of CASCADE RTTI
256 DEFINE_STANDARD_RTTI(DDS_DicItem)
259 DEFINE_STANDARD_HANDLE(DDS_DicItem, MMgt_TShared)
261 typedef NCollection_IndexedDataMap<TCollection_AsciiString, Handle(DDS_DicItem)> DDS_IndexedDataMapOfDicItems;