1 mike 1.1 //BEGIN_LICENSE
2 //
3 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 // DEALINGS IN THE SOFTWARE.
19 //
20 //END_LICENSE
21 //BEGIN_HISTORY
22 mike 1.1 //
23 // Author:
24 //
25 // $Log: CIMScope.cpp,v $
26 // Revision 1.1 2001/02/16 02:07:06 mike
27 // Renamed many classes and headers (using new CIM prefixes).
28 //
29 // Revision 1.1.1.1 2001/01/14 19:53:12 mike
30 // Pegasus import
31 //
32 //
33 //END_HISTORY
34
35 #include <cstring>
36 #include "CIMScope.h"
37 #include "XmlWriter.h"
38
39 PEGASUS_NAMESPACE_BEGIN
40
41 namespace CIMScope
42 {
43 mike 1.1 const Uint32 NONE = 0;
44 const Uint32 CLASS = 1;
45 const Uint32 ASSOCIATION = 2;
46 const Uint32 INDICATION = 4;
47 const Uint32 PROPERTY = 8;
48 const Uint32 REFERENCE = 16;
49 const Uint32 METHOD = 32;
50 const Uint32 PARAMETER = 64;
51 const Uint32 ANY = (1 | 2 | 4 | 8 | 16 | 32 | 64 );
52 }
53
54 String ScopeToString(Uint32 scope)
55 {
56 String tmp;
57
58 if (scope & CIMScope::CLASS)
59 tmp += "CLASS ";
60
61 if (scope & CIMScope::ASSOCIATION)
62 tmp += "ASSOCIATION ";
63
64 mike 1.1 if (scope & CIMScope::INDICATION)
65 tmp += "INDICATION ";
66
67 if (scope & CIMScope::PROPERTY)
68 tmp += "PROPERTY ";
69
70 if (scope & CIMScope::REFERENCE)
71 tmp += "REFERENCE ";
72
73 if (scope & CIMScope::METHOD)
74 tmp += "METHOD ";
75
76 if (scope & CIMScope::PARAMETER)
77 tmp += "PARAMETER ";
78
79 if (tmp.getLength())
80 tmp.remove(tmp.getLength() - 1);
81
82 return tmp;
83 }
84
85 mike 1.1 void ScopeToXml(Array<Sint8>& out, Uint32 scope)
86 {
87 if (scope)
88 {
89 out << "<SCOPE";
90
91 if (scope & CIMScope::CLASS)
92 out << " CLASS=\"true\"";
93
94 if (scope & CIMScope::ASSOCIATION)
95 out << " ASSOCIATION=\"true\"";
96
97 if (scope & CIMScope::REFERENCE)
98 out << " REFERENCE=\"true\"";
99
100 if (scope & CIMScope::PROPERTY)
101 out << " PROPERTY=\"true\"";
102
103 if (scope & CIMScope::METHOD)
104 out << " METHOD=\"true\"";
105
106 mike 1.1 if (scope & CIMScope::PARAMETER)
107 out << " PARAMETER=\"true\"";
108
109 if (scope & CIMScope::INDICATION)
110 out << " INDICATION=\"true\"";
111
112 out << "/>";
113 }
114 }
115
116 PEGASUS_NAMESPACE_END
|