Beispiel #1
0
const char* IPropertySet::GetSTRING(const void* pData, int nIndex)
{
	assert(nIndex>=0 && nIndex<PropertyCount());
	if(nIndex<0 || nIndex>=PropertyCount()) return NULL;
	IProperty* pInfo = GetProperty(nIndex);
	assert(pInfo->GetType()==PROPERTY_TYPE_STRING);
	if(pInfo->GetType()!=PROPERTY_TYPE_STRING) return NULL;
	return (const char*)pData + pInfo->GetOffset();
}
Beispiel #2
0
unsigned int IPropertySet::GetDWORD(const void* pData, int nIndex)
{
	assert(nIndex>=0 && nIndex<PropertyCount());
	if(nIndex<0 || nIndex>=PropertyCount()) return -1;
	IProperty* pInfo = GetProperty(nIndex);
	assert(pInfo->GetType()==PROPERTY_TYPE_DWORD);
	if(pInfo->GetType()!=PROPERTY_TYPE_DWORD) return -1;
	return *((unsigned int*)((char*)pData + pInfo->GetOffset()));
}
Beispiel #3
0
float IPropertySet::GetFLOAT(const void* pData, int nIndex)
{
	assert(nIndex>=0 && nIndex<PropertyCount());
	if(nIndex<0 || nIndex>=PropertyCount()) return -1;
	IProperty* pInfo = GetProperty(nIndex);
	assert(pInfo->GetType()==PROPERTY_TYPE_FLOAT);
	if(pInfo->GetType()!=PROPERTY_TYPE_FLOAT) return -1;
	return *((float*)((char*)pData + pInfo->GetOffset()));
}
Beispiel #4
0
bool IPropertySet::SetValue(void* pData, int nIndex, char Value)
{
	assert(nIndex>=0 && nIndex<PropertyCount());
	if(nIndex<0 || nIndex>=PropertyCount()) return false;
	IProperty* pInfo = GetProperty(nIndex);
	assert(pInfo->GetType()==PROPERTY_TYPE_CHAR);
	if(pInfo->GetType()!=PROPERTY_TYPE_CHAR) return false;
	*((char*)((char*)pData + pInfo->GetOffset())) = Value;
	return true;
}
Beispiel #5
0
bool IPropertySet::SetValue(void* pData, int nIndex, const char* Value)
{
	assert(nIndex>=0 && nIndex<PropertyCount());
	if(nIndex<0 || nIndex>=PropertyCount()) return false;
	IProperty* pInfo = GetProperty(nIndex);
	assert(pInfo->GetType()==PROPERTY_TYPE_FLOAT);
	if(pInfo->GetType()!=PROPERTY_TYPE_FLOAT) return false;
	unsigned int len = strlen(Value);
	assert(len<=pInfo->GetSize());
	if(len>pInfo->GetSize()) return false;
	memcpy((char*)pData+pInfo->GetOffset(), Value, len+1);
	return true;
}