📄 base_property_impl.h
字号:
T retValue = T(NULL); /* try {*/ GetValueImpl( Offset, retValue ); /* vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("GetValue")); vectParam.push_back( CStringHelper::Param2Str(Offset) ); GetIpcClient()->IpcCall(m_nDataType, GetSvrProperty(), vectParam, vectRtn); CStringHelper::Str2Param(vectRtn[0], retValue); *//* } catch (...) { IntelMobileException ex( IntelMobileText("Operation Error"), IntelMobileText("ArrayPropertyImpl"), IntelMobileText("GetValue") ); throw( ex ); }*/ return retValue; //return (reinterpret_cast<ServerArrayProperty<T>*>( GetSvrProperty() ))->GetValue( Offset ); } bool SetValue( const size_t Offset, T Value ) { /* try {*/ //(reinterpret_cast<ServerArrayProperty<T>*>( GetSvrProperty() ))->SetValue( Offset, Value );/* bool retValue; vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("SetValue")); vectParam.push_back( CStringHelper::Param2Str(Offset) ); vectParam.push_back( CStringHelper::Param2Str(Value) ); GetIpcClient()->IpcCall(m_nDataType, GetSvrProperty(), vectParam, vectRtn); CStringHelper::Str2Param(vectRtn[0], retValue);*/ SetValueImpl( Offset, Value );/* } catch (...) { return FALSE; }*/ // // TODO, return value? return S_OK; } int Add ( T Value )
{
return AddValueImpl( Value);
}
bool Insert ( const unsigned long Offset, T Value )
{
if ( !IsSettable() )
return false;
return InsertValueImpl( Offset, Value );
}
bool Remove ( T Value )
{
if ( !IsSettable() )
return false;
return RemoveValueImpl( Value );
}
bool RemoveAt ( const unsigned long Offset )
{
T tmpValue = (T)NULL;
if ( !IsSettable() )
return false;
return RemoveAtValueImpl( tmpValue, Offset );
}
bool Contains ( T Value )
{
return ContainsValueImpl( Value);
}
bool Clear ()
{
T tmpValue = T(NULL);
if ( !IsSettable() )
return false;
return ClearValueImpl( tmpValue );
}
protected: void GetValueImpl( const size_t Offset, int& retValue ) { SAFEGETARRAYVALUE( GetIntArrayValue,Offset, retValue ); } void GetValueImpl( const size_t Offset, unsigned char& retValue ) { SAFEGETARRAYVALUE( GetByteArrayValue,Offset, retValue ); } void GetValueImpl( const size_t Offset, unsigned int& retValue ) { SAFEGETARRAYVALUE( GetUintArrayValue,Offset, retValue ); } void GetValueImpl( const size_t Offset, __int64& retValue ) { SAFEGETARRAYVALUE( GetInt64ArrayValue,Offset, retValue ); } void GetValueImpl( const size_t Offset, unsigned __int64& retValue ) { SAFEGETARRAYVALUE( GetUInt64ArrayValue,Offset, retValue ); } void GetValueImpl( const size_t Offset, float& retValue ) { SAFEGETARRAYVALUE( GetFloatArrayValue,Offset, retValue ); } void GetValueImpl( const size_t Offset, DATE& retValue ) { SAFEGETARRAYVALUE( GetDatetimeArrayValue,Offset, retValue ); } void GetValueImpl( const size_t Offset, bool& retValue ) { SAFEGETARRAYVALUE( GetBoolArrayValue,Offset, retValue ); } void GetValueImpl( const size_t Offset, IntelMobileChar*& retValue ) { IntelMobileString szValue ;//= ssp->GetValue(Offset); SAFEGETARRAYVALUE( GetStringArrayValue,Offset, szValue );#ifdef _UNICODE retValue = ::wcscpy( new IntelMobileChar[::wcslen(szValue.c_str())+1], szValue.c_str()) ;#else retValue = ::strcpy( new IntelMobileChar[::strlen(szValue.c_str())+1], szValue.c_str()) ;#endif } void SetValueImpl( const size_t Offset, int Value ) { SAFESETARRAYVALUE( SetIntArrayValue, Offset, Value ); } void SetValueImpl( const size_t Offset, unsigned char Value ) { SAFESETARRAYVALUE( SetByteArrayValue, Offset, Value ); } void SetValueImpl( const size_t Offset, unsigned int Value ) { SAFESETARRAYVALUE( SetUintArrayValue, Offset, Value ); } void SetValueImpl( const size_t Offset, __int64 Value ) { SAFESETARRAYVALUE( SetInt64ArrayValue, Offset, Value ); } void SetValueImpl( const size_t Offset, unsigned __int64 Value ) { SAFESETARRAYVALUE( SetUInt64ArrayValue, Offset, Value ); } void SetValueImpl( const size_t Offset, float Value ) { SAFESETARRAYVALUE( SetFloatArrayValue, Offset, Value ); } void SetValueImpl( const size_t Offset, DATE Value ) { SAFESETARRAYVALUE( SetDatetimeArrayValue, Offset, Value ); } void SetValueImpl( const size_t Offset, bool Value ) { SAFESETARRAYVALUE( SetBoolArrayValue, Offset, Value ); } void SetValueImpl( const size_t Offset, IntelMobileChar* Value ) { SAFESETARRAYVALUE( SetStringArrayValue, Offset, Value ); } // Add
int AddValueImpl( const __int32 nValue ) { SAFEADDARRAYVALUE(AddIntArrayValue,nValue ); }
int AddValueImpl( const bool bValue ) { SAFEADDARRAYVALUE(AddBoolArrayValue, bValue ); }
int AddValueImpl( unsigned char uValue) { SAFEADDARRAYVALUE(AddByteArrayValue , uValue ); }
int AddValueImpl( unsigned __int32 uValue) { SAFEADDARRAYVALUE(AddUintArrayValue , uValue ); }
int AddValueImpl( __int64 lValue) { SAFEADDARRAYVALUE(AddInt64ArrayValue, lValue ); }
int AddValueImpl( unsigned __int64 uValue) { SAFEADDARRAYVALUE(AddUInt64ArrayValue, uValue ); }
int AddValueImpl( float fValue) { SAFEADDARRAYVALUE(AddFloatArrayValue , fValue ); }
int AddValueImpl( DATE dtValue) { SAFEADDARRAYVALUE(AddDatetimeArrayValue, dtValue ); }
int AddValueImpl( IntelMobileChar* psValue)
{
SAFEADDARRAYVALUE(AddStringArrayValue, psValue );
}
// Insert
bool InsertValueImpl( unsigned long nOffset, const __int32 nValue) { SAFEINSERTARRAYVALUE(InsertIntArrayValue , nOffset, nValue ); }
bool InsertValueImpl( unsigned long nOffset, const bool bValue) { SAFEINSERTARRAYVALUE(InsertBoolArrayValue , nOffset, bValue ); }
bool InsertValueImpl( unsigned long nOffset, unsigned char uValue) { SAFEINSERTARRAYVALUE(InsertByteArrayValue , nOffset, uValue ); }
bool InsertValueImpl( unsigned long nOffset, unsigned __int32 uValue) { SAFEINSERTARRAYVALUE(InsertUintArrayValue , nOffset, uValue ); }
bool InsertValueImpl( unsigned long nOffset, __int64 lValue) { SAFEINSERTARRAYVALUE(InsertInt64ArrayValue , nOffset, lValue ); }
bool InsertValueImpl( unsigned long nOffset, unsigned __int64 uValue) { SAFEINSERTARRAYVALUE(InsertUInt64ArrayValue , nOffset, uValue ); }
bool InsertValueImpl( unsigned long nOffset, float fValue) { SAFEINSERTARRAYVALUE(InsertFloatArrayValue , nOffset, fValue ); }
bool InsertValueImpl( unsigned long nOffset, DATE dtValue) { SAFEINSERTARRAYVALUE(InsertDatetimeArrayValue, nOffset, dtValue ); }
bool InsertValueImpl( unsigned long nOffset, IntelMobileChar* psValue)
{
SAFEINSERTARRAYVALUE(InsertStringArrayValue,nOffset,psValue);
}
// Remove
bool RemoveValueImpl( const __int32 nValue ) { SAFEREMOVEARRAYVALUE(RemoveIntArrayValue , nValue ); }
bool RemoveValueImpl( const bool bValue ) { SAFEREMOVEARRAYVALUE(RemoveBoolArrayValue , bValue ); }
bool RemoveValueImpl( unsigned char uValue ) { SAFEREMOVEARRAYVALUE(RemoveByteArrayValue , uValue ); }
bool RemoveValueImpl( unsigned __int32 uValue ) { SAFEREMOVEARRAYVALUE(RemoveUintArrayValue , uValue ); }
bool RemoveValueImpl( __int64 lValue ) { SAFEREMOVEARRAYVALUE(RemoveInt64ArrayValue , lValue ); }
bool RemoveValueImpl( unsigned __int64 uValue ) { SAFEREMOVEARRAYVALUE(RemoveUInt64ArrayValue , uValue ); }
bool RemoveValueImpl( float fValue ) { SAFEREMOVEARRAYVALUE(RemoveFloatArrayValue , fValue ); }
bool RemoveValueImpl( DATE dtValue) { SAFEREMOVEARRAYVALUE(RemoveDatetimeArrayValue, dtValue ); }
bool RemoveValueImpl( IntelMobileChar* pszValue)
{
SAFEREMOVEARRAYVALUE(RemoveStringArrayValue,pszValue);
}
// RemoveAt
bool RemoveAtValueImpl( const __int32 nValue, unsigned long nOffset ) { SAFEREMOVEATARRAYVALUE(RemoveAtIntArrayValue , nOffset, nValue ); }
bool RemoveAtValueImpl( const bool bValue, unsigned long nOffset ) { SAFEREMOVEATARRAYVALUE(RemoveAtBoolArrayValue , nOffset, bValue ); }
bool RemoveAtValueImpl( unsigned char uValue, unsigned long nOffset ) { SAFEREMOVEATARRAYVALUE(RemoveAtByteArrayValue , nOffset, uValue ); }
bool RemoveAtValueImpl( unsigned __int32 uValue, unsigned long nOffset ) { SAFEREMOVEATARRAYVALUE(RemoveAtUintArrayValue , nOffset, uValue ); }
bool RemoveAtValueImpl( __int64 lValue, unsigned long nOffset ) { SAFEREMOVEATARRAYVALUE(RemoveAtInt64ArrayValue , nOffset, lValue ); }
bool RemoveAtValueImpl( unsigned __int64 uValue, unsigned long nOffset ) { SAFEREMOVEATARRAYVALUE(RemoveAtUInt64ArrayValue , nOffset, uValue ); }
bool RemoveAtValueImpl( float fValue, unsigned long nOffset ) { SAFEREMOVEATARRAYVALUE(RemoveAtFloatArrayValue , nOffset, fValue ); }
bool RemoveAtValueImpl( DATE dtValue,unsigned long nOffset ) { SAFEREMOVEATARRAYVALUE(RemoveAtDatetimeArrayValue, nOffset, dtValue ); }
bool RemoveAtValueImpl( wchar_t* psValue,unsigned long nOffset ) { SAFEREMOVEATARRAYVALUE(RemoveAtStringArrayValue , nOffset, psValue ); }
// Contains
bool ContainsValueImpl( const __int32 nValue ) { SAFECONTAINSARRAYVALUE(ContainsIntArrayValue , nValue ); }
bool ContainsValueImpl( const bool bValue ) { SAFECONTAINSARRAYVALUE(ContainsBoolArrayValue , bValue ); }
bool ContainsValueImpl( unsigned char uValue ) { SAFECONTAINSARRAYVALUE(ContainsByteArrayValue , uValue ); }
bool ContainsValueImpl( unsigned __int32 uValue ) { SAFECONTAINSARRAYVALUE(ContainsUintArrayValue , uValue ); }
bool ContainsValueImpl( __int64 lValue ) { SAFECONTAINSARRAYVALUE(ContainsInt64ArrayValue , lValue ); }
bool ContainsValueImpl( unsigned __int64 uValue ) { SAFECONTAINSARRAYVALUE(ContainsUInt64ArrayValue , uValue ); }
bool ContainsValueImpl( float fValue ) { SAFECONTAINSARRAYVALUE(ContainsFloatArrayValue , fValue ); }
bool ContainsValueImpl( DATE dtValue) { SAFECONTAINSARRAYVALUE(ContainsDatetimeArrayValue, dtValue ); }
bool ContainsValueImpl( IntelMobileChar* pszValue)
{
SAFECONTAINSARRAYVALUE(ContainsStringArrayValue,pszValue);
}
// Clear
bool ClearValueImpl( const __int32 nValue ) { SAFECLEARARRAYVALUE(ClearIntArrayValue ,nValue ); }
bool ClearValueImpl( const bool bValue ) { SAFECLEARARRAYVALUE(ClearBoolArrayValue ,bValue ); }
bool ClearValueImpl( unsigned char uValue ) { SAFECLEARARRAYVALUE(ClearByteArrayValue ,uValue ); }
bool ClearValueImpl( unsigned __int32 uValue ) { SAFECLEARARRAYVALUE(ClearUintArrayValue ,uValue ); }
bool ClearValueImpl( __int64 lValue ) { SAFECLEARARRAYVALUE(ClearInt64ArrayValue ,lValue ); }
bool ClearValueImpl( unsigned __int64 uValue ) { SAFECLEARARRAYVALUE(ClearUInt64ArrayValue ,uValue ); }
bool ClearValueImpl( float fValue ) { SAFECLEARARRAYVALUE(ClearFloatArrayValue ,fValue ); }
bool ClearValueImpl( DATE dtValue ) { SAFECLEARARRAYVALUE(ClearDatetimeArrayValue ,dtValue ); }
bool ClearValueImpl( IntelMobileChar* psValue ) { SAFECLEARARRAYVALUE(ClearStringArrayValue ,psValue ); }
}; // template class Property//==============================================================================typedef PropertyImpl<unsigned char> BytePropertyImpl;typedef PropertyImpl<int> IntPropertyImpl;typedef PropertyImpl<unsigned int> UIntPropertyImpl;typedef PropertyImpl<__int64> Int64PropertyImpl;typedef PropertyImpl<unsigned __int64> UInt64PropertyImpl;typedef PropertyImpl<IntelMobileChar*> StringPropertyImpl;typedef PropertyImpl<bool> BoolPropertyImpl;typedef PropertyImpl<DATE> DateTimePropertyImpl;typedef PropertyImpl<float> FloatPropertyImpl;typedef SmartPtr<BytePropertyImpl> BytePropertyImplPtr;typedef SmartPtr<IntPropertyImpl> IntPropertyImplPtr;typedef SmartPtr<UIntPropertyImpl> UIntPropertyImplPtr;typedef SmartPtr<Int64PropertyImpl> Int64PropertyImplPtr;typedef SmartPtr<UInt64PropertyImpl> UInt64PropertyImplPtr;typedef SmartPtr<StringPropertyImpl> StringPropertyImplPtr;typedef SmartPtr<BoolPropertyImpl> BoolPropertyImplPtr;typedef SmartPtr<DateTimePropertyImpl> DateTimePropertyImplPtr;typedef SmartPtr<FloatPropertyImpl> FloatPropertyImplPtr;typedef ArrayPropertyImpl<unsigned char> ByteArrayPropertyImpl;typedef ArrayPropertyImpl<int> IntArrayPropertyImpl;typedef ArrayPropertyImpl<unsigned int> UIntArrayPropertyImpl;typedef ArrayPropertyImpl<__int64> Int64ArrayPropertyImpl;typedef ArrayPropertyImpl<unsigned __int64> UInt64ArrayPropertyImpl;typedef ArrayPropertyImpl<IntelMobileChar*> StringArrayPropertyImpl;typedef ArrayPropertyImpl<bool> BoolArrayPropertyImpl;typedef ArrayPropertyImpl<DATE> DateTimeArrayPropertyImpl;typedef ArrayPropertyImpl<float> FloatArrayPropertyImpl;typedef SmartPtr<ByteArrayPropertyImpl> ByteArrayPropertyImplPtr;typedef SmartPtr<IntArrayPropertyImpl> IntArrayPropertyImplPtr;typedef SmartPtr<UIntArrayPropertyImpl> UIntArrayPropertyImplPtr;typedef SmartPtr<Int64ArrayPropertyImpl> Int64ArrayPropertyImplPtr;typedef SmartPtr<UInt64ArrayPropertyImpl> UInt64ArrayPropertyImplPtr;typedef SmartPtr<StringArrayPropertyImpl> StringArrayPropertyImplPtr;typedef SmartPtr<BoolArrayPropertyImpl> BoolArrayPropertyImplPtr;typedef SmartPtr<DateTimeArrayPropertyImpl> DateTimeArrayPropertyImplPtr;typedef SmartPtr<FloatArrayPropertyImpl> FloatArrayPropertyImplPtr;//==========================#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -