1 // Copyright (C) 2007-2019 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
23 #include "DDS_KeyWords.h"
25 IMPLEMENT_STANDARD_RTTIEXT(DDS_KeyWords, Standard_Transient)
29 \brief This class defines the pairs of internal keys and XML tags or
32 This class allows user to define a set of XML keywords used in the datums
33 definition (XML) file.
35 Default keywords table:
36 - \c D_URI - dictionary
37 - \c COMPONENT - component
38 - \c COMPONENT_NAME - name
39 - \c UNIT_SYSTEMS - unitSystems
40 - \c UNIT_SYSTEM - system
41 - \c UNIT_SYSTEM_NAME - name
42 - \c UNIT_SYSTEM_LABEL - label
45 - \c DATUM_LABEL - label
46 - \c DATUM_UNITS - units
47 - \c DATUM_FORMAT - format
48 - \c DATUM_FILTER - filter
49 - \c DATUM_REQUIRED - required
50 - \c VALUE_LIST - valueList
51 - \c VALUE_LIST_ID - listid
52 - \c VALUE_LIST_NAME - name
53 - \c VALUE_LIST_TYPE - type
54 - \c VALUE_LIST_VALUE - value
55 - \c VALUE_LIST_VALUEID - id
56 - \c VALUE_LIST_VALUEICON - icon
57 - \c DY_DOMAIN - domain
58 - \c WARNING_LEVEL - warningLevel
59 - \c WRONG_VALUE - wrongValue
60 - \c VALUE_DESCR - valueDescr
61 - \c VALUE_LIST_REF - listRef
62 - \c DESCR - description
63 - \c LONG_D - longDescr
64 - \c SHORT_D - shortDescr
66 - \c VD_DEFV - default
69 - \c VD_SPEC - specVal
71 - \c PRS - presentation
72 - \c LATERAL_ZOOM - lateralZoom
76 - \c OPTIONS - options
78 - \c OPTION_NAME - name
80 There is the only instance of the class DDS_KeyWords in the application
81 which can be retrieved by method Get().
86 Create an instance of the object. Can not be used directly.
87 Use Get() method instead.
89 DDS_KeyWords::DDS_KeyWords()
90 : Standard_Transient()
92 SetKeyWord( "D_URI", "dictionary" );
94 SetKeyWord( "COMPONENT", "component" );
95 SetKeyWord( "COMPONENT_NAME", "name" );
97 SetKeyWord( "UNIT_SYSTEMS", "unitSystems" );
98 SetKeyWord( "UNIT_SYSTEM", "system" );
99 SetKeyWord( "UNIT_SYSTEM_NAME", "name" );
100 SetKeyWord( "UNIT_SYSTEM_LABEL", "label" );
102 SetKeyWord( "DATUM", "datum" );
103 SetKeyWord( "DATUM_ID", "id" );
104 SetKeyWord( "DATUM_LABEL", "label" );
105 SetKeyWord( "DATUM_UNITS", "units" );
106 SetKeyWord( "DATUM_FORMAT", "format" );
107 SetKeyWord( "DATUM_FILTER", "filter" );
108 SetKeyWord( "DATUM_REQUIRED", "required" );
110 SetKeyWord( "VALUE_LIST", "valueList" );
111 SetKeyWord( "VALUE_LIST_ID", "listid" );
112 SetKeyWord( "VALUE_LIST_NAME", "name" );
113 SetKeyWord( "VALUE_LIST_TYPE", "type" );
114 SetKeyWord( "VALUE_LIST_VALUE", "value" );
115 SetKeyWord( "VALUE_LIST_VALUEID", "id" );
116 SetKeyWord( "VALUE_LIST_VALUEICON", "icon" );
118 SetKeyWord( "DY_DOMAIN", "domain" );
119 SetKeyWord( "WARNING_LEVEL", "warningLevel" );
120 SetKeyWord( "WRONG_VALUE", "wrongValue" );
121 SetKeyWord( "VALUE_DESCR", "valueDescr" );
122 SetKeyWord( "VALUE_LIST_REF", "listRef" );
124 SetKeyWord( "DESCR", "description" );
125 SetKeyWord( "LONG_D", "longDescr" );
126 SetKeyWord( "SHORT_D", "shortDescr" );
128 SetKeyWord( "VD_TYPE", "type" );
129 SetKeyWord( "VD_DEFV", "default" );
130 SetKeyWord( "VD_MAXV", "max" );
131 SetKeyWord( "VD_MINV", "min" );
132 SetKeyWord( "VD_SPEC", "specVal" );
133 SetKeyWord( "VLR_LIST", "list" );
134 SetKeyWord( "PRS", "presentation" );
135 SetKeyWord( "LATERAL_ZOOM", "lateralZoom" );
136 SetKeyWord( "LZ_MINV", "min" );
137 SetKeyWord( "LZ_MAXV", "max" );
138 SetKeyWord( "LZ_ORDER", "order" );
140 SetKeyWord( "OPTIONS", "options" );
141 SetKeyWord( "OPTION", "option" );
142 SetKeyWord( "OPTION_NAME", "name" );
146 \brief Get the only instance of the class DDS_KeyWords.
147 \return the only instance of the class
149 Handle(DDS_KeyWords) DDS_KeyWords::Get()
151 static Handle(DDS_KeyWords) keyWords;
153 if ( keyWords.IsNull() )
154 keyWords = new DDS_KeyWords();
160 \brief Get the XML keyword by specified internal key \a key.
162 If the internal key is not registered, empty string is returned.
163 \param key internal key
166 TCollection_AsciiString DDS_KeyWords::GetKeyWord( const TCollection_AsciiString& key ) const
168 TCollection_AsciiString keyWord;
169 if ( myKeyWord.IsBound( key ) )
170 keyWord = myKeyWord.Find( key );
175 \brief Register the pair of the internal key \a key and XML keyword \a keyWord.
176 \param key internal key
177 \param keyWord XML keyword
179 void DDS_KeyWords::SetKeyWord( const TCollection_AsciiString& key,
180 const TCollection_AsciiString& keyWord )
182 if ( myKeyWord.IsBound( key ) )
183 myKeyWord.UnBind( key );
185 myKeyWord.Bind( key, keyWord );