version 1.73, 2006/05/17 20:06:42
|
version 1.74, 2006/07/21 18:40:55
|
|
|
#include <Pegasus/Common/MessageLoader.h> //l10n | #include <Pegasus/Common/MessageLoader.h> //l10n |
#include "CIMNameUnchecked.h" | #include "CIMNameUnchecked.h" |
#include "StrLit.h" | #include "StrLit.h" |
|
#include "CIMInstanceRep.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
const CIMPropertyList& propertyList) const | const CIMPropertyList& propertyList) const |
{ | { |
| |
// Create the new instance |
// Create the new instance representation |
CIMInstance newInstance(_reference.getClassName()); |
CIMInstanceRep* newInstanceRep = new CIMInstanceRep( |
|
CIMObjectPath(String::EMPTY, |
|
CIMNamespaceName(), |
|
_reference.getClassName())); |
| |
// Copy qualifiers if required | // Copy qualifiers if required |
if (includeQualifiers) | if (includeQualifiers) |
{ | { |
for (Uint32 i = 0 ; i < getQualifierCount() ; i++) | for (Uint32 i = 0 ; i < getQualifierCount() ; i++) |
{ | { |
newInstance.addQualifier(getQualifier(i).clone()); |
newInstanceRep->_qualifiers.add(getQualifier(i).clone()); |
} | } |
} | } |
| |
|
newInstanceRep->_properties.reserveCapacity(_properties.size()); |
|
|
// Copy Properties | // Copy Properties |
for (Uint32 i = 0 ; i < _properties.size() ; i++) | for (Uint32 i = 0 ; i < _properties.size() ; i++) |
{ | { |
CIMConstProperty p = getProperty(i); |
CIMConstProperty cp = getProperty(i); |
CIMName name = p.getName(); |
CIMName name = cp.getName(); |
Array<CIMName> pl = propertyList.getPropertyNameArray(); | Array<CIMName> pl = propertyList.getPropertyNameArray(); |
if (propertyList.isNull() || Contains(pl, name)) | if (propertyList.isNull() || Contains(pl, name)) |
{ | { |
CIMProperty p = getProperty(i).clone(); |
CIMProperty p; |
if (!includeQualifiers && p.getQualifierCount() != 0) |
|
{ |
if (includeQualifiers) |
for (Uint32 j = 0 ; j < getQualifierCount() ; j++) |
|
{ | { |
p.removeQualifier(i - 1); |
p = getProperty(i).clone(); |
} | } |
|
else |
|
{ |
|
p = CIMProperty(cp.getName(), |
|
cp.getValue(), |
|
cp.getArraySize(), |
|
cp.getReferenceClassName(), |
|
cp.getClassOrigin()); |
} | } |
|
|
|
// Delete class origin attribute if required |
if (!includeClassOrigin) | if (!includeClassOrigin) |
{ | { |
p.setClassOrigin(CIMName()); | p.setClassOrigin(CIMName()); |
} | } |
newInstance.addProperty(p); |
|
| |
// Delete class origin attribute if required |
newInstanceRep->_properties.append(p); |
} | } |
} | } |
| |
|
// Create new CIMInstance from CIMInstanceRep |
|
CIMInstance newInstance(newInstanceRep); |
|
|
return(newInstance); | return(newInstance); |
} | } |
| |