本文整理汇总了C++中CIMProperty::isArray方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMProperty::isArray方法的具体用法?C++ CIMProperty::isArray怎么用?C++ CIMProperty::isArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMProperty
的用法示例。
在下文中一共展示了CIMProperty::isArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _getClass
int _getClass(const int argc, const char **argv)
{
CIMClass cldef;
try
{
cldef = _c.getClass( PEGASUS_NAMESPACENAME_INTEROP, 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;
}
示例2: validate
void WQLSelectStatementRep::validate()
{
if(_ctx == NULL){
MessageLoaderParms parms(
"WQL.WQLSelectStatementRep.QUERY_CONTEXT_IS_NULL",
"Trying to process a query with a NULL Query Context.");
throw QueryValidationException(parms);
}
CIMClass fromClass;
try
{
fromClass = _ctx->getClass(_className);
CIMObjectPath className (String::EMPTY, _ctx->getNamespace (), _className);
Array<CIMName> whereProps =
getWherePropertyList(className).getPropertyNameArray();
Array<CIMName> selectProps =
getSelectPropertyList(className).getPropertyNameArray();
// make sure all properties match properties on the from class
for(Uint32 i = 0; i < whereProps.size(); i++){
Uint32 index = fromClass.findProperty(whereProps[i]);
if(index == PEG_NOT_FOUND){
MessageLoaderParms parms(
"WQL.WQLSelectStatementRep.PROP_NOT_FOUND",
"The property $0 was not found in the FROM class $1",
whereProps[i].getString(),
fromClass.getClassName().getString());
throw QueryMissingPropertyException(parms);
}
else
{
//
// Property exists in class
// Verify it is not an array property
//
CIMProperty classProperty = fromClass.getProperty(index);
if (classProperty.isArray ())
{
MessageLoaderParms parms(
"WQL.WQLSelectStatementRep.WHERE_PROP_IS_ARRAY",
"Array property $0 is not supported in the WQL WHERE clause.",
whereProps[i].getString());
throw QueryValidationException(parms);
}
}
}
for(Uint32 i = 0; i < selectProps.size(); i++){
if(fromClass.findProperty(selectProps[i]) == PEG_NOT_FOUND){
MessageLoaderParms parms(
"WQL.WQLSelectStatementRep.PROP_NOT_FOUND",
"The property $0 was not found in the FROM class $1",
selectProps[i].getString(),
fromClass.getClassName().getString());
throw QueryMissingPropertyException(parms);
}
}
}
catch (const CIMException& ce)
{
if (ce.getCode() == CIM_ERR_INVALID_CLASS ||
ce.getCode() == CIM_ERR_NOT_FOUND)
{
MessageLoaderParms parms(
"WQL.WQLSelectStatementRep.CLASSNAME_NOT_IN_REPOSITORY",
"The class name $0 was not found in the repository.",
_className.getString());
throw QueryValidationException(parms);
}
else
{
throw;
}
}
}
示例3: _getProperty
int _getProperty(const int argc, const char **argv)
{
if (argc < 2)
{
_gpUsage();
return 1;
}
// need to get class definition to find keys
// first arg is name of class
CIMClass cldef;
try
{
cldef = _c.getClass( _nameSpace, argv[0] );
}
catch(Exception& e)
{
cerr << /* "getProperty: " << */ e.getMessage() << endl;
return 1;
}
CIMObjectPath ref;
CIMInstance inst;
// If next arg is "ask", prompt user for keys
if (String::equalNoCase("ask",argv[1])) ref = CIMObjectPath(String::EMPTY,
_nameSpace,
argv[0],
_inputInstanceKeys(cldef) );
// else if the next arg and is "list", enumInstNames and print
// a list from which user will select
else if (String::equalNoCase("list",argv[1]))
{
ref = _selectInstance( argv[0] );
if (ref.identical(CIMObjectPath())) return 0;
}
// else there's another arg but it's invalid
else
{
_gpUsage();
return 1;
}
CIMProperty pDef;
// if no more args, display property names and ask which
if (argc < 3)
{
int n;
for (n=0; n<cldef.getPropertyCount(); n++)
{
pDef=cldef.getProperty(n);
cout << n+1 << ": ";
cout << cimTypeToString(pDef.getType()) << " ";
cout << pDef.getName().getString();
if (pDef.isArray()) cout << "[]";
cout << endl;
}
cout << "Property (1.." << cldef.getPropertyCount() << ")? " << flush;
cin >> n;
pDef = cldef.getProperty(n-1);
}