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