version 1.5, 2001/04/08 01:13:21
|
version 1.13, 2001/06/16 23:10:03
|
|
|
//BEGIN_LICENSE |
//%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// copy of this software and associated documentation files (the "Software"), |
// of this software and associated documentation files (the "Software"), to |
// to deal in the Software without restriction, including without limitation |
// deal in the Software without restriction, including without limitation the |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// and/or sell copies of the Software, and to permit persons to whom the |
// sell copies of the Software, and to permit persons to whom the Software is |
// Software is furnished to do so, subject to the following conditions: |
// furnished to do so, subject to the following conditions: |
// | // |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
// DEALINGS IN THE SOFTWARE. |
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// | // |
//END_LICENSE |
//============================================================================== |
//BEGIN_HISTORY |
|
// | // |
// Author: |
// Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// $Log$ |
// Modified By: |
// Revision 1.5 2001/04/08 01:13:21 mike |
|
// Changed "ConstCIM" to "CIMConst" |
|
// | // |
// Revision 1.3 2001/02/20 05:16:57 mike |
//%///////////////////////////////////////////////////////////////////////////// |
// Implemented CIMInstance::getInstanceName() |
|
// |
|
// Revision 1.2 2001/02/19 01:47:16 mike |
|
// Renamed names of the form CIMConst to CIMConst. |
|
// |
|
// Revision 1.1 2001/02/18 18:39:06 mike |
|
// new |
|
// |
|
// Revision 1.3 2001/02/18 03:56:01 mike |
|
// Changed more class names (e.g., ConstClassDecl -> CIMConstClass) |
|
// |
|
// Revision 1.2 2001/02/17 00:41:28 bob |
|
// #ifdefed around the check of scope to avoid bogus exceptions |
|
// |
|
// Revision 1.1 2001/02/16 02:07:06 mike |
|
// Renamed many classes and headers (using new CIM prefixes). |
|
// |
|
// Revision 1.5 2001/02/13 02:06:40 mike |
|
// Added renameFile() method. |
|
// |
|
// Revision 1.4 2001/01/28 04:11:03 mike |
|
// fixed qualifier resolution |
|
// |
|
// Revision 1.3 2001/01/23 01:25:35 mike |
|
// Reworked resolve scheme. |
|
// |
|
// Revision 1.2 2001/01/22 00:45:47 mike |
|
// more work on resolve scheme |
|
// |
|
// Revision 1.1.1.1 2001/01/14 19:53:09 mike |
|
// Pegasus import |
|
// |
|
// |
|
//END_HISTORY |
|
| |
#include "CIMQualifierList.h" | #include "CIMQualifierList.h" |
#include "DeclContext.h" | #include "DeclContext.h" |
|
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
CIMQualifierList::CIMQualifierList() |
|
{ |
|
|
|
} |
|
|
|
CIMQualifierList::~CIMQualifierList() |
|
{ |
|
|
|
} |
|
|
CIMQualifierList& CIMQualifierList::add(const CIMQualifier& qualifier) | CIMQualifierList& CIMQualifierList::add(const CIMQualifier& qualifier) |
{ | { |
if (!qualifier) | if (!qualifier) |
throw UnitializedHandle(); | throw UnitializedHandle(); |
| |
if (find(qualifier.getName()) != Uint32(-1)) |
if (find(qualifier.getName()) != PEG_NOT_FOUND) |
throw AlreadyExists(); | throw AlreadyExists(); |
| |
_qualifiers.append(qualifier); | _qualifiers.append(qualifier); |
| |
return *this; | return *this; |
} | } |
|
//ATTN: Why do we not do the outofbounds check here. KS 18 May 2k |
|
CIMQualifier& CIMQualifierList::getQualifier(Uint32 pos) |
|
{ |
|
return _qualifiers[pos]; |
|
} |
|
|
|
//ATTN: added ks 18 may 2001. Should we have outofbounds? |
|
void CIMQualifierList::removeQualifier(Uint32 pos) |
|
{ |
|
_qualifiers.remove(pos); |
|
} |
| |
Uint32 CIMQualifierList::find(const String& name) const | Uint32 CIMQualifierList::find(const String& name) const |
{ | { |
for (Uint32 i = 0, n = _qualifiers.getSize(); i < n; i++) |
for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++) |
{ | { |
if (CIMName::equal(_qualifiers[i].getName(), name)) | if (CIMName::equal(_qualifiers[i].getName(), name)) |
return i; | return i; |
} | } |
| |
return Uint32(-1); |
return PEG_NOT_FOUND; |
} | } |
| |
Uint32 CIMQualifierList::findReverse(const String& name) const | Uint32 CIMQualifierList::findReverse(const String& name) const |
{ | { |
for (Uint32 i = _qualifiers.getSize(); i; --i) |
for (Uint32 i = _qualifiers.size(); i; --i) |
{ | { |
if (CIMName::equal(_qualifiers[i - 1].getName(), name)) | if (CIMName::equal(_qualifiers[i - 1].getName(), name)) |
return i - 1; | return i - 1; |
} | } |
| |
return Uint32(-1); |
return PEG_NOT_FOUND; |
} | } |
| |
void CIMQualifierList::resolve( | void CIMQualifierList::resolve( |
|
|
// If the qualifier should be overriden, then it is injected into the | // If the qualifier should be overriden, then it is injected into the |
// qualifiers array (from the inheritedQualifiers array). | // qualifiers array (from the inheritedQualifiers array). |
| |
for (Uint32 i = 0, n = _qualifiers.getSize(); i < n; i++) |
for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++) |
{ | { |
CIMQualifier q = _qualifiers[i]; | CIMQualifier q = _qualifiers[i]; |
| |
|
|
#if 0 | #if 0 |
Uint32 pos = inheritedQualifiers.find(q.getName()); | Uint32 pos = inheritedQualifiers.find(q.getName()); |
| |
if (pos != Uint32(-1)) |
if (pos != PEG_NOT_FOUND) |
{ | { |
CIMConstQualifier iq = inheritedQualifiers.getQualifier(pos); | CIMConstQualifier iq = inheritedQualifiers.getQualifier(pos); |
| |
|
|
// If the qualifiers list does not already contain this qualifier, | // If the qualifiers list does not already contain this qualifier, |
// then propagate it (and set the propagated flag to true). | // then propagate it (and set the propagated flag to true). |
| |
if (find(iq.getName()) != Uint32(-1)) |
if (find(iq.getName()) != PEG_NOT_FOUND) |
continue; | continue; |
| |
CIMQualifier q = iq.clone(); | CIMQualifier q = iq.clone(); |
|
|
| |
void CIMQualifierList::toXml(Array<Sint8>& out) const | void CIMQualifierList::toXml(Array<Sint8>& out) const |
{ | { |
for (Uint32 i = 0, n = _qualifiers.getSize(); i < n; i++) |
for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++) |
_qualifiers[i].toXml(out); | _qualifiers[i].toXml(out); |
} | } |
| |
void CIMQualifierList::print(std::ostream &os) const |
void CIMQualifierList::print(PEGASUS_STD(ostream) &os) const |
{ | { |
Array<Sint8> tmp; | Array<Sint8> tmp; |
toXml(tmp); | toXml(tmp); |
tmp.append('\0'); | tmp.append('\0'); |
os << tmp.getData() << std::endl; |
os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
Boolean CIMQualifierList::identical(const CIMQualifierList& x) const | Boolean CIMQualifierList::identical(const CIMQualifierList& x) const |
|
|
void CIMQualifierList::cloneTo(CIMQualifierList& x) const | void CIMQualifierList::cloneTo(CIMQualifierList& x) const |
{ | { |
x._qualifiers.clear(); | x._qualifiers.clear(); |
x._qualifiers.reserve(_qualifiers.getSize()); |
x._qualifiers.reserve(_qualifiers.size()); |
| |
for (Uint32 i = 0, n = _qualifiers.getSize(); i < n; i++) |
for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++) |
x._qualifiers.append(_qualifiers[i].clone()); | x._qualifiers.append(_qualifiers[i].clone()); |
} | } |
| |