Append "Byte" to set of predefined datatype objects. Signed-off-by: Ata E Husain Bohra <ata.husain@xxxxxxxxxxx> --- src/esx/esx_vi_generator.py | 1 + src/esx/esx_vi_types.c | 57 +++++++++++++++++++++++++++++++++++++++++++ src/esx/esx_vi_types.h | 29 ++++++++++++++++++++++ 3 files changed, 87 insertions(+) diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index 910478c..af2d57e 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -1496,6 +1496,7 @@ def open_and_print(filename): predefined_enums = ["Boolean"] predefined_objects = ["AnyType", + "Byte", "Int", "Long", "String", diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index 708aeda..d7bd3b7 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -774,6 +774,9 @@ esxVI_Type_ToString(esxVI_Type type) case esxVI_Type_String: return "xsd:string"; + case esxVI_Type_Byte: + return "xsd:byte"; + case esxVI_Type_Short: return "xsd:short"; @@ -816,6 +819,8 @@ esxVI_Type_FromString(const char *type) return esxVI_Type_AnyType; } else if (STREQ(type, "xsd:string")) { return esxVI_Type_String; + } else if (STREQ(type, "xsd:byte")) { + return esxVI_Type_Byte; } else if (STREQ(type, "xsd:short")) { return esxVI_Type_Short; } else if (STREQ(type, "xsd:int")) { @@ -942,6 +947,10 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src) (*dest)->string = (*dest)->value; break; + case esxVI_Type_Byte: + (*dest)->int8 = src->int8; + break; + case esxVI_Type_Short: (*dest)->int16 = src->int16; break; @@ -1059,6 +1068,10 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType) (*anyType)->string = (*anyType)->value; break; + case esxVI_Type_Byte: + _DESERIALIZE_NUMBER(Byte, "xsd:byte", int8, INT8_MIN, INT8_MAX); + break; + case esxVI_Type_Short: _DESERIALIZE_NUMBER(Short, "xsd:short", int16, INT16_MIN, INT16_MAX); break; @@ -1299,6 +1312,50 @@ esxVI_String_DeserializeValue(xmlNodePtr node, char **value) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * XSD: Byte + */ + +/* esxVI_Byte_Alloc */ +ESX_VI__TEMPLATE__ALLOC(Byte) + +/* esxVI_Byte_Free */ +ESX_VI__TEMPLATE__FREE(Byte, +{ + esxVI_Byte_Free(&item->_next); +}) + +/* esxVI_Byte_Validate */ +ESX_VI__TEMPLATE__VALIDATE(Byte, +{ +}) + +/* esxVI_Byte_AppendToList */ +ESX_VI__TEMPLATE__LIST__APPEND(Byte) + +/* esxVI_Byte_DeepCopy */ +ESX_VI__TEMPLATE__DEEP_COPY(Byte, +{ + (*dest)->value = src->value; +}) + +/* esxVI_Byte_DeepCopyList */ +ESX_VI__TEMPLATE__LIST__DEEP_COPY(Byte) + +/* esxVI_Byte_Serialize */ +ESX_VI__TEMPLATE__SERIALIZE(Byte, +{ + virBufferAsprintf(output, "%d", (int8_t)item->value); +}) + +/* esxVI_Byte_SerializeList */ +ESX_VI__TEMPLATE__LIST__SERIALIZE(Byte) + +/* esxVI_Byte_Deserialize */ +ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Byte, "xsd:byte", INT8_MIN, INT8_MAX); + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * XSD: Int */ diff --git a/src/esx/esx_vi_types.h b/src/esx/esx_vi_types.h index dbcfee0..4df0157 100644 --- a/src/esx/esx_vi_types.h +++ b/src/esx/esx_vi_types.h @@ -38,6 +38,7 @@ typedef struct _esxVI_ManagedObject esxVI_ManagedObject; typedef enum _esxVI_Boolean esxVI_Boolean; typedef struct _esxVI_AnyType esxVI_AnyType; typedef struct _esxVI_String esxVI_String; +typedef struct _esxVI_Byte esxVI_Byte; typedef struct _esxVI_Int esxVI_Int; typedef struct _esxVI_Long esxVI_Long; typedef struct _esxVI_DateTime esxVI_DateTime; @@ -73,6 +74,7 @@ enum _esxVI_Type { esxVI_Type_Boolean, esxVI_Type_AnyType, esxVI_Type_String, + esxVI_Type_Byte, esxVI_Type_Short, esxVI_Type_Int, esxVI_Type_Long, @@ -146,6 +148,7 @@ struct _esxVI_AnyType { union { esxVI_Boolean boolean; /* optional */ char *string; /* optional */ + int8_t int8; /* optional */ int16_t int16; /* optional */ int32_t int32; /* optional */ int64_t int64; /* optional */ @@ -199,6 +202,32 @@ int esxVI_String_DeserializeValue(xmlNodePtr node, char **value); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * XSD: Byte + */ + +struct _esxVI_Byte { + esxVI_Byte *_next; /* optional */ + esxVI_Type _type; /* required */ + + int8_t value; /* required */ +}; + +int esxVI_Byte_Alloc(esxVI_Byte **number); +void esxVI_Byte_Free(esxVI_Byte **numberList); +int esxVI_Byte_Validate(esxVI_Byte *number); +int esxVI_Byte_AppendToList(esxVI_Byte **numberList, esxVI_Byte *number); +int esxVI_Byte_DeepCopy(esxVI_Byte **dest, esxVI_Byte *src); +int esxVI_Byte_DeepCopyList(esxVI_Byte **destList, esxVI_Byte *srcList); +int esxVI_Byte_Serialize(esxVI_Byte *number, const char *element, + virBufferPtr output); +int esxVI_Byte_SerializeList(esxVI_Byte *numberList, const char *element, + virBufferPtr output); +int esxVI_Byte_Deserialize(xmlNodePtr node, esxVI_Byte **number); + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * XSD: Int */ -- 1.7.9.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list