Listing 5: Creation of Key/Value pairs


#ifdef _USEMAP
#include "Globals.h"

CKey key1(FORMAT1, '$');
CValue value1(offsetof(sVariantRecord, sFormat1.Amount), FLOAT);
pair_type p1 (key1, value1);

CKey key2(FORMAT1, 'D');
CValue value2(offsetof(sVariantRecord, sFormat1.Date), STRING);
pair_type p2 (key2, value2);

CKey key3(FORMAT2, 'D');
CValue value3(offsetof(sVariantRecord, sFormat2.Date), STRING);
pair_type p3 (key3, value3);
    
CKey key4(FORMAT2, 'T');
CValue value4(offsetof(sVariantRecord, sFormat2.Desc), STRING);
pair_type p4 (key4, value4);

CKey key5(FORMAT3, '$');
CValue value5(offsetof(sVariantRecord, sFormat3.Amount), FLOAT);
pair_type p5 (key5, value5);

CKey key6(FORMAT3, 'D');
CValue value6(offsetof(sVariantRecord, sFormat3.Date), STRING);
pair_type p6 (key6, value6);

CKey key7(FORMAT3, 'T');
CValue value7(offsetof(sVariantRecord, sFormat3.Desc), STRING);
pair_type p7 (key7, value7);

pair_type array [] =
{
    p1,
    p2,
    p3,
    p4,
    p5,
    p6,
    p7,
};

mymap m(array, array + 7);
mymap::iterator j;
#endif//End of File