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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2