Esempio n. 1
0
type_class_def  ReturnClass( type_def *tipe, call_attributes attr )
/*****************************************************************/
{
    switch( tipe->refno ) {
    case TY_INT_1:
    case TY_UINT_1:
    case TY_INT_2:
    case TY_UINT_2:
    case TY_INT_4:
    case TY_UINT_4:
    case TY_INT_8:
    case TY_UINT_8:
        return( MapIntReturn( tipe->refno ) );
    case TY_NEAR_POINTER:
    case TY_NEAR_CODE_PTR:
    case TY_HUGE_POINTER:
    case TY_LONG_CODE_PTR:
    case TY_LONG_POINTER:
        return( MapPointer( tipe->refno ) );
    case TY_SINGLE:
    case TY_DOUBLE:
    case TY_LONG_DOUBLE:
        return( MapFloat( tipe->refno, attr ) );
    default:
        return( MapStruct( tipe->length, attr ) );
    }
}
gwc::IntermediateGestureEvent::IntermediateGestureEvent(const IntermediateGestureEvent& e){
	gesture_type = NULL;
	if(e.gesture_type){
		gesture_type = (char*) LocalAlloc(LPTR, sizeof(char) * (1 + strlen(e.gesture_type)));
		std::strncpy(gesture_type, e.gesture_type, strlen(e.gesture_type));
	}
	
	gesture_id = NULL;
	if(e.gesture_id){
		gesture_id = (char*) LocalAlloc(LPTR, sizeof(char) * (1 + strlen(e.gesture_id)));
		std::strncpy(gesture_id, e.gesture_id, strlen(e.gesture_id));
	}
	target = NULL;
	if(e.target){
		target = (char*) LocalAlloc(LPTR, sizeof(char) * (1 + strlen(e.target)));
		std::strncpy(target, e.target, strlen(e.target));
	}
	locked_points = NULL;
	if(e.locked_points){
		locked_points = (int*) LocalAlloc(LPTR, sizeof(int) * e.n);
		for(int i = 0; i < e.n; i++){
			locked_points[i] = e.locked_points[i];
		}
	}

	source = e.source;
	phase = e.phase;
	timestamp = e.timestamp;
	n = e.n;
	ID = e.ID;
	hold_n = e.hold_n;
	x = e.x;
	y = e.y;
	values = MapStruct(e.values);
}
gwc::IntermediateGestureEvent& gwc::IntermediateGestureEvent::operator= (const gwc::IntermediateGestureEvent& other){
	if(this != &other){
		if(this->gesture_type != NULL){ LocalFree(this->gesture_type); gesture_type = NULL; }
		if(this->gesture_id != NULL){ LocalFree(gesture_id); gesture_id = NULL; }
		if(this->target != NULL){ LocalFree(target); target = NULL; }

		if(other.locked_points){
			this->locked_points = (int*) LocalAlloc(LPTR, sizeof(int) * other.n);
			for(int i = 0; i < other.n; i++){
				this->locked_points[i] = other.locked_points[i];
			}
		}
		if(other.target){
			this->target = (char*) LocalAlloc(LPTR, sizeof(char) * (1 + strlen(other.target)));
			std::strncpy(this->target, other.target, strlen(other.target));
		}
		if(other.gesture_type){
			this->gesture_type = (char*) LocalAlloc(LPTR, sizeof(char) * (1 + strlen(other.gesture_type)));
			std::strncpy(this->gesture_type, other.gesture_type, strlen(other.gesture_type));
		}
		if(other.gesture_id){
			this->gesture_id = (char*) LocalAlloc(LPTR, sizeof(char) * (1 + strlen(other.gesture_id)));
			std::strncpy(this->gesture_id, other.gesture_id, strlen(other.gesture_id));
		}
		
		this->source = other.source;
		this->phase = other.phase;
		this->timestamp = other.timestamp;
		this->ID = other.ID;
		this->n = other.n;
		this->hold_n = other.n;
		this->x = other.x;
		this->y = other.y;
		this->values = MapStruct(other.values);
	}
	return *this;
}