6 public class IteratorPointer : struct;
9 extern int __ecereVMethodID_class_OnCompare;
10 extern int __ecereVMethodID_class_OnFree;
11 extern int __ecereVMethodID_class_OnGetString;
14 public struct BuiltInContainer
25 property Container { get { return this; } }
27 virtual IteratorPointer GetFirst() { return data; }
28 virtual IteratorPointer GetLast() { return (IteratorPointer)(data ? ((byte *)data + (count * type.typeSize) - 1) : null); }
29 virtual IteratorPointer GetPrev(IteratorPointer pointer)
31 return (IteratorPointer)((pointer && (byte *)pointer > (byte *)data) ?
32 ((byte *)pointer - type.typeSize) : null);
34 virtual IteratorPointer GetNext(IteratorPointer pointer)
36 return (IteratorPointer)((pointer && (byte *)pointer < (byte *)data + (count - 1) * type.typeSize) ?
37 ((byte *)pointer + type.typeSize) : null);
39 virtual uint64 GetData(IteratorPointer pointer)
41 uint64 * item = (uint64 *)pointer;
42 return ((((type.type == structClass) ? ((uint64)(uintptr)item) :
43 ((type.typeSize == 1) ? *((unsigned char *)item) :
44 ((type.typeSize == 2) ? *((unsigned short *)item) :
45 ((type.typeSize == 4) ? *((unsigned int *)item) : *((uint64 *)item)))))));
47 virtual bool SetData(IteratorPointer pointer, uint64 data)
51 virtual IteratorPointer GetAtPosition(const uint64 pos, bool create)
53 return data ? (IteratorPointer)((byte *)data + type.typeSize) : null;
55 virtual IteratorPointer Insert(IteratorPointer after, uint64 value)
59 virtual IteratorPointer Add(uint64 value)
63 virtual void Remove(IteratorPointer it)
66 virtual void Move(IteratorPointer it, IteratorPointer after)
69 virtual void RemoveAll()
72 for(i = GetFirst(); i; i = GetNext(i))
76 virtual void Copy(Container source)
80 virtual IteratorPointer Find(uint64 value)
83 for(i = GetFirst(); i; i = GetNext(i))
85 uint64 data = GetData(i);
87 int result = ((int (*)(void *, void *, void *))(void *)Dclass._vTbl[__ecereVMethodID_class_OnCompare])(Dclass,
88 ((Dclass.type == systemClass && !Dclass.byValueSystemClass) || Dclass.type == bitClass || Dclass.type == enumClass || Dclass.type == unitClass) ? &value : (void *)(uintptr)value,
89 ((Dclass.type == systemClass && !Dclass.byValueSystemClass) || Dclass.type == bitClass || Dclass.type == enumClass || Dclass.type == unitClass) ? &data : (void *)(uintptr)data);
96 virtual void FreeIterator(IteratorPointer it);
97 virtual int GetCount() { return count; }
102 for(i = GetFirst(); i; i = GetNext(i))
103 ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)(uintptr)GetData(i));
106 virtual void Delete(IteratorPointer it) { }
108 const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
113 char itemString[4096];
115 byte * data = this.data;
117 tempString[0] = '\0';
118 for(i = 0; i < count; i++)
121 itemString[0] = '\0';
122 result = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)Dclass._vTbl[__ecereVMethodID_class_OnGetString])(
123 Dclass, (type.type == normalClass || type.type == noHeadClass) ? *(void **)data : data, itemString, null, null);
124 if(!first) strcat(tempString, ", ");
125 strcat(tempString, result);
127 data += Dclass.typeSize;
135 virtual void Sort(bool ascending)