misc/libphysfs/lzma/CPP/Common/MyGuidDef.h
branchui-scaling
changeset 15283 c4fd2813b127
parent 13390 0135e64c6c66
parent 15279 7ab5cf405686
child 15663 d92eeb468dad
equal deleted inserted replaced
13390:0135e64c6c66 15283:c4fd2813b127
     1 // Common/MyGuidDef.h
       
     2 
       
     3 #ifndef GUID_DEFINED
       
     4 #define GUID_DEFINED
       
     5 
       
     6 #include "Types.h"
       
     7 
       
     8 typedef struct {
       
     9   UInt32 Data1;
       
    10   UInt16 Data2;
       
    11   UInt16 Data3;
       
    12   unsigned char Data4[8];
       
    13 } GUID;
       
    14 
       
    15 #ifdef __cplusplus
       
    16 #define REFGUID const GUID &
       
    17 #else
       
    18 #define REFGUID const GUID *
       
    19 #endif
       
    20 
       
    21 #define REFCLSID REFGUID
       
    22 #define REFIID REFGUID
       
    23 
       
    24 #ifdef __cplusplus
       
    25 inline int operator==(REFGUID g1, REFGUID g2)
       
    26 { 
       
    27   for (int i = 0; i < (int)sizeof(g1); i++)
       
    28     if (((unsigned char *)&g1)[i] != ((unsigned char *)&g2)[i])
       
    29       return 0;
       
    30   return 1;
       
    31 }
       
    32 inline int operator!=(REFGUID g1, REFGUID g2) { return !(g1 == g2); }
       
    33 #endif
       
    34 
       
    35 #ifdef __cplusplus
       
    36   #define MY_EXTERN_C extern "C"
       
    37 #else
       
    38   #define MY_EXTERN_C extern
       
    39 #endif
       
    40 
       
    41 #endif // GUID_DEFINED
       
    42 
       
    43 
       
    44 #ifdef DEFINE_GUID
       
    45 #undef DEFINE_GUID
       
    46 #endif
       
    47 
       
    48 #ifdef INITGUID
       
    49   #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
       
    50     MY_EXTERN_C const GUID name = { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
       
    51 #else
       
    52   #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
       
    53     MY_EXTERN_C const GUID name
       
    54 #endif