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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2