1 karl 1.23 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.9 //
|
3 karl 1.21 // 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.20 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.21 // 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.22 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.23 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.9 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 kumpf 1.12 // 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 mike 1.9 // 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.12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.9 // 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.12 // 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 mike 1.9 // 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 // Author: Mike Brasher (mbrasher@bmc.com)
33 //
|
34 kumpf 1.15 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
35 // (carolann_graves@hp.com)
|
36 mike 1.9 //
37 //%/////////////////////////////////////////////////////////////////////////////
38
39 #include "DeclContext.h"
40 #include "CIMName.h"
|
41 humberto 1.19 #include <Pegasus/Common/MessageLoader.h> //l10n
|
42 mike 1.9
43 PEGASUS_NAMESPACE_BEGIN
44
45 DeclContext::~DeclContext()
46 {
47
48 }
49
50 SimpleDeclContext::~SimpleDeclContext()
51 {
52
53 }
54
55 void SimpleDeclContext::addQualifierDecl(
|
56 kumpf 1.14 const CIMNamespaceName& nameSpace,
|
57 mike 1.9 const CIMQualifierDecl& x)
58 {
|
59 humberto 1.19 if (!lookupQualifierDecl(nameSpace, x.getName()).isUninitialized()){
60 //l10n
61 //throw AlreadyExistsException("declaration of qualifier \"" +
62 //x.getName().getString () + "\"");
63 MessageLoaderParms parms("Common.DeclContext.DECLARATION_OF_QUALIFIER",
64 "declaration of qualifier \"$0\"",
65 x.getName().getString());
66 throw AlreadyExistsException(parms);
67 }
|
68 mike 1.9
69 _qualifierDeclarations.append(QPair(nameSpace, x));
70 }
71
72 void SimpleDeclContext::addClass(
|
73 kumpf 1.14 const CIMNamespaceName& nameSpace,
|
74 mike 1.9 const CIMClass& x)
75 {
|
76 humberto 1.19 if (!lookupClass(nameSpace, x.getClassName()).isUninitialized()){
77 //l10n
78 //throw AlreadyExistsException
79 //("class \"" + x.getClassName().getString () + "\"");
80 MessageLoaderParms parms("Common.DeclContext.CLASS",
81 "class \"$0\"",
82 x.getClassName().getString());
83 throw AlreadyExistsException(parms);
84 }
|
85 mike 1.9
86 _classDeclarations.append(CPair(nameSpace, x));
87 }
88
89 CIMQualifierDecl SimpleDeclContext::lookupQualifierDecl(
|
90 kumpf 1.14 const CIMNamespaceName& nameSpace,
91 const CIMName& name) const
|
92 mike 1.9 {
93 for (Uint32 i = 0, n = _qualifierDeclarations.size(); i < n; i++)
94 {
|
95 kumpf 1.14 const CIMNamespaceName& first = _qualifierDeclarations[i].first;
|
96 mike 1.9 const CIMQualifierDecl& second = _qualifierDeclarations[i].second;
97
|
98 kumpf 1.14 if (first.equal(nameSpace) &&
|
99 kumpf 1.13 second.getName().equal(name))
|
100 mike 1.9 {
101 return second;
102 }
103 }
104
105 // Not found:
106 return CIMQualifierDecl();
107 }
108
109 CIMClass SimpleDeclContext::lookupClass(
|
110 kumpf 1.14 const CIMNamespaceName& nameSpace,
111 const CIMName& name) const
|
112 mike 1.9 {
113 for (Uint32 i = 0, n = _classDeclarations.size(); i < n; i++)
114 {
|
115 kumpf 1.14 const CIMNamespaceName& first = _classDeclarations[i].first;
|
116 mike 1.9 const CIMClass& second = _classDeclarations[i].second;
117
|
118 kumpf 1.14 if (first.equal(nameSpace) &&
|
119 kumpf 1.13 second.getClassName().equal(name))
|
120 mike 1.9 {
121 return second;
122 }
123 }
124
125 // Not found:
126 return CIMClass();
127 }
128
129 PEGASUS_NAMESPACE_END
|