71 lines
2.3 KiB
C++
71 lines
2.3 KiB
C++
//This vile is adapted from CPA's LSTEDMOT.HPP
|
|
// (c) Ubi Studios 1996
|
|
// See Vincent Greco for any comment or question
|
|
|
|
#ifndef __SNDLSTMT_HPP__
|
|
#define __SNDLSTMT_HPP__
|
|
|
|
#include "SNDLst2.h"
|
|
#include "SNDList.Hpp"
|
|
//#include "ErrHie.h"
|
|
|
|
//YOU MUST DEFINE Mod BEFORE INCLUDING THIS FILE
|
|
// Example "#define Mod Hie" for hierarchy
|
|
|
|
//**************************************
|
|
#ifndef CPA_EXPORT
|
|
#if defined(CPA_WANTS_IMPORT)
|
|
#define CPA_EXPORT __declspec(dllimport)
|
|
#elif defined(CPA_WANTS_EXPORT)
|
|
#define CPA_EXPORT __declspec(dllexport)
|
|
#else
|
|
#define CPA_EXPORT
|
|
#endif
|
|
#endif
|
|
//**************************************
|
|
|
|
|
|
template<class tdxHandleToStruct>
|
|
class SNDLST2_EdMot
|
|
{
|
|
private:
|
|
tdxHandleToStruct pStruct;
|
|
// void NewStruct(void);
|
|
static tdxHandleToStruct (*m_p_fn_hCreate)(void);
|
|
static void (*m_p_fn_hCopy)(tdxHandleToStruct,tdxHandleToStruct);
|
|
static void (*m_p_fn_vDestroy)(tdxHandleToStruct);
|
|
protected:
|
|
virtual void SetStruct(tdxHandleToStruct pNewStruct){pStruct=pNewStruct;}
|
|
public:
|
|
static void Init(tdxHandleToStruct (*_p_fn_hCreate)(void),void (*_p_fn_hCopy)(tdxHandleToStruct,tdxHandleToStruct),void (*_p_fn_vDestroy)(tdxHandleToStruct))
|
|
{
|
|
m_p_fn_hCreate=_p_fn_hCreate;
|
|
m_p_fn_hCopy=_p_fn_hCopy;
|
|
m_p_fn_vDestroy=_p_fn_vDestroy;
|
|
}
|
|
// IMPORTANT :
|
|
// even if SetStruct() is virtual
|
|
// the the SetStruct() called by the constructors of SNDLST2_EdMot
|
|
// is the one of SNDLST2_EdMot itself,
|
|
// so if you overload SetStruct(),
|
|
// overload also the constructors
|
|
SNDLST2_EdMot(void) {SetStruct((*m_p_fn_hCreate)());}
|
|
SNDLST2_EdMot(long _lValue) {SetStruct((tdxHandleToStruct)_lValue);}
|
|
SNDLST2_EdMot(tdxHandleToStruct _hValue) {SetStruct(_hValue);}
|
|
SNDLST2_EdMot(const SNDLST2_EdMot& C) {SetStruct((*m_p_fn_hCreate)()); (*m_p_fn_hCopy)(pStruct, C.pStruct);}
|
|
SNDLST2_EdMot& operator=(const SNDLST2_EdMot& C) {(*m_p_fn_hCopy)(pStruct, C.pStruct); return *this;}
|
|
virtual ~SNDLST2_EdMot(void) {(*m_p_fn_vDestroy)(pStruct);}
|
|
|
|
public:
|
|
tdxHandleToStruct GetStruct(void) const {return pStruct;}
|
|
};
|
|
|
|
#define SNDLST2_DeclareTemplateStatic(tdxHandleToStruct) \
|
|
tdxHandleToStruct (*SNDLST2_EdMot<tdxHandleToStruct>::m_p_fn_hCreate)(void); \
|
|
void (*SNDLST2_EdMot<tdxHandleToStruct>::m_p_fn_hCopy)(tdxHandleToStruct,tdxHandleToStruct); \
|
|
void (*SNDLST2_EdMot<tdxHandleToStruct>::m_p_fn_vDestroy)(tdxHandleToStruct);
|
|
|
|
|
|
|
|
#endif //__LSTEDMOT_HPP__
|