93 lines
2.3 KiB
C++
93 lines
2.3 KiB
C++
#if !defined(__TGDATA_H__)
|
|
#define __TGDATA_H__
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
#include "WDGrid.h"
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// 路径
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
class TGPath
|
|
{
|
|
public:
|
|
CString m_strPath;
|
|
|
|
public:
|
|
TGPath(const TCHAR *pszName = NULL);
|
|
virtual ~TGPath();
|
|
|
|
TGPath& operator=(const TCHAR *pszName)
|
|
{
|
|
m_strPath = pszName;
|
|
return *this;
|
|
}
|
|
|
|
void Resolve(TPDList<CString> &lstStrCats) const;
|
|
void GetName(CString &strName) const;
|
|
bool GetTopCat(CString &strName) const;
|
|
bool GetLowPath(TGPath &path) const;
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// 数据源标识
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
class TGDataSource: public WRowData
|
|
{
|
|
public:
|
|
CString m_sDataFrom; // 源数据库文件
|
|
CString m_sId; // 编号
|
|
|
|
bool operator ==(const TGDataSource&data)
|
|
{
|
|
return m_sId==data.m_sId&&m_sDataFrom==data.m_sDataFrom;
|
|
}
|
|
void operator >>(CArchive&ar)
|
|
{
|
|
ar<<m_sDataFrom<<m_sId;
|
|
}
|
|
void operator <<(CArchive&ar)
|
|
{
|
|
ar>>m_sDataFrom>>m_sId;
|
|
}
|
|
};
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// 分层数据
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
class TTreeItem
|
|
{
|
|
public:
|
|
CString m_sName; // 名称
|
|
|
|
protected:
|
|
const TTreeItem* m_pParent; // 所在组
|
|
|
|
public:
|
|
TTreeItem(const TCHAR *s, TTreeItem *p = NULL): m_sName(s), m_pParent(p) {}
|
|
virtual ~TTreeItem() {}
|
|
|
|
public:
|
|
void SetParent(TTreeItem*p) { m_pParent = p; }
|
|
const TTreeItem* GetParent()const { return m_pParent; }
|
|
|
|
bool IsRoot() const { return GetParent()==NULL; }
|
|
virtual bool IsParent() const { return false; }
|
|
|
|
void GeTGPathName(CString &name) const;
|
|
|
|
public:
|
|
virtual void operator<<(WDGridRow&row) {}
|
|
virtual void operator>>(WDGridRow&row) {}
|
|
virtual void operator>>(CArchive&ar) { ar<<m_sName; }
|
|
virtual void operator<<(CArchive&ar) { ar>>m_sName; }
|
|
|
|
bool operator>(const TTreeItem&t) const { return m_sName>t.m_sName; }
|
|
bool operator<(const TTreeItem&t) const { return m_sName<t.m_sName; }
|
|
bool operator==(const TTreeItem&t) const { return m_sName==t.m_sName; }
|
|
};
|
|
|
|
#endif // !defined(__TGDATA_H__)
|