1 mike 1.9 //%/////////////////////////////////////////////////////////////////////////////
2 //
|
3 kumpf 1.12 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
|
5 mike 1.9 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 kumpf 1.12 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10 mike 1.9 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
|
13 kumpf 1.12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
14 mike 1.9 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
16 kumpf 1.12 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
19 mike 1.9 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 //==============================================================================
23 //
24 // Author: Mike Brasher (mbrasher@bmc.com)
25 //
|
26 kumpf 1.15 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
27 // (carolann_graves@hp.com)
|
28 mike 1.9 //
29 //%/////////////////////////////////////////////////////////////////////////////
30
31 #include "DeclContext.h"
32 #include "CIMName.h"
33
34 PEGASUS_NAMESPACE_BEGIN
35
36 DeclContext::~DeclContext()
37 {
38
39 }
40
41 SimpleDeclContext::~SimpleDeclContext()
42 {
43
44 }
45
46 void SimpleDeclContext::addQualifierDecl(
|
47 kumpf 1.14 const CIMNamespaceName& nameSpace,
|
48 mike 1.9 const CIMQualifierDecl& x)
49 {
|
50 kumpf 1.15 if (!lookupQualifierDecl(nameSpace, x.getName()).isUninitialized())
|
51 mike 1.9 throw AlreadyExists();
52
53 _qualifierDeclarations.append(QPair(nameSpace, x));
54 }
55
56 void SimpleDeclContext::addClass(
|
57 kumpf 1.14 const CIMNamespaceName& nameSpace,
|
58 mike 1.9 const CIMClass& x)
59 {
|
60 kumpf 1.15 if (!lookupClass(nameSpace, x.getClassName()).isUninitialized())
|
61 mike 1.9 throw AlreadyExists();
62
63 _classDeclarations.append(CPair(nameSpace, x));
64 }
65
66 CIMQualifierDecl SimpleDeclContext::lookupQualifierDecl(
|
67 kumpf 1.14 const CIMNamespaceName& nameSpace,
68 const CIMName& name) const
|
69 mike 1.9 {
70 for (Uint32 i = 0, n = _qualifierDeclarations.size(); i < n; i++)
71 {
|
72 kumpf 1.14 const CIMNamespaceName& first = _qualifierDeclarations[i].first;
|
73 mike 1.9 const CIMQualifierDecl& second = _qualifierDeclarations[i].second;
74
|
75 kumpf 1.14 if (first.equal(nameSpace) &&
|
76 kumpf 1.13 second.getName().equal(name))
|
77 mike 1.9 {
78 return second;
79 }
80 }
81
82 // Not found:
83 return CIMQualifierDecl();
84 }
85
86 CIMClass SimpleDeclContext::lookupClass(
|
87 kumpf 1.14 const CIMNamespaceName& nameSpace,
88 const CIMName& name) const
|
89 mike 1.9 {
90 for (Uint32 i = 0, n = _classDeclarations.size(); i < n; i++)
91 {
|
92 kumpf 1.14 const CIMNamespaceName& first = _classDeclarations[i].first;
|
93 mike 1.9 const CIMClass& second = _classDeclarations[i].second;
94
|
95 kumpf 1.14 if (first.equal(nameSpace) &&
|
96 kumpf 1.13 second.getClassName().equal(name))
|
97 mike 1.9 {
98 return second;
99 }
100 }
101
102 // Not found:
103 return CIMClass();
104 }
105
106 PEGASUS_NAMESPACE_END
|