You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
1.6 KiB
C

1 month ago
/**
* @file WVariant.h
* @brief <EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD>ݵײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @author
* @time
*/
#pragma once
//#include <boost/any.hpp>
#include <limits>
#define WDATATYPE_STRING 0 // <20>ַ<EFBFBD><D6B7><EFBFBD>
#define WDATATYPE_DOUBLE 1 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define WDATATYPE_INT 2 // <20><><EFBFBD><EFBFBD>
#define WDATATYPE_BOOL 3 // bool
#define WDATATYPE_TIME 4 // ʱ<><CAB1>
#define WDATATYPE_NULL 255 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define NULL_FLT FLT_MAX
#define NULL_INT INT_MAX
namespace wuya
{
class AFX_EXT_CLASS WVariant
{
public:
WVariant(void);
WVariant(double dValue);
WVariant(bool bValue);
WVariant(int iValue);
WVariant(LPCTSTR strValue);
WVariant(const CString& strValue);
WVariant(const COleDateTime& time);
WVariant(const WVariant& variant);
~WVariant(void);
WVariant& operator= (const WVariant& varValue);
void SetValue(double dValue);
void SetValue(bool bValue);
void SetValue(int iValue);
void SetValue(LPCTSTR strValue);
void SetValue(const COleDateTime& time);
void GetValue(double& dValue);
void GetValue(bool& bValue);
void GetValue(int& iValue);
void GetValue(CString& strValue);
void GetValue(COleDateTime& time);
/** @brief <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪWDATATYPE_NULL */
void SetNull();
/** @brief <09>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA> */
BOOL IsNull();
void SetType(BYTE type); // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
void ChangeType(BYTE type); // ת<><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
static BOOL IsNullDblValue(double dValue);
static BOOL IsNullIntValue(int iValue);
static double GetNullDblValue();
static int GetNullIntValue();
private:
void ChangeToString();
void ChangeToDbl();
void ChangeToInt();
void ChangeToBool();
void ChangeToTime();
private:
BYTE m_byteType; // <20><><EFBFBD><EFBFBD>
//boost::any m_anyValue; // <20><EFBFBD><E6B4A2><EFBFBD><EFBFBD>
};
};