本文整理汇总了C++中CIMProperty类的典型用法代码示例。如果您正苦于以下问题:C++ CIMProperty类的具体用法?C++ CIMProperty怎么用?C++ CIMProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CIMProperty类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _getClass
int _getClass(const int argc, const char **argv)
{
if (argv[0]==0)
{
cerr << "Usage: cimop getClass|gc <class>" << endl;
return 1;
}
CIMClass cldef;
try
{
cldef = _c.getClass( _nameSpace, argv[0] );
}
catch (Exception& e)
{
cerr << /* "getClass: " << */ e.getMessage() << endl;
return 1;
}
// Display the class definition
// without qualifiers, for the moment
// First the class name and superclass
cout << "class " << cldef.getClassName().getString() << " : "
<< cldef.getSuperClassName().getString() << endl;
cout << "{" << endl;
// Now the properties
// No qualifiers except [key], but specify type, array
for (int i=0; i<cldef.getPropertyCount(); i++)
{
CIMProperty p = cldef.getProperty(i);
cout << " ";
// output key, if required
if (_isKey(p)) cout << "[ Key ] ";
// prepare to output type, but
// first, if type is "reference", find target class
if (p.getType() == CIMTYPE_REFERENCE)
cout << p.getReferenceClassName().getString() << " REF ";
// output type
else cout << cimTypeToString(p.getType()) << " ";
// output name
cout << p.getName().getString();
// output array, if required
if (p.isArray()) cout << "[]";
// final eol
cout << ";" << endl;
}
// need to do methods
for (int i=0; i<cldef.getMethodCount(); i++)
{
CIMMethod m = cldef.getMethod(i);
// output type
cout << " " << cimTypeToString(m.getType()) << " ";
// output name
cout << m.getName().getString() << "(";
// output parameters
// new line if there are any parameters
for (int j=0; j<m.getParameterCount(); j++)
{
CIMParameter p = m.getParameter(j);
// output IN/OUT qualifiers on a fresh line
cout << endl << " [ ";
// loop through qualifiers looking for IN, OUT
for (int k=0; k<p.getQualifierCount(); k++)
{
// when one found, output its value
CIMQualifier q = p.getQualifier(k);
if (q.getName().equal("in") ||
q.getName().equal("out"))
{
cout << q.getName().getString() << " ";
}
}
// Now the type
cout << "] " << cimTypeToString(p.getType()) << " ";
// finally the name
cout << p.getName().getString();
// array brackets
if (p.isArray()) cout << "[]";
// closing , on parameter if not last
if (j != m.getParameterCount()-1) cout << ",";
}
// after last param, indent before closing paren
// close paren
cout << ")";
// if (m.isArray()) cout << "[]";
// finish output
cout << ";" << endl;
}
// final brace and done
cout << "};" << endl;
return 0;
}