convert a C Enum to the delphi? -
i wrote delphi numeric c enum can answer me , can may had mistake? there wrong?
c:
typedef enum { attributestandardinformation = 0x10, attributeattributelist = 0x20, attributefilename = 0x30, attributeobjectid = 0x40, attributesecuritydescriptor = 0x50, attributevolumename = 0x60, attributevolumeinformation = 0x70, attributedata = 0x80, attributeindexroot = 0x90, attributeindexallocation = 0xa0, attributebitmap = 0xb0, attributereparsepoint = 0xc0, attributeeainformation = 0xd0, attributeea = 0xe0, attributepropertyset = 0xf0, attributeloggedutilitystream = 0x100 } attribute_type
and converted delphi enum:
attribute_type=( attributestandardinformation = $10, attributeattributelist = $20, attributefilename = $30, attributeobjectid = $40, attributesecuritydescriptor = $50, attributevolumename = $60, attributevolumeinformation = $70, attributedata = $80, //attributedata1 = $0, // has problem attributeindexroot = $90, attributeindexallocation = $a0, attributebitmap = $b0, attributereparsepoint = $c0, attributeeainformation = $d0, attributeea = $e0, attributepropertyset = $f0, attributeloggedutilitystream = $100, );
in c enum @ least 4 bytes, can use {$minenumsize 4} directive in delphi achieve same.
apart last comma, mentioned, conversion correct. although it's better translate enum numeric constants since in c enum value , integer interchangeable not case in delphi (you can of course cast enum integer , vice versa).
Comments
Post a Comment