1 // Copyright (C) 2007-2015 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_HANDLE(DDS_KeyWords, MMgt_TShared)
26 IMPLEMENT_STANDARD_RTTIEXT(DDS_KeyWords, MMgt_TShared)
30 \brief This class defines the pairs of internal keys and XML tags or
33 This class allows user to define a set of XML keywords used in the datums
34 definition (XML) file.
36 Default keywords table:
37 - \c D_URI - dictionary
38 - \c COMPONENT - component
39 - \c COMPONENT_NAME - name
40 - \c UNIT_SYSTEMS - unitSystems
41 - \c UNIT_SYSTEM - system
42 - \c UNIT_SYSTEM_NAME - name
43 - \c UNIT_SYSTEM_LABEL - label
46 - \c DATUM_LABEL - label
47 - \c DATUM_UNITS - units
48 - \c DATUM_FORMAT - format
49 - \c DATUM_FILTER - filter
50 - \c DATUM_REQUIRED - required
51 - \c VALUE_LIST - valueList
52 - \c VALUE_LIST_ID - listid
53 - \c VALUE_LIST_NAME - name
54 - \c VALUE_LIST_TYPE - type
55 - \c VALUE_LIST_VALUE - value
56 - \c VALUE_LIST_VALUEID - id
57 - \c VALUE_LIST_VALUEICON - icon
58 - \c DY_DOMAIN - domain
59 - \c WARNING_LEVEL - warningLevel
60 - \c WRONG_VALUE - wrongValue
61 - \c VALUE_DESCR - valueDescr
62 - \c VALUE_LIST_REF - listRef
63 - \c DESCR - description
64 - \c LONG_D - longDescr
65 - \c SHORT_D - shortDescr
67 - \c VD_DEFV - default
70 - \c VD_SPEC - specVal
72 - \c PRS - presentation
73 - \c LATERAL_ZOOM - lateralZoom
77 - \c OPTIONS - options
79 - \c OPTION_NAME - name
81 There is the only instance of the class DDS_KeyWords in the application
82 which can be retrieved by method Get().
87 Create an instance of the object. Can not be used directly.
88 Use Get() method instead.
90 DDS_KeyWords::DDS_KeyWords()
93 SetKeyWord( "D_URI", "dictionary" );
95 SetKeyWord( "COMPONENT", "component" );
96 SetKeyWord( "COMPONENT_NAME", "name" );
98 SetKeyWord( "UNIT_SYSTEMS", "unitSystems" );
99 SetKeyWord( "UNIT_SYSTEM", "system" );
100 SetKeyWord( "UNIT_SYSTEM_NAME", "name" );
101 SetKeyWord( "UNIT_SYSTEM_LABEL", "label" );
103 SetKeyWord( "DATUM", "datum" );
104 SetKeyWord( "DATUM_ID", "id" );
105 SetKeyWord( "DATUM_LABEL", "label" );
106 SetKeyWord( "DATUM_UNITS", "units" );
107 SetKeyWord( "DATUM_FORMAT", "format" );
108 SetKeyWord( "DATUM_FILTER", "filter" );
109 SetKeyWord( "DATUM_REQUIRED", "required" );
111 SetKeyWord( "VALUE_LIST", "valueList" );
112 SetKeyWord( "VALUE_LIST_ID", "listid" );
113 SetKeyWord( "VALUE_LIST_NAME", "name" );
114 SetKeyWord( "VALUE_LIST_TYPE", "type" );
115 SetKeyWord( "VALUE_LIST_VALUE", "value" );
116 SetKeyWord( "VALUE_LIST_VALUEID", "id" );
117 SetKeyWord( "VALUE_LIST_VALUEICON", "icon" );
119 SetKeyWord( "DY_DOMAIN", "domain" );
120 SetKeyWord( "WARNING_LEVEL", "warningLevel" );
121 SetKeyWord( "WRONG_VALUE", "wrongValue" );
122 SetKeyWord( "VALUE_DESCR", "valueDescr" );
123 SetKeyWord( "VALUE_LIST_REF", "listRef" );
125 SetKeyWord( "DESCR", "description" );
126 SetKeyWord( "LONG_D", "longDescr" );
127 SetKeyWord( "SHORT_D", "shortDescr" );
129 SetKeyWord( "VD_TYPE", "type" );
130 SetKeyWord( "VD_DEFV", "default" );
131 SetKeyWord( "VD_MAXV", "max" );
132 SetKeyWord( "VD_MINV", "min" );
133 SetKeyWord( "VD_SPEC", "specVal" );
134 SetKeyWord( "VLR_LIST", "list" );
135 SetKeyWord( "PRS", "presentation" );
136 SetKeyWord( "LATERAL_ZOOM", "lateralZoom" );
137 SetKeyWord( "LZ_MINV", "min" );
138 SetKeyWord( "LZ_MAXV", "max" );
139 SetKeyWord( "LZ_ORDER", "order" );
141 SetKeyWord( "OPTIONS", "options" );
142 SetKeyWord( "OPTION", "option" );
143 SetKeyWord( "OPTION_NAME", "name" );
147 \brief Get the only instance of the class DDS_KeyWords.
148 \return the only instance of the class
150 Handle_DDS_KeyWords DDS_KeyWords::Get()
152 static Handle(DDS_KeyWords) keyWords;
154 if ( keyWords.IsNull() )
155 keyWords = new DDS_KeyWords();
161 \brief Get the XML keyword by specified internal key \a key.
163 If the internal key is not registered, empty string is returned.
164 \param key internal key
167 TCollection_AsciiString DDS_KeyWords::GetKeyWord( const TCollection_AsciiString& key ) const
169 TCollection_AsciiString keyWord;
170 if ( myKeyWord.IsBound( key ) )
171 keyWord = myKeyWord.Find( key );
176 \brief Register the pair of the internal key \a key and XML keyword \a keyWord.
177 \param key internal key
178 \param keyWord XML keyword
180 void DDS_KeyWords::SetKeyWord( const TCollection_AsciiString& key,
181 const TCollection_AsciiString& keyWord )
183 if ( myKeyWord.IsBound( key ) )
184 myKeyWord.UnBind( key );
186 myKeyWord.Bind( key, keyWord );