version 1.11, 2002/05/24 19:20:33
|
version 1.23, 2006/01/30 16:16:48
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
|
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// 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 |
| |
|
|
} | } |
| |
void SimpleDeclContext::addQualifierDecl( | void SimpleDeclContext::addQualifierDecl( |
const String& nameSpace, |
const CIMNamespaceName& nameSpace, |
const CIMQualifierDecl& x) | const CIMQualifierDecl& x) |
{ | { |
if (!lookupQualifierDecl(nameSpace, x.getName()).isNull()) |
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()).isNull()) |
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; |
} | } |