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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2