1 // Copyright (C) 2007-2012 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.
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;
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 TCollection_AsciiString GetUnits() const;
98 Standard_EXPORT 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 Standard_Integer GetPrecision() const;
110 Standard_EXPORT Standard_Integer GetPrecision( const UnitSystem& ) const;
112 Standard_EXPORT TCollection_AsciiString GetFormat( const Standard_Boolean = Standard_True ) const;
113 Standard_EXPORT 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 Standard_Real ToSI( const Standard_Real ) const;
128 Standard_EXPORT Standard_Real FromSI( const Standard_Real ) const;
130 Standard_EXPORT Standard_Real ToSI( const Standard_Real, const UnitSystem& ) const;
131 Standard_EXPORT 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;
139 DDS_DicItem( const DDS_DicItem& );
140 void operator=( const DDS_DicItem& );
141 void FillDataMap( TCollection_AsciiString, const LDOM_Element&,
142 const LDOM_Element&, const LDOM_Element&,
143 const TColStd_SequenceOfAsciiString& );
144 void PrepareFormats( const TCollection_AsciiString& );
145 void GetDefaultFormat();
146 UnitSystem GetActiveUnitSystem() const;
148 void GetStringFormat( const TCollection_AsciiString&,
149 const TCollection_AsciiString&,
150 const TCollection_AsciiString&,
151 const TCollection_AsciiString&,
152 TCollection_AsciiString& );
153 void GetIntegerFormat( const TCollection_AsciiString&,
154 const TCollection_AsciiString&,
155 const TCollection_AsciiString&,
156 const TCollection_AsciiString&,
157 const Standard_Character,
158 TCollection_AsciiString& );
159 void GetFloatFormat( const TCollection_AsciiString&,
160 const TCollection_AsciiString&,
161 const TCollection_AsciiString&,
162 const TCollection_AsciiString&,
163 const Standard_Character,
164 TCollection_AsciiString& );
165 void Split( const TCollection_AsciiString&,
166 Handle(TColStd_HArray1OfExtendedString)& );
168 UnitData* GetUnitData( const UnitSystem& ) const;
171 typedef NCollection_DataMap<TCollection_AsciiString, TCollection_ExtendedString> OptionsMap;
174 TCollection_AsciiString myId;
175 TCollection_ExtendedString myLabel;
176 TCollection_ExtendedString myFilter;
177 TCollection_ExtendedString myRequired;
179 Standard_Integer myType;
180 Standard_Integer myWarnLevel;
182 TCollection_ExtendedString myLongDescr;
183 TCollection_ExtendedString myShortDescr;
187 Standard_Real myDefValue;
188 TCollection_ExtendedString myDefString;
190 Standard_Integer myData;
193 TCollection_ExtendedString myListName;
195 Handle(TColStd_HArray1OfExtendedString) myListRef;
196 Handle(TColStd_HArray1OfInteger) myListRefID;
197 Handle(TColStd_HArray1OfExtendedString) myListRefIcons;
200 Standard_Real myMinZoom;
201 Standard_Real myMaxZoom;
202 Standard_Real myZoomOrder;
204 Handle(Standard_Transient) myComponent;
206 OptionsMap myOptions;
208 NCollection_DataMap<UnitSystem, UnitData> myUnitData;
210 friend class DDS_DicGroup;
213 // Declaration of CASCADE RTTI
214 DEFINE_STANDARD_RTTI(DDS_DicItem)
217 DEFINE_STANDARD_HANDLE(DDS_DicItem, MMgt_TShared)
219 DEFINE_BASECOLLECTION(DDS_BaseCollectionOfDicItems, Handle(DDS_DicItem))
220 DEFINE_INDEXEDDATAMAP(DDS_IndexedDataMapOfDicItems, DDS_BaseCollectionOfDicItems,
221 TCollection_AsciiString, Handle(DDS_DicItem))