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 mike 1.2 // $Log: DeclContext.cpp,v $
26 // Revision 1.1.1.1 2001/01/14 19:51:13 mike
27 // Pegasus import
28 //
|
29 mike 1.1 //
30 //END_HISTORY
31
32 #include "DeclContext.h"
|
33 mike 1.2 #include "CIMName.h"
|
34 mike 1.1
35 PEGASUS_NAMESPACE_BEGIN
36
37 DeclContext::~DeclContext()
38 {
39
40 }
41
42 SimpleDeclContext::~SimpleDeclContext()
43 {
44
45 }
46
47 void SimpleDeclContext::addQualifierDecl(
48 const String& nameSpace,
|
49 mike 1.2 const CIMQualifierDecl& x)
|
50 mike 1.1 {
51 if (lookupQualifierDecl(nameSpace, x.getName()))
52 throw AlreadyExists();
53
54 _qualifierDeclarations.append(QPair(nameSpace, x));
55 }
56
57 void SimpleDeclContext::addClassDecl(
58 const String& nameSpace,
|
59 mike 1.2 const CIMClass& x)
|
60 mike 1.1 {
61 if (lookupClassDecl(nameSpace, x.getClassName()))
62 throw AlreadyExists();
63
64 _classDeclarations.append(CPair(nameSpace, x));
65 }
66
|
67 mike 1.2 CIMQualifierDecl SimpleDeclContext::lookupQualifierDecl(
|
68 mike 1.1 const String& nameSpace,
69 const String& name) const
70 {
71 for (Uint32 i = 0, n = _qualifierDeclarations.getSize(); i < n; i++)
72 {
73 const String& first = _qualifierDeclarations[i].first;
|
74 mike 1.2 const CIMQualifierDecl& second = _qualifierDeclarations[i].second;
|
75 mike 1.1
|
76 mike 1.2 if (CIMName::equal(first, nameSpace) &&
77 CIMName::equal(second.getName(), name))
|
78 mike 1.1 {
79 return second;
80 }
81 }
82
83 // Not found:
|
84 mike 1.2 return CIMQualifierDecl();
|
85 mike 1.1 }
86
|
87 mike 1.2 CIMClass SimpleDeclContext::lookupClassDecl(
|
88 mike 1.1 const String& nameSpace,
89 const String& name) const
90 {
91 for (Uint32 i = 0, n = _classDeclarations.getSize(); i < n; i++)
92 {
93 const String& first = _classDeclarations[i].first;
|
94 mike 1.2 const CIMClass& second = _classDeclarations[i].second;
|
95 mike 1.1
|
96 mike 1.2 if (CIMName::equal(first, nameSpace) &&
97 CIMName::equal(second.getClassName(), name))
|
98 mike 1.1 {
99 return second;
100 }
101 }
102
103 // Not found:
|
104 mike 1.2 return CIMClass();
|
105 mike 1.1 }
106
107 PEGASUS_NAMESPACE_END
|