1 // Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include "DDS_KeyWords.h"
21 IMPLEMENT_STANDARD_HANDLE(DDS_KeyWords, MMgt_TShared)
22 IMPLEMENT_STANDARD_RTTIEXT(DDS_KeyWords, MMgt_TShared)
27 This object contains the pairs of internal keys and XML tag or attribute names. This class allow to user
28 define set of XML keywords used in datums definition file.
30 Default keywords table:
31 \li D_URI - dictionary
32 \li COMPONENT - component
33 \li COMPONENT_NAME - name
34 \li UNIT_SYSTEMS - unitSystems
35 \li UNIT_SYSTEM - system
36 \li UNIT_SYSTEM_NAME - name
37 \li UNIT_SYSTEM_LABEL - label
40 \li DATUM_LABEL - label
41 \li DATUM_UNITS - units
42 \li DATUM_FORMAT - format
43 \li DATUM_FILTER - filter
44 \li DATUM_REQUIRED - required
45 \li VALUE_LIST - valueList
46 \li VALUE_LIST_ID - listid
47 \li VALUE_LIST_NAME - name
48 \li VALUE_LIST_TYPE - type
49 \li VALUE_LIST_VALUE - value
50 \li VALUE_LIST_VALUEID - id
51 \li VALUE_LIST_VALUEICON - icon
52 \li DY_DOMAIN - domain
53 \li WARNING_LEVEL - warningLevel
54 \li WRONG_VALUE - wrongValue
55 \li VALUE_DESCR - valueDescr
56 \li VALUE_LIST_REF - listRef
57 \li DESCR - description
58 \li LONG_D - longDescr
59 \li SHORT_D - shortDescr
66 \li PRS - presentation
67 \li LATERAL_ZOOM - lateralZoom
73 \li OPTION_NAME - name
80 DDS_KeyWords::DDS_KeyWords()
83 SetKeyWord( "D_URI", "dictionary" );
85 SetKeyWord( "COMPONENT", "component" );
86 SetKeyWord( "COMPONENT_NAME", "name" );
88 SetKeyWord( "UNIT_SYSTEMS", "unitSystems" );
89 SetKeyWord( "UNIT_SYSTEM", "system" );
90 SetKeyWord( "UNIT_SYSTEM_NAME", "name" );
91 SetKeyWord( "UNIT_SYSTEM_LABEL", "label" );
93 SetKeyWord( "DATUM", "datum" );
94 SetKeyWord( "DATUM_ID", "id" );
95 SetKeyWord( "DATUM_LABEL", "label" );
96 SetKeyWord( "DATUM_UNITS", "units" );
97 SetKeyWord( "DATUM_FORMAT", "format" );
98 SetKeyWord( "DATUM_FILTER", "filter" );
99 SetKeyWord( "DATUM_REQUIRED", "required" );
101 SetKeyWord( "VALUE_LIST", "valueList" );
102 SetKeyWord( "VALUE_LIST_ID", "listid" );
103 SetKeyWord( "VALUE_LIST_NAME", "name" );
104 SetKeyWord( "VALUE_LIST_TYPE", "type" );
105 SetKeyWord( "VALUE_LIST_VALUE", "value" );
106 SetKeyWord( "VALUE_LIST_VALUEID", "id" );
107 SetKeyWord( "VALUE_LIST_VALUEICON", "icon" );
109 SetKeyWord( "DY_DOMAIN", "domain" );
110 SetKeyWord( "WARNING_LEVEL", "warningLevel" );
111 SetKeyWord( "WRONG_VALUE", "wrongValue" );
112 SetKeyWord( "VALUE_DESCR", "valueDescr" );
113 SetKeyWord( "VALUE_LIST_REF", "listRef" );
115 SetKeyWord( "DESCR", "description" );
116 SetKeyWord( "LONG_D", "longDescr" );
117 SetKeyWord( "SHORT_D", "shortDescr" );
119 SetKeyWord( "VD_TYPE", "type" );
120 SetKeyWord( "VD_DEFV", "default" );
121 SetKeyWord( "VD_MAXV", "max" );
122 SetKeyWord( "VD_MINV", "min" );
123 SetKeyWord( "VD_SPEC", "specVal" );
124 SetKeyWord( "VLR_LIST", "list" );
125 SetKeyWord( "PRS", "presentation" );
126 SetKeyWord( "LATERAL_ZOOM", "lateralZoom" );
127 SetKeyWord( "LZ_MINV", "min" );
128 SetKeyWord( "LZ_MAXV", "max" );
129 SetKeyWord( "LZ_ORDER", "order" );
131 SetKeyWord( "OPTIONS", "options" );
132 SetKeyWord( "OPTION", "option" );
133 SetKeyWord( "OPTION_NAME", "name" );
137 Returns the static instance of the class DDS_KeyWords
140 Handle(DDS_KeyWords) DDS_KeyWords::Get()
142 static Handle(DDS_KeyWords) keyWords;
144 if ( keyWords.IsNull() )
145 keyWords = new DDS_KeyWords();
151 Returns the XML keyword by specified internal key \a key. If the internal key isn't registered
152 then empty string will be returned.
155 TCollection_AsciiString DDS_KeyWords::GetKeyWord( const TCollection_AsciiString& key ) const
157 TCollection_AsciiString keyWord;
158 if ( myKeyWord.IsBound( key ) )
159 keyWord = myKeyWord.Find( key );
164 Register the pair of the internal key \a key and XML keyword \a keyWord.
167 void DDS_KeyWords::SetKeyWord( const TCollection_AsciiString& key,
168 const TCollection_AsciiString& keyWord )
170 if ( myKeyWord.IsBound( key ) )
171 myKeyWord.UnBind( key );
173 myKeyWord.Bind( key, keyWord );