1 karl 1.23 //%2005////////////////////////////////////////////////////////////////////////
|
2 kumpf 1.1 //
|
3 karl 1.20 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.18 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.20 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.23 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 kumpf 1.1 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
13 kumpf 1.6 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
16 kumpf 1.1 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
18 //
|
19 kumpf 1.6 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
20 kumpf 1.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
22 kumpf 1.6 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
25 kumpf 1.1 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
29 //
30 // Author: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
31 //
|
32 kumpf 1.8 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
|
33 david.dillard 1.24 // (carolann_graves@hp.com)
|
34 dave.sudlik 1.21 // Dave Sudlik, IBM (dsudlik@us.ibm.com)
|
35 david.dillard 1.24 // David Dillard, VERITAS Software Corp.
36 // (david.dillard@veritas.com)
|
37 kumpf 1.1 //
38 //%/////////////////////////////////////////////////////////////////////////////
39
40 #include <Pegasus/Common/Config.h>
41 #include <cstdlib>
42 #include <cstdio>
43 #include "Constants.h"
44 #include "CIMClass.h"
45 #include "CIMClassRep.h"
46 #include "CIMInstance.h"
47 #include "CIMInstanceRep.h"
48 #include "CIMProperty.h"
49 #include "CIMPropertyRep.h"
50 #include "CIMMethod.h"
51 #include "CIMMethodRep.h"
52 #include "CIMParameter.h"
53 #include "CIMParameterRep.h"
54 #include "CIMQualifier.h"
55 #include "CIMQualifierRep.h"
56 #include "CIMQualifierDecl.h"
57 #include "CIMQualifierDeclRep.h"
|
58 kumpf 1.4 #include "CIMObjectPath.h"
|
59 kumpf 1.1 #include "CIMValue.h"
|
60 kumpf 1.3 #include "CIMFlavor.h"
61 #include "CIMScope.h"
|
62 kumpf 1.1 #include "XmlWriter.h"
63 #include "MofWriter.h"
64 #include "Tracer.h"
65
66 PEGASUS_NAMESPACE_BEGIN
67
68 //------------------------------------------------------------------------------
69 //
70 // Helper functions for appendValueElement()
71 //
72 //------------------------------------------------------------------------------
73
|
74 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Boolean x)
|
75 kumpf 1.1 {
76 XmlWriter::append(out, x);
77 }
78
|
79 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Uint8 x)
|
80 kumpf 1.1 {
81 XmlWriter::append(out, Uint32(x));
82 }
83
|
84 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Sint8 x)
|
85 kumpf 1.1 {
86 XmlWriter::append(out, Sint32(x));
87 }
88
|
89 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Uint16 x)
|
90 kumpf 1.1 {
91 XmlWriter::append(out, Uint32(x));
92 }
93
|
94 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Sint16 x)
|
95 kumpf 1.1 {
96 XmlWriter::append(out, Sint32(x));
97 }
98
|
99 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Uint32 x)
|
100 kumpf 1.1 {
101 XmlWriter::append(out, x);
102 }
103
|
104 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Sint32 x)
|
105 kumpf 1.1 {
106 XmlWriter::append(out, x);
107 }
108
|
109 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Uint64 x)
|
110 kumpf 1.1 {
111 XmlWriter::append(out, x);
112 }
113
|
114 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Sint64 x)
|
115 kumpf 1.1 {
116 XmlWriter::append(out, x);
117 }
118
|
119 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Real32 x)
|
120 kumpf 1.1 {
121 XmlWriter::append(out, Real64(x));
122 }
123
|
124 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Real64 x)
|
125 kumpf 1.1 {
126 XmlWriter::append(out, x);
127 }
128
|
129 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, Char16 x)
|
130 kumpf 1.1 {
131 XmlWriter::appendSpecial(out, x);
132 }
133
134 /** Convert the string back to MOF format and output it.
135 The conversions are:
136 \b // \x0008: backspace BS
137 \t // \x0009: horizontal tab HT
138 \n // \x000A: linefeed LF
139 \f // \x000C: form feed FF
140 \r // \x000D: carriage return CR
141 \" // \x0022: double quote "
142 \’ // \x0027: single quote '
143 \\ // \x005C: backslash \
144 \x<hex> // where <hex> is one to four hex digits
145 \X<hex> // where <hex> is one to four hex digits
146 */
147 /* ATTN:KS - We need to account for characters greater than x'7f
148 */
|
149 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, const String& x)
|
150 kumpf 1.1 {
|
151 mike 1.24.2.2 out.append('"');
|
152 david.dillard 1.24 const Uint32 size = x.size();
153 for (Uint32 i = 0; i < size; i++)
|
154 kumpf 1.1 {
|
155 kumpf 1.7 switch (x[i])
|
156 kumpf 1.1 {
157 case '\\':
158 out.append("\\\\",2);
159 break;
160
161 case '\b':
162 out.append("\\b",2);
163 break;
164
165 case '\t':
166 out.append("\\t",2);
167 break;
168
169 case '\n':
170 out.append("\\n",2);
171 break;
172
173 case '\f':
174 out.append("\\f",2);
175 break;
176
177 kumpf 1.1 case '\r':
178 out.append("\\r",2);
179 break;
180
181 /* case '\'':
182 out.append("\\'", 2);
183 break;*/
184
185 case '"':
186 out.append("\\\"", 2);
187 break;
188
189 default:
|
190 kumpf 1.7 out.append(Sint8(x[i]));
|
191 kumpf 1.1 }
192
193 }
|
194 mike 1.24.2.2 out.append('"');
|
195 kumpf 1.1 }
196
|
197 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, const CIMDateTime& x)
|
198 kumpf 1.1 {
|
199 kumpf 1.19 _mofWriter_appendValue(out, x.toString());
|
200 kumpf 1.1 }
201
|
202 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, const CIMObjectPath& x)
|
203 kumpf 1.1 {
|
204 kumpf 1.19 _mofWriter_appendValue(out, x.toString());
|
205 kumpf 1.1 }
206
|
207 mike 1.24.2.1 inline void _mofWriter_appendValue(Buffer& out, const CIMObject& x)
|
208 dave.sudlik 1.21 {
209 _mofWriter_appendValue(out, x.toString());
210 }
211
|
212 kumpf 1.1 /** Array -
213 arrayInitializer = "{" constantValue*( "," constantValue)"}"
214 */
215 template<class T>
|
216 mday 1.5
|
217 mike 1.24.2.1 void _mofWriter_appendValueArrayMof(Buffer& out, const T* p, Uint32 size)
|
218 kumpf 1.1 {
219 Boolean isFirstEntry = true;
220 // if there are any entries in the array output them
221 if (size)
222 {
|
223 mike 1.24.2.2 out.append('{');
|
224 kumpf 1.1 while (size--)
225 {
226 // Put comma on all but first entry.
227 if (!isFirstEntry)
228 {
|
229 mike 1.24.2.2 out << LIT(", ");
|
230 kumpf 1.1 }
231 isFirstEntry = false;
|
232 s.hills 1.17 _mofWriter_appendValue(out, *p++);
|
233 kumpf 1.1 }
|
234 mike 1.24.2.2 out.append('}');
|
235 kumpf 1.1 }
236 }
237
238 //------------------------------------------------------------------------------
239 //
240 // appendValueElement()
241 //
242 //------------------------------------------------------------------------------
243
244 void MofWriter::appendValueElement(
|
245 mike 1.24.2.1 Buffer& out,
|
246 kumpf 1.1 const CIMValue& value)
247 {
248 // if the CIMValue is Null we return the Null indicator.
249 if (value.isNull())
250 {
|
251 mike 1.24.2.2 out << LIT("null");
|
252 kumpf 1.1 return;
253 }
254
255 if (value.isArray())
256 {
257 switch (value.getType())
258 {
|
259 kumpf 1.8 case CIMTYPE_BOOLEAN:
|
260 kumpf 1.1 {
261 Array<Boolean> a;
262 value.get(a);
|
263 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
264 kumpf 1.1 break;
265 }
266
|
267 kumpf 1.8 case CIMTYPE_UINT8:
|
268 kumpf 1.1 {
269 Array<Uint8> a;
270 value.get(a);
|
271 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
272 kumpf 1.1 break;
273 }
274
|
275 kumpf 1.8 case CIMTYPE_SINT8:
|
276 kumpf 1.1 {
277 Array<Sint8> a;
278 value.get(a);
|
279 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
280 kumpf 1.1 break;
281 }
282
|
283 kumpf 1.8 case CIMTYPE_UINT16:
|
284 kumpf 1.1 {
285 Array<Uint16> a;
286 value.get(a);
|
287 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
288 kumpf 1.1 break;
289 }
290
|
291 kumpf 1.8 case CIMTYPE_SINT16:
|
292 kumpf 1.1 {
293 Array<Sint16> a;
294 value.get(a);
|
295 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
296 kumpf 1.1 break;
297 }
298
|
299 kumpf 1.8 case CIMTYPE_UINT32:
|
300 kumpf 1.1 {
301 Array<Uint32> a;
302 value.get(a);
|
303 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
304 kumpf 1.1 break;
305 }
306
|
307 kumpf 1.8 case CIMTYPE_SINT32:
|
308 kumpf 1.1 {
309 Array<Sint32> a;
310 value.get(a);
|
311 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
312 kumpf 1.1 break;
313 }
314
|
315 kumpf 1.8 case CIMTYPE_UINT64:
|
316 kumpf 1.1 {
317 Array<Uint64> a;
318 value.get(a);
|
319 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
320 kumpf 1.1 break;
321 }
322
|
323 kumpf 1.8 case CIMTYPE_SINT64:
|
324 kumpf 1.1 {
325 Array<Sint64> a;
326 value.get(a);
|
327 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
328 kumpf 1.1 break;
329 }
330
|
331 kumpf 1.8 case CIMTYPE_REAL32:
|
332 kumpf 1.1 {
333 Array<Real32> a;
334 value.get(a);
|
335 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
336 kumpf 1.1 break;
337 }
338
|
339 kumpf 1.8 case CIMTYPE_REAL64:
|
340 kumpf 1.1 {
341 Array<Real64> a;
342 value.get(a);
|
343 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
344 kumpf 1.1 break;
345 }
346
|
347 kumpf 1.8 case CIMTYPE_CHAR16:
|
348 kumpf 1.1 {
349 Array<Char16> a;
350 value.get(a);
|
351 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
352 kumpf 1.1 break;
353 }
354
|
355 kumpf 1.8 case CIMTYPE_STRING:
|
356 kumpf 1.1 {
357 Array<String> a;
358 value.get(a);
|
359 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
360 kumpf 1.1 break;
361 }
362
|
363 kumpf 1.8 case CIMTYPE_DATETIME:
|
364 kumpf 1.1 {
365 Array<CIMDateTime> a;
366 value.get(a);
|
367 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
368 kumpf 1.1 break;
369 }
370
|
371 kumpf 1.8 case CIMTYPE_REFERENCE:
|
372 kumpf 1.1 {
|
373 kumpf 1.4 Array<CIMObjectPath> a;
|
374 kumpf 1.1 value.get(a);
|
375 s.hills 1.17 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
|
376 kumpf 1.1 break;
377 }
378
|
379 dave.sudlik 1.21 case CIMTYPE_OBJECT:
380 {
381 Array<CIMObject> a;
382 value.get(a);
383 _mofWriter_appendValueArrayMof(out, a.getData(), a.size());
384 break;
385 }
386
|
387 kumpf 1.1 default:
|
388 kumpf 1.15 PEGASUS_ASSERT(false);
|
389 kumpf 1.1 }
390 }
391 else
392 {
393 switch (value.getType())
394 {
|
395 kumpf 1.8 case CIMTYPE_BOOLEAN:
|
396 kumpf 1.1 {
397 Boolean v;
398 value.get(v);
|
399 s.hills 1.17 _mofWriter_appendValue(out, v);
|
400 kumpf 1.1 break;
401 }
402
|
403 kumpf 1.8 case CIMTYPE_UINT8:
|
404 kumpf 1.1 {
405 Uint8 v;
406 value.get(v);
|
407 s.hills 1.17 _mofWriter_appendValue(out, v);
|
408 kumpf 1.1 break;
409 }
410
|
411 kumpf 1.8 case CIMTYPE_SINT8:
|
412 kumpf 1.1 {
413 Sint8 v;
414 value.get(v);
|
415 s.hills 1.17 _mofWriter_appendValue(out, v);
|
416 kumpf 1.1 break;
417 }
418
|
419 kumpf 1.8 case CIMTYPE_UINT16:
|
420 kumpf 1.1 {
421 Uint16 v;
422 value.get(v);
|
423 s.hills 1.17 _mofWriter_appendValue(out, v);
|
424 kumpf 1.1 break;
425 }
426
|
427 kumpf 1.8 case CIMTYPE_SINT16:
|
428 kumpf 1.1 {
429 Sint16 v;
430 value.get(v);
|
431 s.hills 1.17 _mofWriter_appendValue(out, v);
|
432 kumpf 1.1 break;
433 }
434
|
435 kumpf 1.8 case CIMTYPE_UINT32:
|
436 kumpf 1.1 {
437 Uint32 v;
438 value.get(v);
|
439 s.hills 1.17 _mofWriter_appendValue(out, v);
|
440 kumpf 1.1 break;
441 }
442
|
443 kumpf 1.8 case CIMTYPE_SINT32:
|
444 kumpf 1.1 {
445 Sint32 v;
446 value.get(v);
|
447 s.hills 1.17 _mofWriter_appendValue(out, v);
|
448 kumpf 1.1 break;
449 }
450
|
451 kumpf 1.8 case CIMTYPE_UINT64:
|
452 kumpf 1.1 {
453 Uint64 v;
454 value.get(v);
|
455 s.hills 1.17 _mofWriter_appendValue(out, v);
|
456 kumpf 1.1 break;
457 }
458
|
459 kumpf 1.8 case CIMTYPE_SINT64:
|
460 kumpf 1.1 {
461 Sint64 v;
462 value.get(v);
|
463 s.hills 1.17 _mofWriter_appendValue(out, v);
|
464 kumpf 1.1 break;
465 }
466
|
467 kumpf 1.8 case CIMTYPE_REAL32:
|
468 kumpf 1.1 {
469 Real32 v;
470 value.get(v);
|
471 s.hills 1.17 _mofWriter_appendValue(out, v);
|
472 kumpf 1.1 break;
473 }
474
|
475 kumpf 1.8 case CIMTYPE_REAL64:
|
476 kumpf 1.1 {
477 Real64 v;
478 value.get(v);
|
479 s.hills 1.17 _mofWriter_appendValue(out, v);
|
480 kumpf 1.1 break;
481 }
482
|
483 kumpf 1.8 case CIMTYPE_CHAR16:
|
484 kumpf 1.1 {
485 Char16 v;
486 value.get(v);
|
487 s.hills 1.17 _mofWriter_appendValue(out, v);
|
488 kumpf 1.1 break;
489 }
490
|
491 kumpf 1.8 case CIMTYPE_STRING:
|
492 kumpf 1.1 {
493 String v;
494 value.get(v);
|
495 s.hills 1.17 _mofWriter_appendValue(out, v);
|
496 kumpf 1.1 break;
497 }
498
|
499 kumpf 1.8 case CIMTYPE_DATETIME:
|
500 kumpf 1.1 {
501 CIMDateTime v;
502 value.get(v);
|
503 s.hills 1.17 _mofWriter_appendValue(out, v);
|
504 kumpf 1.1 break;
505 }
506
|
507 kumpf 1.8 case CIMTYPE_REFERENCE:
|
508 kumpf 1.1 {
|
509 kumpf 1.4 CIMObjectPath v;
|
510 kumpf 1.1 value.get(v);
|
511 s.hills 1.17 _mofWriter_appendValue(out, v);
|
512 kumpf 1.1 break;
513 }
514
|
515 dave.sudlik 1.21 case CIMTYPE_OBJECT:
516 {
517 CIMObject v;
518 value.get(v);
519 _mofWriter_appendValue(out, v);
520 break;
521 }
522
|
523 kumpf 1.1 default:
|
524 kumpf 1.15 PEGASUS_ASSERT(false);
|
525 kumpf 1.1 }
526 }
527 }
528
529 //------------------------------------------------------------------------------
530 //
531 // appendValueReferenceElement()
532 //
533 //------------------------------------------------------------------------------
534
535 void MofWriter::appendValueReferenceElement(
|
536 mike 1.24.2.1 Buffer& out,
|
537 kumpf 1.4 const CIMObjectPath& reference)
|
538 kumpf 1.1 {
|
539 kumpf 1.19 _mofWriter_appendValue(out, reference);
|
540 kumpf 1.1 }
541
542 //------------------------------------------------------------------------------
543 //
544 // appendClassElement()
545 //
546 //------------------------------------------------------------------------------
547
548 void MofWriter::appendClassElement(
|
549 mike 1.24.2.1 Buffer& out,
|
550 kumpf 1.1 const CIMConstClass& cimclass)
551 {
552 cimclass._checkRep();
553 cimclass._rep->toMof(out);
554 }
555
556 void MofWriter::printClassElement(
557 const CIMConstClass& cimclass,
558 PEGASUS_STD(ostream)& os)
559 {
|
560 mike 1.24.2.1 Buffer tmp;
|
561 kumpf 1.1 appendClassElement(tmp, cimclass);
562 tmp.append('\0');
563 os << tmp.getData() << PEGASUS_STD(endl);
564 }
565
566 //------------------------------------------------------------------------------
567 //
568 // appendInstanceElement()
569 //
570 //------------------------------------------------------------------------------
571
572 void MofWriter::appendInstanceElement(
|
573 mike 1.24.2.1 Buffer& out,
|
574 kumpf 1.1 const CIMConstInstance& instance)
575 {
576 instance._checkRep();
577 instance._rep->toMof(out);
578 }
579
580 //------------------------------------------------------------------------------
581 //
582 // appendPropertyElement()
583 //
584 //------------------------------------------------------------------------------
585
586 void MofWriter::appendPropertyElement(
|
587 mike 1.24.2.1 Buffer& out,
|
588 kumpf 1.1 const CIMConstProperty& property)
589 {
590 property._checkRep();
591 property._rep->toMof(out);
592 }
593
594 //------------------------------------------------------------------------------
595 //
596 // appendMethodElement()
597 //
598 //------------------------------------------------------------------------------
599
600 void MofWriter::appendMethodElement(
|
601 mike 1.24.2.1 Buffer& out,
|
602 kumpf 1.1 const CIMConstMethod& method)
603 {
604 method._checkRep();
605 method._rep->toMof(out);
606 }
607
608 //------------------------------------------------------------------------------
609 //
610 // appendParameterElement()
611 //
612 //------------------------------------------------------------------------------
613
614 void MofWriter::appendParameterElement(
|
615 mike 1.24.2.1 Buffer& out,
|
616 kumpf 1.1 const CIMConstParameter& parameter)
617 {
618 parameter._checkRep();
619 parameter._rep->toMof(out);
620 }
621
622 //------------------------------------------------------------------------------
623 //
624 // appendQualifierElement()
625 //
626 //------------------------------------------------------------------------------
627
628 void MofWriter::appendQualifierElement(
|
629 mike 1.24.2.1 Buffer& out,
|
630 kumpf 1.1 const CIMConstQualifier& qualifier)
631 {
632 qualifier._checkRep();
633 qualifier._rep->toMof(out);
634 }
635
636 //------------------------------------------------------------------------------
637 //
638 // appendQualifierDeclElement()
639 //
640 //------------------------------------------------------------------------------
641
642 void MofWriter::appendQualifierDeclElement(
|
643 mike 1.24.2.1 Buffer& out,
|
644 kumpf 1.1 const CIMConstQualifierDecl& qualifierDecl)
645 {
646 qualifierDecl._checkRep();
647 qualifierDecl._rep->toMof(out);
|
648 kumpf 1.2 }
649
650 //------------------------------------------------------------------------------
651 //
652 // getQualifierFlavor()
653 //
654 // Convert the Qualifier flavors to a string of MOF flavor keywords.
655 //
656 // <pre>
657 // Keyword Function Default
658 // EnableOverride Qualifier is overridable. yes
|
659 kumpf 1.10 // DisableOverride Qualifier cannot be overridden. no
|
660 kumpf 1.2 // ToSubclass Qualifier is inherited by any subclass. yes
661 // Restricted Qualifier applies only to the class no
662 // in which it is declared
663 // Translatable Indicates the value of the qualifier
|
664 kumpf 1.10 // can be specified in multiple languages no
|
665 kumpf 1.2 // NOTE: There is an open issue with the keyword toinstance.
666 //
667 // flavor = ENABLEOVERRIDE | DISABLEOVERRIDE | RESTRICTED |
668 // TOSUBCLASS | TRANSLATABLE
|
669 kumpf 1.10 // DISABLEOVERRIDE = "disableoverride"
|
670 kumpf 1.2 //
671 // ENABLEOVERRIDE = "enableoverride"
672 //
673 // RESTRICTED = "restricted"
674 //
675 // TOSUBCLASS = "tosubclass"
676 //
677 // TRANSLATABLE = "translatable"
678 // </pre>
679 //
680 // The keyword toinstance is not in the CIM specification. For the moment
681 // we are assuming that it is the same as the toSubclass. We had a choice
682 // of using one entity for both or separating them and letting the
683 // compiler set both.
684 //
685 //------------------------------------------------------------------------------
686
|
687 kumpf 1.10 String MofWriter::getQualifierFlavor(const CIMFlavor & flavor)
|
688 kumpf 1.2 {
|
689 david.dillard 1.24 String tmp;
|
690 kumpf 1.2
|
691 kumpf 1.10 if (!(flavor.hasFlavor (CIMFlavor::OVERRIDABLE)))
|
692 kumpf 1.14 tmp.append("DisableOverride, ");
|
693 kumpf 1.2
|
694 kumpf 1.10 if (!(flavor.hasFlavor (CIMFlavor::TOSUBCLASS)))
|
695 kumpf 1.14 tmp.append("Restricted, ");
|
696 kumpf 1.2
697 // ATTN-RK-P3-20020515: FUTURE: Need to check toInstance flavor?
|
698 kumpf 1.10 //if (!(flavor.hasFlavor (CIMFlavor::TOINSTANCE)))
|
699 kumpf 1.14 // tmp.append("Restricted, ");
|
700 kumpf 1.2
|
701 kumpf 1.10 if (flavor.hasFlavor (CIMFlavor::TRANSLATABLE))
|
702 kumpf 1.14 tmp.append("Translatable, ");
|
703 kumpf 1.2
704 if (tmp.size())
705 tmp.remove(tmp.size() - 2);
706
707 return tmp;
|
708 kumpf 1.3 }
709
710 //------------------------------------------------------------------------------
711 //
712 // getQualifierScope()
713 //
714 //------------------------------------------------------------------------------
715
|
716 kumpf 1.9 String MofWriter::getQualifierScope (const CIMScope & scope)
|
717 kumpf 1.3 {
|
718 kumpf 1.11 if (scope.equal (CIMScope::ANY))
|
719 kumpf 1.3 {
720 return "any";
721 }
722 else
723 {
|
724 kumpf 1.9 String tmp = scope.toString ();
|
725 kumpf 1.3 tmp.toLower();
726 return tmp;
727 }
|
728 kumpf 1.1 }
729
730 PEGASUS_NAMESPACE_END
|