version 1.43, 2005/03/27 21:45:45
|
version 1.48, 2005/11/07 23:15:59
|
|
|
#include "XmlWriter.h" | #include "XmlWriter.h" |
#include "MofWriter.h" | #include "MofWriter.h" |
#include <Pegasus/Common/MessageLoader.h> //l10n | #include <Pegasus/Common/MessageLoader.h> //l10n |
|
#include "StrLit.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
CIMMethodRep::CIMMethodRep() |
|
{ |
|
} |
|
|
|
CIMMethodRep::CIMMethodRep(const CIMMethodRep& x) : |
|
Sharable(), |
|
_name(x._name), |
|
_type(x._type), |
|
_classOrigin(x._classOrigin), |
|
_propagated(x._propagated) |
|
{ |
|
x._qualifiers.cloneTo(_qualifiers); |
|
|
|
_parameters.reserveCapacity(x._parameters.size()); |
|
|
|
for (Uint32 i = 0, n = x._parameters.size(); i < n; i++) |
|
{ |
|
_parameters.append(x._parameters[i].clone()); |
|
} |
|
} |
|
|
CIMMethodRep::CIMMethodRep( | CIMMethodRep::CIMMethodRep( |
const CIMName& name, | const CIMName& name, |
CIMType type, | CIMType type, |
|
|
: _name(name), _type(type), | : _name(name), _type(type), |
_classOrigin(classOrigin), _propagated(propagated) | _classOrigin(classOrigin), _propagated(propagated) |
{ | { |
|
// ensure name is not null |
|
if(name.isNull()) |
|
{ |
|
throw UninitializedObjectException(); |
|
} |
} | } |
| |
CIMMethodRep::~CIMMethodRep() | CIMMethodRep::~CIMMethodRep() |
{ | { |
|
|
} | } |
| |
void CIMMethodRep::setName(const CIMName& name) | void CIMMethodRep::setName(const CIMName& name) |
{ | { |
|
// ensure name is not null |
|
if(name.isNull()) |
|
{ |
|
throw UninitializedObjectException(); |
|
} |
|
|
_name = name; | _name = name; |
} | } |
| |
|
|
return x ? "true" : "false"; | return x ? "true" : "false"; |
} | } |
| |
void CIMMethodRep::toXml(Array<char>& out) const |
void CIMMethodRep::toXml(Buffer& out) const |
{ | { |
out << "<METHOD"; |
out << STRLIT("<METHOD NAME=\"") << _name; |
|
out.append('"'); |
| |
out << " NAME=\"" << _name << "\""; |
out << STRLIT(" TYPE=\"") << cimTypeToString(_type); |
|
out.append('"'); |
out << " TYPE=\"" << cimTypeToString (_type) << "\""; |
|
| |
if (!_classOrigin.isNull()) | if (!_classOrigin.isNull()) |
out << " CLASSORIGIN=\"" << _classOrigin << "\""; |
{ |
|
out << STRLIT(" CLASSORIGIN=\"") << _classOrigin; |
|
out.append('"'); |
|
} |
| |
if (_propagated != false) | if (_propagated != false) |
out << " PROPAGATED=\"" << _toString(_propagated) << "\""; |
{ |
|
out << STRLIT(" PROPAGATED=\"") << _toString(_propagated); |
|
out.append('"'); |
|
} |
| |
out << ">\n"; |
out << STRLIT(">\n"); |
| |
_qualifiers.toXml(out); | _qualifiers.toXml(out); |
| |
for (Uint32 i = 0, n = _parameters.size(); i < n; i++) | for (Uint32 i = 0, n = _parameters.size(); i < n; i++) |
XmlWriter::appendParameterElement(out, _parameters[i]); | XmlWriter::appendParameterElement(out, _parameters[i]); |
| |
out << "</METHOD>\n"; |
out << STRLIT("</METHOD>\n"); |
} | } |
| |
/** | /** |
|
|
Format with qualifiers on one line and declaration on another. Start | Format with qualifiers on one line and declaration on another. Start |
with newline but none at the end. | with newline but none at the end. |
*/ | */ |
void CIMMethodRep::toMof(Array<char>& out) const //ATTNKS: |
void CIMMethodRep::toMof(Buffer& out) const //ATTNKS: |
{ | { |
// Output the qualifier list starting on new line | // Output the qualifier list starting on new line |
if (_qualifiers.getCount()) | if (_qualifiers.getCount()) |
out << "\n"; |
out.append('\n'); |
| |
_qualifiers.toMof(out); | _qualifiers.toMof(out); |
| |
// output the type, MethodName and ParmeterList left enclosure | // output the type, MethodName and ParmeterList left enclosure |
out << "\n" << cimTypeToString (_type) << " " << _name << "("; |
out.append('\n'); |
|
out << cimTypeToString(_type); |
|
out.append(' '); |
|
out << _name; |
|
out.append('('); |
| |
// output the param list separated by commas. | // output the param list separated by commas. |
| |
|
|
{ | { |
// If not first, output comma separator | // If not first, output comma separator |
if (i) | if (i) |
out << ", "; |
out << STRLIT(", "); |
| |
MofWriter::appendParameterElement(out, _parameters[i]); | MofWriter::appendParameterElement(out, _parameters[i]); |
} | } |
| |
// output the parameterlist and method terminator | // output the parameterlist and method terminator |
out << ");"; |
out << STRLIT(");"); |
} | } |
| |
| |
CIMMethodRep::CIMMethodRep() |
|
{ |
|
|
|
} |
|
|
|
CIMMethodRep::CIMMethodRep(const CIMMethodRep& x) : |
|
Sharable(), |
|
_name(x._name), |
|
_type(x._type), |
|
_classOrigin(x._classOrigin), |
|
_propagated(x._propagated) |
|
{ |
|
x._qualifiers.cloneTo(_qualifiers); |
|
|
|
_parameters.reserveCapacity(x._parameters.size()); |
|
|
|
for (Uint32 i = 0, n = x._parameters.size(); i < n; i++) |
|
_parameters.append(x._parameters[i].clone()); |
|
} |
|
|
|
Boolean CIMMethodRep::identical(const CIMMethodRep* x) const | Boolean CIMMethodRep::identical(const CIMMethodRep* x) const |
{ | { |
if (!_name.equal (x->_name)) | if (!_name.equal (x->_name)) |