Modeled after the already existing esxVI_GetLong.
+int
+esxVI_GetInt(esxVI_ObjectContent *objectContent, const char *propertyName,
+ esxVI_Int **value, esxVI_Occurrence occurence)
+{
+ esxVI_DynamicProperty *dynamicProperty;
+
+ if (!value || *value) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ return -1;
+ }
+
+ for (dynamicProperty = objectContent->propSet; dynamicProperty;
+ dynamicProperty = dynamicProperty->_next) {
+ if (STREQ(dynamicProperty->name, propertyName)) {
+ if (esxVI_Int_CastFromAnyType(dynamicProperty->val, value) < 0)
+ return -1;
+
+ break;
+ }
+ }
+
+ if (!(*value) && occurence == esxVI_Occurrence_RequiredItem) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing '%s' property"), propertyName);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+
int
esxVI_GetLong(esxVI_ObjectContent *objectContent, const char *propertyName,
esxVI_Long **value, esxVI_Occurrence occurrence)
const char *propertyName,
esxVI_Boolean *value, esxVI_Occurrence occurrence);
+int esxVI_GetInt(esxVI_ObjectContent *objectContent, const char *propertyName,
+ esxVI_Int **value, esxVI_Occurrence occurrence);
+
int esxVI_GetLong(esxVI_ObjectContent *objectContent, const char *propertyName,
esxVI_Long **value, esxVI_Occurrence occurrence);
(*dest)->value = src->value;
})
+/* esxVI_Int_CastFromAnyType */
+ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(Int)
+
/* esxVI_Int_Serialize */
ESX_VI__TEMPLATE__SERIALIZE(Int,
{
int esxVI_Int_Validate(esxVI_Int *number);
int esxVI_Int_AppendToList(esxVI_Int **numberList, esxVI_Int *number);
int esxVI_Int_DeepCopy(esxVI_Int **dest, esxVI_Int *src);
+int esxVI_Int_CastFromAnyType(esxVI_AnyType *anyType, esxVI_Int **number);
int esxVI_Int_Serialize(esxVI_Int *number, const char *element,
virBufferPtr output);
int esxVI_Int_SerializeList(esxVI_Int *numberList, const char *element,