(file) Return to DeclContext.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2