Пример #1
0
//============================================================================
//		NNumber::NNumber : Constructor.
//----------------------------------------------------------------------------
NNumber::NNumber(const NVariant &theValue)
{


	// Initialise ourselves
	SetUInt8(0);

	if (theValue.IsNumeric())
		SetValue(theValue);
}
Пример #2
0
//============================================================================
//		NNumber::NNumber : Constructor.
//----------------------------------------------------------------------------
NNumber::NNumber(const NString &theValue)
{


	// Initialise ourselves
	SetUInt8(0);

	if (!theValue.IsEmpty())
		SetValue(theValue);
}
Пример #3
0
void CMdbPara::SetNumber(register uint32 nFieldNo, register void* pVal, register uint32 nOperator)
{
	switch(GetType(nFieldNo))
	{
	case MDB_INT8_FIELD:
		SetInt8(nFieldNo, *(int8*)pVal, nOperator);
		break;
	case MDB_INT16_FIELD:
		SetInt16(nFieldNo, *(int16*)pVal, nOperator);
		break;
	case MDB_INT32_FIELD:
		SetInt32(nFieldNo, *(int32*)pVal, nOperator);
		break;
	case MDB_INT64_FIELD:
		SetInt64(nFieldNo, *(int64*)pVal, nOperator);
		break;
	case MDB_UINT8_FIELD:
		SetUInt8(nFieldNo, *(uint8*)pVal, nOperator);
		break;
	case MDB_UINT16_FIELD:
		SetUInt16(nFieldNo, *(uint16*)pVal, nOperator);
		break;
	case MDB_UINT32_FIELD:
		SetUInt32(nFieldNo, *(uint32*)pVal, nOperator);
		break;
	case MDB_UINT64_FIELD:
		SetUInt64(nFieldNo, *(uint64*)pVal, nOperator);
		break;
	case MDB_FLOAT_FIELD:
		SetFloat(nFieldNo, *(float*)pVal, nOperator);
		break;
	case MDB_DOUBLE_FIELD:
		SetDouble(nFieldNo, *(double*)pVal, nOperator);
		break;
	case MDB_DATE_FIELD:
		SetDate(nFieldNo, *(CDate*)pVal, nOperator);
		break;
	case MDB_TIME_FIELD:
		SetTime(nFieldNo, *(CTime*)pVal, nOperator);
		break;
	case MDB_DATETIME_FIELD:
		SetDateTime(nFieldNo, *(CDateTime*)pVal, nOperator);
		break;
	}
}
Пример #4
0
//============================================================================
//		NNumber::SetValue : Set the value.
//----------------------------------------------------------------------------
bool NNumber::SetValue(const NVariant &theValue)
{	UInt8					valueUInt8;
	UInt16					valueUInt16;
	UInt32					valueUInt32;
	UInt64					valueUInt64;
	SInt8					valueSInt8;
	SInt16					valueSInt16;
	SInt32					valueSInt32;
	SInt64					valueSInt64;
	Float32					valueFloat32;
	Float64					valueFloat64;
	int						valueInt;
	long					valueLong;
	NString					valueString;



	// Set the value
	//
	// NVariant treats some unsized types as numeric, to support literal constants.
	if (theValue.GetValue(*this))
		; // Assigned to this

	else if (theValue.GetValue(valueUInt8))
		SetUInt8(valueUInt8);

	else if (theValue.GetValue(valueUInt16))
		SetUInt16(valueUInt16);
	
	else if (theValue.GetValue(valueUInt32))
		SetUInt32(valueUInt32);
	
	else if (theValue.GetValue(valueUInt64))
		SetUInt64(valueUInt64);
	
	else if (theValue.GetValue(valueSInt8))
		SetSInt8(valueSInt8);
	
	else if (theValue.GetValue(valueSInt16))
		SetSInt16(valueSInt16);
	
	else if (theValue.GetValue(valueSInt32))
		SetSInt32(valueSInt32);
	
	else if (theValue.GetValue(valueSInt64))
		SetSInt64(valueSInt64);
	
	else if (theValue.GetValue(valueFloat32))
		SetFloat32(valueFloat32);
	
	else if (theValue.GetValue(valueFloat64))
		SetFloat64(valueFloat64);
	
	else if (theValue.GetValue(valueInt))
		SetSInt64(valueInt);
	
	else if (theValue.GetValue(valueLong))
		SetSInt64(valueLong);
	
	else if (theValue.GetValue(valueString))
		return(SetValue(valueString));

	else
		return(false);

	return(true);
}