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>
38 #include <TColStd_MapOfReal.hxx>
39 #include <TColStd_SequenceOfInteger.hxx>
40 #include <TColStd_SequenceOfAsciiString.hxx>
41 #include <TColStd_SequenceOfExtendedString.hxx>
46 // Class, containing all information about one parameter:
48 // obligative: label, type, short description, required
49 // optional : format, units,
50 // min value, max value, default value.
52 class DDS_DicItem : public MMgt_TShared
55 /*! Enum describes type of datum value */
58 String, //!< String type of value
59 Float, //!< Real (double) numeric type of value
60 Integer, //!< Integer (int) numeric type of value
61 List, //!< List type of enumerable value
62 Unknown //!< Unknown or undefined type of value
65 /*! Enum describes the flags for existance of domain data */
68 MinValue = 0x01, //!< Flag of minimum value definition existence
69 MaxValue = 0x02, //!< Flag of maximum value definition existence
70 DefaultValue = 0x04 //!< Flag of default value definition existence
73 // This struct is intended for map of Format, Units, Precision and Scale
77 Standard_Real myScale;
78 TCollection_AsciiString myUnits;
79 TCollection_AsciiString myFormat;
80 Standard_Integer myPrecision;
83 typedef TCollection_AsciiString UnitSystem;
86 Standard_EXPORT DDS_DicItem();
88 Standard_EXPORT TCollection_AsciiString GetId() const;
89 Standard_EXPORT DDS_DicItem::Type GetType() const;
90 Standard_EXPORT TCollection_ExtendedString GetLabel() const;
91 Standard_EXPORT TCollection_ExtendedString GetFilter() const;
92 Standard_EXPORT TCollection_ExtendedString GetRequired() const;
93 Standard_EXPORT DDS_MsgType GetWarningLevel() const;
94 Standard_EXPORT TCollection_ExtendedString GetLongDescription() const;
95 Standard_EXPORT TCollection_ExtendedString GetShortDescription() const;
96 Standard_EXPORT TCollection_AsciiString GetComponent() const;
98 Standard_EXPORT virtual TCollection_AsciiString GetUnits() const;
99 Standard_EXPORT virtual TCollection_AsciiString GetUnits( const UnitSystem& ) const;
101 Standard_EXPORT TCollection_ExtendedString GetDefaultValue() const;
102 Standard_EXPORT TCollection_ExtendedString GetDefaultValue( const UnitSystem& ) const;
104 Standard_EXPORT Standard_Real GetMinValue() const;
105 Standard_EXPORT Standard_Real GetMinValue( const UnitSystem& ) const;
107 Standard_EXPORT Standard_Real GetMaxValue() const;
108 Standard_EXPORT Standard_Real GetMaxValue( const UnitSystem& ) const;
110 Standard_EXPORT virtual Standard_Integer GetPrecision() const;
111 Standard_EXPORT virtual Standard_Integer GetPrecision( const UnitSystem& ) const;
113 Standard_EXPORT virtual TCollection_AsciiString GetFormat( const Standard_Boolean = Standard_True ) const;
114 Standard_EXPORT virtual TCollection_AsciiString GetFormat( const UnitSystem&,
115 const Standard_Boolean = Standard_True ) const;
116 Standard_EXPORT TCollection_ExtendedString GetNameOfValues() const;
117 Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&,
118 Handle(TColStd_HArray1OfInteger)& ) const;
119 Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&,
120 Handle(TColStd_HArray1OfInteger)&,
121 Handle(TColStd_HArray1OfExtendedString)& ) const;
122 Standard_EXPORT Standard_Boolean GetSpecialValues( TColStd_MapOfReal& ) const;
124 Standard_EXPORT Standard_Real GetMinZoom() const;
125 Standard_EXPORT Standard_Real GetMaxZoom() const;
126 Standard_EXPORT Standard_Real GetZoomOrder() const;
128 Standard_EXPORT virtual Standard_Real ToSI( const Standard_Real ) const;
129 Standard_EXPORT virtual Standard_Real FromSI( const Standard_Real ) const;
131 Standard_EXPORT virtual Standard_Real ToSI( const Standard_Real, const UnitSystem& ) const;
132 Standard_EXPORT virtual Standard_Real FromSI( const Standard_Real, const UnitSystem& ) const;
134 Standard_EXPORT Standard_Boolean HasData( const Standard_Integer ) const;
136 Standard_EXPORT TCollection_ExtendedString GetOption( const TCollection_AsciiString& ) const;
137 Standard_EXPORT Standard_Boolean GetOptionNames( TColStd_SequenceOfAsciiString& ) const;
141 Standard_EXPORT void SetId( const TCollection_AsciiString& );
143 Standard_EXPORT void SetComponent( const Handle(Standard_Transient)& );
145 Standard_EXPORT void SetLabel( const TCollection_AsciiString& );
147 Standard_EXPORT void SetFilter( const TCollection_AsciiString& );
149 Standard_EXPORT void SetRequired( const TCollection_AsciiString& );
151 Standard_EXPORT void SetWarningLevel( const Standard_Integer& );
153 Standard_EXPORT void SetMinZoom( const Standard_Real& );
154 Standard_EXPORT void SetMaxZoom( const Standard_Real& );
155 Standard_EXPORT void SetZoomOrder( const Standard_Real& );
157 Standard_EXPORT void SetShortDescription( const TCollection_ExtendedString& );
158 Standard_EXPORT void SetLongDescription( const TCollection_ExtendedString& );
160 Standard_EXPORT bool SetOption( const TCollection_AsciiString&, const TCollection_AsciiString& );
161 Standard_EXPORT void SetType( const DDS_DicItem::Type& );
163 Standard_EXPORT void SetMin( const Standard_Real& );
164 Standard_EXPORT void SetMax( const Standard_Real& );
166 Standard_EXPORT void SetDefaultValue( const Standard_Real& );
167 Standard_EXPORT void SetDefaultValue( const TCollection_AsciiString& );
169 Standard_EXPORT void SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)&,
170 const Handle(TColStd_HArray1OfInteger)& );
171 Standard_EXPORT void SetListOfValues( const Handle(TColStd_HArray1OfExtendedString)&,
172 const Handle(TColStd_HArray1OfInteger)&,
173 const Handle(TColStd_HArray1OfExtendedString)& );
177 Standard_EXPORT DDS_DicItem( const DDS_DicItem& );
179 Standard_EXPORT void operator=( const DDS_DicItem& );
181 Standard_EXPORT virtual void FillDataMap( TCollection_AsciiString, const LDOM_Element&,
182 const LDOM_Element&, const LDOM_Element&,
183 const TColStd_SequenceOfAsciiString& );
187 Standard_EXPORT void PrepareFormats( const TCollection_AsciiString& );
188 Standard_EXPORT void GetDefaultFormat();
189 Standard_EXPORT UnitSystem GetActiveUnitSystem() const;
191 Standard_EXPORT void GetStringFormat( const TCollection_AsciiString&,
192 const TCollection_AsciiString&,
193 const TCollection_AsciiString&,
194 const TCollection_AsciiString&,
195 TCollection_AsciiString& );
196 Standard_EXPORT void GetIntegerFormat( const TCollection_AsciiString&,
197 const TCollection_AsciiString&,
198 const TCollection_AsciiString&,
199 const TCollection_AsciiString&,
200 const Standard_Character,
201 TCollection_AsciiString& );
202 Standard_EXPORT void GetFloatFormat( const TCollection_AsciiString&,
203 const TCollection_AsciiString&,
204 const TCollection_AsciiString&,
205 const TCollection_AsciiString&,
206 const Standard_Character,
207 TCollection_AsciiString& );
208 Standard_EXPORT void Split( const TCollection_AsciiString&,
209 Handle(TColStd_HArray1OfExtendedString)& );
211 Standard_EXPORT UnitData* GetUnitData( const UnitSystem& ) const;
214 typedef NCollection_DataMap<TCollection_AsciiString, TCollection_ExtendedString> OptionsMap;
217 TCollection_AsciiString myId;
218 TCollection_ExtendedString myLabel;
219 TCollection_ExtendedString myFilter;
220 TCollection_ExtendedString myRequired;
222 Standard_Integer myType;
223 Standard_Integer myWarnLevel;
225 TCollection_ExtendedString myLongDescr;
226 TCollection_ExtendedString myShortDescr;
230 Standard_Real myDefValue;
231 TCollection_ExtendedString myDefString;
233 Standard_Integer myData;
236 TCollection_ExtendedString myListName;
238 Handle(TColStd_HArray1OfExtendedString) myListRef;
239 Handle(TColStd_HArray1OfInteger) myListRefID;
240 Handle(TColStd_HArray1OfExtendedString) myListRefIcons;
243 Standard_Real myMinZoom;
244 Standard_Real myMaxZoom;
245 Standard_Real myZoomOrder;
247 Handle(Standard_Transient) myComponent;
249 OptionsMap myOptions;
251 NCollection_DataMap<UnitSystem, UnitData> myUnitData;
253 friend class DDS_DicGroup;
256 OCCT_DEFINE_STANDARD_RTTIEXT(DDS_DicItem,MMgt_TShared)
259 DEFINE_STANDARD_HANDLE(DDS_DicItem, MMgt_TShared)
261 typedef NCollection_IndexedDataMap<TCollection_AsciiString, Handle(DDS_DicItem)> DDS_IndexedDataMapOfDicItems;