📄 replobjs.h
字号:
//
// File:
// =====
// Replobjects.h: Header File
//
// Desription:
// ===========
// Contains definitions of the classes CReplFolder, CReplItem & CReplObject
// these objects are stored in the repl.dat file by the sync engine. These
// are the "cookie" objects that you will use to identify your folders/items.
// Add/modify the members of these classes as needed.
//
#pragma once
//<BOOK_ADDON Chapter 9.3.2.1> ***************************************************
#define MAXDATASIZE 8000
//</BOOK_ADDON Chapter 9.3.2.1> ***************************************************
class CBaseFolder;
//
// ======================== class CReplObject ===============================
//
class CReplObject
{
public:
enum IDD_OBJ_TYPE{ PCDMSYNC_OBJ_FOLDER = 1, PCDMSYNC_OBJ_ITEM = 2 };
protected:
IDD_OBJ_TYPE m_eType; // type of this object folder/item
public:
CReplObject(IDD_OBJ_TYPE eType) { m_eType = eType;}
IDD_OBJ_TYPE GetType(){ return m_eType;}
virtual ~CReplObject(){};
};
//
// ======================== class CReplFolder ===============================
//
class CReplFolder: public CReplObject
{
protected:
//<BOOK_ADDON Chapter 9.3.2.1> ***************************************************
TCHAR m_szName[MAXDATASIZE];
//</BOOK_ADDON Chapter 9.3.2.1> ***************************************************
CBaseFolder *m_pFolder;
public:
CReplFolder(LPTSTR pszName, CBaseFolder *pFolder) : CReplObject(PCDMSYNC_OBJ_FOLDER)
{
::_tcscpy(m_szName, pszName);
m_pFolder = pFolder; // stores ptr to real folder
return;
}
virtual ~CReplFolder(){}
const LPTSTR GetName(){ return m_szName;}
CBaseFolder* GetFolder(){ return m_pFolder;}
CReplFolder& operator=(const CReplFolder& rhs) // overloaded operator=
{
//
// TODO: If you add/modify the members of this class,
// you will also need to modify the code below.
//
::_tcscpy(m_szName, rhs.m_szName);
m_pFolder = rhs.m_pFolder;
return *this;
}
};
//
// ======================== class CReplItem ===============================
//
class CReplItem: public CReplObject
{
protected:
//<BOOK_ADDON Chapter 9.3.2.1> ***************************************************
TCHAR m_szId[MAXDATASIZE]; // unique id to identify this object
//</BOOK_ADDON Chapter 9.3.2.1> ***************************************************
FILETIME m_ftModified; // stores the last modified time of this item
public:
CReplItem(LPTSTR pszId) : CReplObject(PCDMSYNC_OBJ_ITEM)
{
::_tcscpy(m_szId, pszId);
return;
}
virtual ~CReplItem(){}
FILETIME& GetModified(){ return m_ftModified;}
void SetModified(FILETIME& ft){ m_ftModified = ft;}
CReplItem& operator=(const CReplItem& rhs) // overloaded operator=
{
//
// TODO: If you add/modify the members of this class,
// you will also need to modify the code below.
//
::_tcscpy(m_szId, rhs.m_szId);
m_ftModified = rhs.m_ftModified;
return *this;
}
//
// Compare function compares this object with another one
// of the same type. Returns -1, 0 or 1 accordingly.
//
int Compare(const CReplItem* prhs)
{
return ::_tcscmp(m_szId, prhs->m_szId);
}
const LPTSTR GetId()
{
return m_szId;
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -