00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "eyedb_p.h"
00030 #include <iostream>
00031
00032 namespace eyedb {
00033
00034 const Attribute *Union::setCurrentItem(const Attribute *ni)
00035 {
00036 const Attribute *old = item;
00037 item = ni;
00038
00039 Offset offset = IDB_OBJ_HEAD_SIZE;
00040 Size alloc_size = idr->getSize();
00041 Data data = idr->getIDR();
00042
00043 if (item)
00044 {
00045 eyedblib::int16 num = item->getNum();
00046 int16_code(&data, &offset, &alloc_size, &num);
00047 }
00048 else
00049 {
00050 eyedblib::int16 k = -1;
00051 int16_code(&data, &offset, &alloc_size, &k);
00052 }
00053
00054
00055 return old;
00056 }
00057
00058 const Attribute *Union::getCurrentItem() const
00059 {
00060
00061
00062
00063
00064 return item;
00065 }
00066
00067 const Attribute *Union::decodeCurrentItem(const Class *cls,
00068 Data idr)
00069 {
00070 eyedblib::int16 num;
00071 const Attribute *item;
00072
00073 Offset offset = IDB_OBJ_HEAD_SIZE;
00074 int16_decode(idr, &offset, &num);
00075
00076 if (num >= 0)
00077 item = ((AgregatClass *)cls)->getAttributes()[num];
00078 else
00079 item = 0;
00080
00081 return item;
00082 }
00083
00084 const Attribute *Union::decodeCurrentItem()
00085 {
00086 item = decodeCurrentItem(getClass(), idr->getIDR());
00087 return item;
00088 }
00089 }