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

  1 mike  1.1 //BEGIN_LICENSE
  2           //
  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           //END_LICENSE
 21           //BEGIN_HISTORY
 22 mike  1.1 //
 23           // Author:
 24           //
 25           // $Log$
 26           //
 27           //END_HISTORY
 28           
 29           #include "DeclContext.h"
 30           #include "Name.h"
 31           
 32           PEGASUS_NAMESPACE_BEGIN
 33           
 34           DeclContext::~DeclContext()
 35           {
 36           
 37           }
 38           
 39           SimpleDeclContext::~SimpleDeclContext()
 40           {
 41           
 42           }
 43 mike  1.1 
 44           void SimpleDeclContext::addQualifierDecl(
 45               const String& nameSpace,
 46               const QualifierDecl& x)
 47           {
 48               if (lookupQualifierDecl(nameSpace, x.getName()))
 49           	throw AlreadyExists();
 50           
 51               _qualifierDeclarations.append(QPair(nameSpace, x));
 52           }
 53           
 54           void SimpleDeclContext::addClassDecl(
 55               const String& nameSpace,
 56               const ClassDecl& x)
 57           {
 58               if (lookupClassDecl(nameSpace, x.getClassName()))
 59           	throw AlreadyExists();
 60           
 61               _classDeclarations.append(CPair(nameSpace, x));
 62           }
 63           
 64 mike  1.1 QualifierDecl SimpleDeclContext::lookupQualifierDecl(
 65               const String& nameSpace,
 66               const String& name) const
 67           {
 68               for (Uint32 i = 0, n = _qualifierDeclarations.getSize(); i < n; i++)
 69               {
 70           	const String& first = _qualifierDeclarations[i].first;
 71           	const QualifierDecl& second = _qualifierDeclarations[i].second;
 72           
 73           	if (Name::equal(first, nameSpace) && 
 74           	    Name::equal(second.getName(), name))
 75           	{
 76           	    return second;
 77           	}
 78               }
 79           
 80               // Not found:
 81               return QualifierDecl();
 82           }
 83           
 84           ClassDecl SimpleDeclContext::lookupClassDecl(
 85 mike  1.1     const String& nameSpace,
 86               const String& name) const
 87           {
 88               for (Uint32 i = 0, n = _classDeclarations.getSize(); i < n; i++)
 89               {
 90           	const String& first = _classDeclarations[i].first;
 91           	const ClassDecl& second = _classDeclarations[i].second;
 92           
 93           	if (Name::equal(first, nameSpace) && 
 94           	    Name::equal(second.getClassName(), name))
 95           	{
 96           	    return second;
 97           	}
 98               }
 99           
100               // Not found:
101               return ClassDecl();
102           }
103           
104           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2