10 for(
unsigned long i = 0; i < count; i++)
12 Items *buf = items[i];
15 unsigned int len = buf->key.length();
18 if(!fd.
write(&(buf->data.count),
sizeof(buf->data.count)))
return fd.
getLastErrNo();
19 for(
int j = 0; j < buf->data.count; j++)
21 if(!fd.
write(&(buf->data.type[j]),
sizeof(buf->data.type[j])))
return fd.
getLastErrNo();
22 switch(buf->data.type[j])
27 if(!fd.
write(&(buf->data.data[j].integer),
sizeof(buf->data.data[j].integer)))
return fd.
getLastErrNo();
32 if(!fd.
write(&(buf->data.data[j].real),
sizeof(buf->data.data[j].real)))
return fd.
getLastErrNo();
37 char *str = buf->data.data[j].string;
54 int fd = open(filename, O_RDONLY);
57 unsigned long oldCount = count;
60 memset(items, 0,
sizeof(Items*) * count);
61 unsigned int bufLen = 256;
62 char *buf = (
char*)malloc(bufLen);
66 if(read(fd, &len,
sizeof(len)) !=
sizeof(len))
break;
67 if(bufLen < len){bufLen = len; buf = (
char*)realloc(buf, bufLen);}
68 if(read(fd, buf, len) != (int)len)
break;
71 if(read(fd, &data.
count,
sizeof(data.
count)) !=
sizeof(data.
count))
break;
78 for(
int j = 0; j < data.
count; j++)
80 if(read(fd, &data.
type[j],
sizeof(data.
type[j])) !=
sizeof(data.
type[j]))
break;
96 read(fd, &(len),
sizeof(len));
97 if(bufLen < len + 1){bufLen = len + 1; buf = (
char*)realloc(buf, bufLen);}
119 va_start(list, code);
127 char *
name = va_arg(list,
char*);
132 String comma(
","), commaL(
";");
134 for(
unsigned int i = 0; params[i]; i++)
141 for(
int j = 0; j < data->
count; j++)
144 switch(data->
type[j])
155 sprintf(buffer,
"%f", data->
data[j].
real);
175 retVal = retVal + ret + comma;
179 retVal = retVal + null + comma;
183 char *
ret =
new(std::nothrow)
char[retVal.
length() + 1];
190 ret[retVal.
length()] =
'\0';
196 if(!name || !*name)
return;
199 if((old = hash.find(
String(name))) == NULL)
204 hash.insert(
String(name), data);
208 if(old->
count < slot + 1)
223 if(!name || !*name)
return;
226 if((old = hash.find(
String(name))) == NULL)
230 data.
data[slot].
real = isnan(value)!=0 ? 0.0:value;
231 hash.insert(
String(name), data);
235 if(old->
count < slot + 1)
250 if(!value || !name || !*name)
return;
253 if((old = hash.find(
String(name))) == NULL)
258 hash.insert(
String(name), data);
262 if(old->
count < slot + 1)
280 if(data != NULL && slot < data->count)
303 if(data != NULL && slot < data->count)
321 if(data && slot < data->count)
333 if(data && slot < data->count)
349 if(data && slot < data->count)