30.11.2013 - New PICollection namespace, Android support, my own PIVector implementation
This commit is contained in:
@@ -166,7 +166,7 @@ uint PIVariant::variableSize(const PIVariant::Type & var) {
|
||||
}
|
||||
|
||||
|
||||
double PIVariant::variableValue(const char * var_ptr, const PIVariant::Type & var) {
|
||||
double PIVariant::variableValue(const void * var_ptr, const PIVariant::Type & var) {
|
||||
switch (var) {
|
||||
case PIVariant::Bool: return (double)(*((bool * )var_ptr));
|
||||
case PIVariant::Char: return (double)(*((char * )var_ptr));
|
||||
@@ -194,22 +194,22 @@ void PIVariable::setVariable(const PIString & str) {
|
||||
}
|
||||
|
||||
|
||||
void PIVariable::writeVariable(char * dest) {
|
||||
void PIVariable::writeVariable(void * dest) {
|
||||
switch (type_) {
|
||||
case PIVariant::Bool: *((bool * )((long)dest + offset)) = value_ > 0.; return;
|
||||
case PIVariant::Char: *((char * )((long)dest + offset)) = char(value_); return;
|
||||
case PIVariant::Short: *((short * )((long)dest + offset)) = short(value_); return;
|
||||
case PIVariant::Int: *((int * )((long)dest + offset)) = int(value_); return;
|
||||
case PIVariant::Long: *((long * )((long)dest + offset)) = long(value_); return;
|
||||
case PIVariant::LLong: *((llong * )((long)dest + offset)) = llong(value_); return;
|
||||
case PIVariant::UChar: *((uchar * )((long)dest + offset)) = uchar(value_); return;
|
||||
case PIVariant::UShort: *((ushort * )((long)dest + offset)) = ushort(value_); return;
|
||||
case PIVariant::UInt: *((uint * )((long)dest + offset)) = uint(value_); return;
|
||||
case PIVariant::ULong: *((ulong * )((long)dest + offset)) = ulong(value_); return;
|
||||
case PIVariant::ULLong: *((ullong * )((long)dest + offset)) = ullong(value_); return;
|
||||
case PIVariant::Float: *((float * )((long)dest + offset)) = float(value_); return;
|
||||
case PIVariant::Double: *((double * )((long)dest + offset)) = value_; return;
|
||||
case PIVariant::LDouble: *((ldouble * )((long)dest + offset)) = ldouble(value_); return;
|
||||
case PIVariant::Bool: *((bool * )((ullong)dest + offset)) = value_ > 0.; return;
|
||||
case PIVariant::Char: *((char * )((ullong)dest + offset)) = char(value_); return;
|
||||
case PIVariant::Short: *((short * )((ullong)dest + offset)) = short(value_); return;
|
||||
case PIVariant::Int: *((int * )((ullong)dest + offset)) = int(value_); return;
|
||||
case PIVariant::Long: *((long * )((ullong)dest + offset)) = long(value_); return;
|
||||
case PIVariant::LLong: *((llong * )((ullong)dest + offset)) = llong(value_); return;
|
||||
case PIVariant::UChar: *((uchar * )((ullong)dest + offset)) = uchar(value_); return;
|
||||
case PIVariant::UShort: *((ushort * )((ullong)dest + offset)) = ushort(value_); return;
|
||||
case PIVariant::UInt: *((uint * )((ullong)dest + offset)) = uint(value_); return;
|
||||
case PIVariant::ULong: *((ulong * )((ullong)dest + offset)) = ulong(value_); return;
|
||||
case PIVariant::ULLong: *((ullong * )((ullong)dest + offset)) = ullong(value_); return;
|
||||
case PIVariant::Float: *((float * )((ullong)dest + offset)) = float(value_); return;
|
||||
case PIVariant::Double: *((double * )((ullong)dest + offset)) = value_; return;
|
||||
case PIVariant::LDouble: *((ldouble * )((ullong)dest + offset)) = ldouble(value_); return;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -236,13 +236,13 @@ void PIStruct::parseFile(const PIString & file) {
|
||||
}
|
||||
|
||||
|
||||
void PIStruct::readData(const char * data) {
|
||||
void PIStruct::readData(const void * data) {
|
||||
for (uint i = 0; i < vars.size(); ++i)
|
||||
vars[i].readVariable(data);
|
||||
}
|
||||
|
||||
|
||||
void PIStruct::writeData(char * data) {
|
||||
void PIStruct::writeData(void * data) {
|
||||
for (uint i = 0; i < vars.size(); ++i)
|
||||
vars[i].writeVariable(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user