}
private:
-public class Id : uint
+public class Id : uint64
{
class_data Table * table; class_property Table * table { set { class_data(table) = value; } get { return class_data(table); } };
//class_data Field * idField; class_property Field * idField { set { class_data(nameField) = value; } get { return class_data(idField); } };
bool DataBox::NotifySelect(DropBox control, DataRow row, Modifiers mods)
{
- // TOFIX: Id is still 32 bit
- uint id = (uint)(row ? row.tag : 0);
+ Id id = (Id)(row ? row.tag : 0);
SetData(&id, mods.closingDropDown);
return true;
}
dropBox.Create();
dropBox.currentRow = dropBox.FindSubRow(this);
if(!dropBox.currentRow && this)
- dataBox.SetData((uint *)&this, false);
+ dataBox.SetData((Id *)&this, false);
{
DataRow r = dropBox.currentRow;
if(r)
{
if(&this)
{
+ Id thisID = this;
// FIXME
Table tbl = class_data(table) ? *class_data(table) : null;
if(tbl)
}
r = tbl.cachedIdRow;
- if(this)
+ if(thisID)
{
- if(r.Find(idField, middle, nil, this))
+ if(r.Find(idField, middle, nil, thisID))
{
String name = null;
Field * nameField = class_data(nameField);
type = dataType;
}
if(type.type == structClass)
- data = (int64)new0 byte[type.structSize];
- ((bool (*)())(void *)r.GetData)(r, *nameField, type, (type.type == structClass) ? (void *)data : &data);
+ data = (int64)(intptr)new0 byte[type.structSize];
+ ((bool (*)())(void *)r.GetData)(r, *nameField, type, (type.type == structClass) ? (void *)(intptr)data : &data);
if(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass)
name = ((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, (void *)&data, tempString, null, null);
else
- name = ((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, (void *)data, tempString, null, null);
+ name = ((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, (void *)(intptr)data, tempString, null, null);
if(name && name != tempString)
strcpy(tempString, name ? name : "");
if(!(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass))
- ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data);
+ ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)(intptr)data);
}
else
{
}
}
else
- sprintf(tempString, "(Invalid %s entry: %d)", tbl.name, this);
+ {
+ sprintf(tempString, "(Invalid %s entry: "
+ #if defined(__WIN32__)
+ "%I64d"
+ #else
+ "%lld"
+ #endif
+ ")", tbl.name, thisID);
+ }
}
else
{
}
else
{
- uint id = this;
+ Id id = thisID;
id.OnGetString(tempString, null, null);
}
}
stringOutput[0] = 0;
if(this)
{
- int c;
- for(c = 0; c<count; c++)
+ Class type = class_data(type);
+ if(type)
{
char tempString[256];
- Class type = class_data(type);
- String s;
- if(c) strcat(stringOutput, ", ");
+ int c;
+ for(c = 0; c<count; c++)
+ {
+ String s = ((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &ids[c], tempString, null, null);
+ if(c) strcat(stringOutput, ", ");
- if(type)
- s = ((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &ids[c], tempString, null, null);
- // strcatf(stringOutput, "%d", ids[c]);
- strcat(stringOutput, s);
+ // strcatf(stringOutput, "%d", ids[c]);
+ strcat(stringOutput, s);
+ }
}
}
return stringOutput;
int c;
for(c = 0; c<count; c++)
{
- int idA = ids[c], idB = b.ids[c];
+ Id idA = ids[c], idB = b.ids[c];
if(idA > idB) return 1;
else if(idA < idB) return -1;
}
if(row == listBox.lastRow)
{
row = listBox.AddRow();
- row.SetData(null, 0);
+ row.SetData(null, (Id)0);
listBox.scroll.y = listBox.scrollArea.h;
}
else if(row.next == listBox.lastRow)
r.SetData(null, ids[c]);
}
r = list.AddRow();
- r.SetData(null, 0);
+ r.SetData(null, (Id)0);
list.Create();
list.modifiedDocument = false;
return list;
}
}
+public class IdList32 : IdList
+{
+ void OnUnserialize(IOChannel channel)
+ {
+ int c, count;
+
+ this = null;
+
+ channel.Unserialize(count);
+ if(count != MAXDWORD)
+ {
+ IdList idList = eInstance_New(_class);
+ idList.count = count;
+ idList.ids = new Id[count];
+ for(c = 0; c < count; c++)
+ {
+ uint32 id;
+ channel.Unserialize(id);
+ idList.ids[c] = id;
+ }
+ this = idList;
+ }
+ }
+
+ void OnSerialize(IOChannel channel)
+ {
+ if(this)
+ {
+ int c;
+ channel.Serialize(count);
+ for(c = 0; c < count; c++)
+ channel.Serialize((uint32)ids[c]);
+ }
+ else
+ {
+ Id none = MAXDWORD;
+ channel.Serialize((uint32)none);
+ }
+ }
+}
+
+public class IdListIncludes : SQLCustomFunction
+{
+ // Should private methods be added to the component system?
+public:
+ bool function(IdList list, Id id)
+ {
+ return list.Includes(id);
+ }
+}
+
+public class IdList32Includes : SQLCustomFunction
+{
+ // Should private methods be added to the component system?
+public:
+ bool function(IdList32 list, Id id)
+ {
+ return list.Includes(id);
+ }
+}
+
static void FreeString(String string)
{
delete string;
if(type.type == normalClass || type.type == structClass || type.type == noHeadClass)
listBox.AddRow().SetData(null, null);
else
- listBox.AddRow().SetData(null, 0);
+ listBox.AddRow().SetData(null, (Id)0);
listBox.scroll.y = listBox.scrollArea.h;
listBox.alwaysEdit = true;
}
// if(type.type != normalClass || strcmp(type.dataTypeString, "char *"))
if(type)
{
- void * data = ((type.type == normalClass || type.type == noHeadClass || type.type == structClass) ? row.GetData(null) : (void *)(uintptr)*(uint *)row.GetData(null));
+ void * data = ((type.type == normalClass || type.type == noHeadClass || type.type == structClass) ? row.GetData(null) : (void *)(uintptr)*(Id *)row.GetData(null));
if(!data)
{
//if(strcmp(type.dataTypeString, char *"))
if(type.type == normalClass || type.type == structClass || type.type == noHeadClass)
lastRow.SetData(null, null);
else
- lastRow.SetData(null, 0);
+ lastRow.SetData(null, (Id)0);
}
}
};
if(type.type == normalClass || type.type == structClass || type.type == noHeadClass)
r.SetData(null, null);
else
- r.SetData(null, 0);
+ r.SetData(null, (Id)0);
list.Create();
list.modifiedDocument = false;
return list;