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.

137 lines
3.7 KiB
C

#pragma once
#include "GlobalDefine.h"
#include "WorkFileLable.h"
//<2F><EFBFBD><E6B4A2><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
enum VAL_TYPE
{
_TYPE_NULL = 0,//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
_TYPE_INT,
_TYPE_DOUBLE,
_TYPE_STRING,
_TYPE_BOOL,
};
//һ<><D2BB><EFBFBD><EFBFBD><EFBFBD>ڴ洢<DAB4>ı<EFBFBD>ǩ
class CLab
{
public:
CLab()
{
m_ValType = _TYPE_NULL;
};
CLab(LAB_TYPE LabType)
{
m_ValType = _TYPE_NULL;
m_LabType = LabType;
};
CLab(LAB_TYPE LabType,int val)
{
m_ValType = _TYPE_INT;
m_LabType = LabType;
m_Int = val;
};
CLab(LAB_TYPE LabType,double val)
{
m_ValType = _TYPE_DOUBLE;
m_LabType = LabType;
m_Double = val;
};
CLab(LAB_TYPE LabType,bool val)
{
m_ValType = _TYPE_BOOL;
m_LabType = LabType;
m_Bool = val;
};
CLab(LAB_TYPE LabType,CString val)
{
m_ValType = _TYPE_STRING;
m_LabType = LabType;
m_String = val;
};
~CLab(void){};
void Serialize( CArchive& ar)
{
if(ar.IsStoring())
{
ar<<(int)m_ValType;//<2F><><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
ar<<(int)m_LabType;//<2F><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
switch(m_ValType)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><E6B4A2><EFBFBD><EFBFBD>
{
case _TYPE_INT:
ar<<m_Int;
break;
case _TYPE_DOUBLE:
ar<<m_Double;
break;
case _TYPE_BOOL:
ar<<m_Bool;
break;
case _TYPE_STRING:
ar<<m_String;
break;
default:
break;
}
}
else
{
int tmp;
ar>>tmp;//<2F><><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
m_ValType = (VAL_TYPE)tmp;
ar>>tmp;//<2F><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_LabType = (LAB_TYPE)tmp;
switch(m_ValType)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><E6B4A2><EFBFBD><EFBFBD>
{
case _TYPE_INT:
ar>>m_Int;
break;
case _TYPE_DOUBLE:
ar>>m_Double;
break;
case _TYPE_BOOL:
ar>>m_Bool;
break;
case _TYPE_STRING:
ar>>m_String;
break;
default:
break;
}
}
}
public:
VAL_TYPE m_ValType;//<2F><><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
LAB_TYPE m_LabType;//<2F><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int m_Int;//<2F><><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD><EFBFBD>
double m_Double;//<2F><><EFBFBD>ڴ洢˫<E6B4A2><CBAB><EFBFBD><EFBFBD>
bool m_Bool;//<2F><><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CString m_String;
};
//<2F><><EFBFBD><EFBFBD>vector<CString> <20><>һ<EFBFBD>η<EFBFBD>Χ<EFBFBD><CEA7>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><E3B7A8><EFBFBD>ٶ<EFBFBD>
class CLabVecRang
{
public:
CLabVecRang(vector<CLab> &vec,size_t start,size_t End)
:m_vec(vec),m_start(start),m_End(End)
{
};
~CLabVecRang(void){};
int GetStart(){return m_start;}
int GetEnd(){return m_End;}
CLab &GetLab(int idx){return m_vec[idx];};
LAB_TYPE GetLabType(int idx){return m_vec[idx].m_LabType;};
int GetInt(int idx){return m_vec[idx].m_Int;};
double GetDouble(int idx){return m_vec[idx].m_Double;};
bool GetBool(int idx){return m_vec[idx].m_Bool;};
vector<CLab> &GetVec(){return m_vec;};
private:
vector<CLab> &m_vec;
size_t m_start;
size_t m_End;
};