Timestamper Class ExtensionTimestampClassExtension.h
// Copyright 2006 ESRI
//
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
//
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
//
// See the use restrictions.
// TimestampClassExtension.h : Declaration of the CTimestampClassExtension
#ifndef __TIMESTAMPCLASSEXTENSION_H_
#define __TIMESTAMPCLASSEXTENSION_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CTimestampClassExtension
class ATL_NO_VTABLE CTimestampClassExtension :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CTimestampClassExtension, &CLSID_TimestampClassExtension>,
public ISupportErrorInfo,
public ITimestampClassExtension,
public IClassExtension,
public IObjectClassEvents,
public IObjectClassExtension
{
public:
CTimestampClassExtension()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_TIMESTAMPCLASSEXTENSION)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_CATEGORY_MAP(CTimestampClassExtension)
IMPLEMENTED_CATEGORY(__uuidof(CATID_GeoObjectClassExtensions))
END_CATEGORY_MAP()
BEGIN_COM_MAP(CTimestampClassExtension)
COM_INTERFACE_ENTRY(ITimestampClassExtension)
COM_INTERFACE_ENTRY(IClassExtension)
COM_INTERFACE_ENTRY(IObjectClassEvents)
COM_INTERFACE_ENTRY(IObjectClassExtension)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()
public:
// ITimestampClassExtension
STDMETHOD(get_CreationFieldName)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_CreationFieldName)(/*[in]*/ BSTR newVal);
STDMETHOD(get_UserFieldName)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_UserFieldName)(/*[in]*/ BSTR newVal);
STDMETHOD(get_ModificationFieldName)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_ModificationFieldName)(/*[in]*/ BSTR newVal);
STDMETHOD(UpdateProperties)();
// IClassExtension
STDMETHOD(Init)(IClassHelper * pClassHelper, IPropertySet * pExtensionProperties);
STDMETHOD(Shutdown)();
// IObjectClassEvents
STDMETHOD(OnCreate)(IObject * obj);
STDMETHOD(OnDelete)(IObject * obj);
STDMETHOD(OnChange)(IObject * obj);
// IObjectClassExtension
// ISupportErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
private:
HRESULT TryDefaultProperties();
HRESULT GetFieldPositions();
HRESULT GetTimestamp(DATE *dtimestamp);
HRESULT GetUsrName(BSTR *sUserName);
IClassHelperPtr m_ipClassHelper;
CComBSTR m_sCreFieldName;
CComBSTR m_sModFieldName;
CComBSTR m_sUsrFieldName;
long m_lCreField;
long m_lModField;
long m_lUsrField;
CComVariant m_vUsrName;
};
#endif //__TIMESTAMPCLASSEXTENSION_H_