]> SALOME platform Git repositories - modules/gui.git/blob - src/DDS/DDS_KeyWords.cxx
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/gui.git] / src / DDS / DDS_KeyWords.cxx
1 // Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #include "DDS_KeyWords.h"
20
21 IMPLEMENT_STANDARD_HANDLE(DDS_KeyWords, MMgt_TShared)
22 IMPLEMENT_STANDARD_RTTIEXT(DDS_KeyWords, MMgt_TShared)
23
24 /*!
25   \class DDS_KeyWords
26
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.
29
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
38   \li DATUM - datum
39   \li DATUM_ID - id
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
60   \li VD_TYPE - type
61   \li VD_DEFV - default
62   \li VD_MAXV - max
63   \li VD_MINV - min
64   \li VD_SPEC - specVal
65   \li VLR_LIST - list
66   \li PRS - presentation
67   \li LATERAL_ZOOM - lateralZoom
68   \li LZ_MINV - min
69   \li LZ_MAXV - max
70   \li LZ_ORDER - order
71   \li OPTIONS - options
72   \li OPTION - option
73   \li OPTION_NAME - name
74 */
75
76 /*!
77   Constructor
78 */
79
80 DDS_KeyWords::DDS_KeyWords()
81 : MMgt_TShared()
82 {
83   SetKeyWord( "D_URI",                "dictionary" );
84
85   SetKeyWord( "COMPONENT",            "component" );
86   SetKeyWord( "COMPONENT_NAME",       "name" );
87
88   SetKeyWord( "UNIT_SYSTEMS",         "unitSystems" );
89   SetKeyWord( "UNIT_SYSTEM",          "system" );
90   SetKeyWord( "UNIT_SYSTEM_NAME",     "name" );
91   SetKeyWord( "UNIT_SYSTEM_LABEL",    "label" );
92
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" );
100
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" );
108
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" );
114
115   SetKeyWord( "DESCR",                "description" );
116   SetKeyWord( "LONG_D",               "longDescr" );
117   SetKeyWord( "SHORT_D",              "shortDescr" );
118
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" );
130
131   SetKeyWord( "OPTIONS",              "options" );
132   SetKeyWord( "OPTION",               "option" );
133   SetKeyWord( "OPTION_NAME",          "name" );
134 }
135
136 /*!
137   Returns the static instance of the class DDS_KeyWords
138 */
139
140 Handle(DDS_KeyWords) DDS_KeyWords::Get()
141 {
142   static Handle(DDS_KeyWords) keyWords;
143
144   if ( keyWords.IsNull() )
145     keyWords = new DDS_KeyWords();
146
147   return keyWords;
148 }
149
150 /*!
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.
153 */
154
155 TCollection_AsciiString DDS_KeyWords::GetKeyWord( const TCollection_AsciiString& key ) const
156 {
157   TCollection_AsciiString keyWord;
158   if ( myKeyWord.IsBound( key ) )
159     keyWord = myKeyWord.Find( key );
160   return keyWord;
161 }
162
163 /*!
164   Register the pair of the internal key \a key and XML keyword \a keyWord.
165 */
166
167 void DDS_KeyWords::SetKeyWord( const TCollection_AsciiString& key,
168                                const TCollection_AsciiString& keyWord )
169 {
170   if ( myKeyWord.IsBound( key ) )
171     myKeyWord.UnBind( key );
172
173   myKeyWord.Bind( key, keyWord );
174 }