version 1.7, 2001/06/16 23:10:04
|
version 1.19, 2003/07/31 14:27:33
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
|
// The Open Group, Tivoli Systems |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: |
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "DeclContext.h" | #include "DeclContext.h" |
#include "CIMName.h" | #include "CIMName.h" |
|
#include <Pegasus/Common/MessageLoader.h> //l10n |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
#define PEGASUS_ARRAY_T QPair |
|
# include "ArrayImpl.h" |
|
#undef PEGASUS_ARRAY_T |
|
|
|
#define PEGASUS_ARRAY_T CPair |
|
# include "ArrayImpl.h" |
|
#undef PEGASUS_ARRAY_T |
|
|
|
DeclContext::~DeclContext() | DeclContext::~DeclContext() |
{ | { |
| |
|
|
} | } |
| |
void SimpleDeclContext::addQualifierDecl( | void SimpleDeclContext::addQualifierDecl( |
const String& nameSpace, |
const CIMNamespaceName& nameSpace, |
const CIMQualifierDecl& x) | const CIMQualifierDecl& x) |
{ | { |
if (lookupQualifierDecl(nameSpace, x.getName())) |
if (!lookupQualifierDecl(nameSpace, x.getName()).isUninitialized()){ |
throw AlreadyExists(); |
//l10n |
|
//throw AlreadyExistsException("declaration of qualifier \"" + |
|
//x.getName().getString () + "\""); |
|
MessageLoaderParms parms("Common.DeclContext.DECLARATION_OF_QUALIFIER", |
|
"declaration of qualifier \"$0\"", |
|
x.getName().getString()); |
|
throw AlreadyExistsException(parms); |
|
} |
| |
_qualifierDeclarations.append(QPair(nameSpace, x)); | _qualifierDeclarations.append(QPair(nameSpace, x)); |
} | } |
| |
void SimpleDeclContext::addClass( | void SimpleDeclContext::addClass( |
const String& nameSpace, |
const CIMNamespaceName& nameSpace, |
const CIMClass& x) | const CIMClass& x) |
{ | { |
if (lookupClass(nameSpace, x.getClassName())) |
if (!lookupClass(nameSpace, x.getClassName()).isUninitialized()){ |
throw AlreadyExists(); |
//l10n |
|
//throw AlreadyExistsException |
|
//("class \"" + x.getClassName().getString () + "\""); |
|
MessageLoaderParms parms("Common.DeclContext.CLASS", |
|
"class \"$0\"", |
|
x.getClassName().getString()); |
|
throw AlreadyExistsException(parms); |
|
} |
| |
_classDeclarations.append(CPair(nameSpace, x)); | _classDeclarations.append(CPair(nameSpace, x)); |
} | } |
| |
CIMQualifierDecl SimpleDeclContext::lookupQualifierDecl( | CIMQualifierDecl SimpleDeclContext::lookupQualifierDecl( |
const String& nameSpace, |
const CIMNamespaceName& nameSpace, |
const String& name) const |
const CIMName& name) const |
{ | { |
for (Uint32 i = 0, n = _qualifierDeclarations.size(); i < n; i++) | for (Uint32 i = 0, n = _qualifierDeclarations.size(); i < n; i++) |
{ | { |
const String& first = _qualifierDeclarations[i].first; |
const CIMNamespaceName& first = _qualifierDeclarations[i].first; |
const CIMQualifierDecl& second = _qualifierDeclarations[i].second; | const CIMQualifierDecl& second = _qualifierDeclarations[i].second; |
| |
if (CIMName::equal(first, nameSpace) && |
if (first.equal(nameSpace) && |
CIMName::equal(second.getName(), name)) |
second.getName().equal(name)) |
{ | { |
return second; | return second; |
} | } |
|
|
} | } |
| |
CIMClass SimpleDeclContext::lookupClass( | CIMClass SimpleDeclContext::lookupClass( |
const String& nameSpace, |
const CIMNamespaceName& nameSpace, |
const String& name) const |
const CIMName& name) const |
{ | { |
for (Uint32 i = 0, n = _classDeclarations.size(); i < n; i++) | for (Uint32 i = 0, n = _classDeclarations.size(); i < n; i++) |
{ | { |
const String& first = _classDeclarations[i].first; |
const CIMNamespaceName& first = _classDeclarations[i].first; |
const CIMClass& second = _classDeclarations[i].second; | const CIMClass& second = _classDeclarations[i].second; |
| |
if (CIMName::equal(first, nameSpace) && |
if (first.equal(nameSpace) && |
CIMName::equal(second.getClassName(), name)) |
second.getClassName().equal(name)) |
{ | { |
return second; | return second; |
} | } |