Append "Byte" to set of predefined object data types. 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 | 28 +++++++++++++++++++++ 3 files changed, 86 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..b287c22 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -777,6 +777,9 @@ esxVI_Type_ToString(esxVI_Type type) case esxVI_Type_Short: return "xsd:short"; + case esxVI_Type_Byte: + return "xsd:byte"; + case esxVI_Type_Int: return "xsd:int"; @@ -818,6 +821,8 @@ esxVI_Type_FromString(const char *type) return esxVI_Type_String; } else if (STREQ(type, "xsd:short")) { return esxVI_Type_Short; + } else if (STREQ(type, "xsd:byte")) { + return esxVI_Type_Byte; } else if (STREQ(type, "xsd:int")) { return esxVI_Type_Int; } else if (STREQ(type, "xsd:long")) { @@ -946,6 +951,10 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src) (*dest)->int16 = src->int16; break; + case esxVI_Type_Byte: + (*dest)->int8 = src->int8; + break; + case esxVI_Type_Int: (*dest)->int32 = src->int32; break; @@ -1063,6 +1072,10 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType) _DESERIALIZE_NUMBER(Short, "xsd:short", int16, INT16_MIN, INT16_MAX); break; + case esxVI_Type_Byte: + _DESERIALIZE_NUMBER(Byte, "xsd:byte", int8, INT8_MIN, INT8_MAX); + break; + case esxVI_Type_Int: _DESERIALIZE_NUMBER(Int, "xsd:int", int32, INT32_MIN, INT32_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, "%c", (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..8298b4c 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; @@ -74,6 +75,7 @@ enum _esxVI_Type { esxVI_Type_AnyType, esxVI_Type_String, esxVI_Type_Short, + esxVI_Type_Byte, esxVI_Type_Int, esxVI_Type_Long, esxVI_Type_DateTime, @@ -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 */ @@ -197,6 +200,31 @@ int esxVI_String_DeserializeList(xmlNodePtr node, esxVI_String **stringList); 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