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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2