012
23.05.2005, 09:35 Uhr
GuenniAtWork
|
Hi,
Ich deklariere CJob in Job.h und definiere CJob nur in Job.cpp
Deklaration
C++: |
//Job.h Headerdatei #pragma once
#include <afxcoll.h> #include "Globalelements.h"
// CJob-Befehlsziel
class CJob : public CObject { DECLARE_SERIAL (CJob) public: CJob(); CJob::CJob(const CJob& cop); void Serialize(CArchive& ar); CJob& CJob::operator=(const CJob& cop); virtual ~CJob(); //Datenelemente CString sJobName; int iJobID; TRunApp tRunApp; TFiles tFiles; TEnvVar tEnvVar; TService tService; TLink tLink; };
IMPLEMENT_SERIAL (CJob, CObject, 1)
//Variabeln extern CObArray JobList;
//Funktionen
|
Definition
C++: |
// Job.cpp : Implementierungsdatei // #include "stdafx.h" #include "Job.h"
// CJob
CJob::CJob() //Constructor { }
CJob::CJob(const CJob& cop) //kopier-Constructor { this->sJobName = cop.sJobName; this->iJobID = cop.iJobID; this->tRunApp = cop.tRunApp; this->tFiles = cop.tFiles; this->tEnvVar = cop.tEnvVar; this->tService = cop.tService; this->tLink = cop.tLink; }
CJob& CJob::operator =(const CJob& cop) { this->sJobName = cop.sJobName; this->iJobID = cop.iJobID; this->tRunApp = cop.tRunApp; this->tFiles = cop.tFiles; this->tEnvVar = cop.tEnvVar; this->tService = cop.tService; this->tLink = cop.tLink; return *this; }
void CJob::Serialize(CArchive& ar) { CObject::Serialize( ar );
if (ar.IsStoring()) { ar << sJobName << iJobID; ar << tRunApp.sAppPath << tRunApp.sAppParam; ar << tFiles.iCopyDel << tFiles.sFile << tFiles.sFileDestination; ar << tEnvVar.iSysUserVar << tEnvVar.sVarName << tEnvVar.sVarValue; ar << tService.sServiceName << tService.iStopDel; ar << tLink.sName << tLink.sTargetDestination << tLink.sTargetFile << tLink.sHotKey << tLink.sDescription << tLink.iWindStyle; } else { ar >> sJobName >> iJobID; ar >> tRunApp.sAppPath >> tRunApp.sAppParam; ar >> tFiles.iCopyDel >> tFiles.sFile >> tFiles.sFileDestination; ar >> tEnvVar.iSysUserVar >> tEnvVar.sVarName >> tEnvVar.sVarValue; ar >> tService.sServiceName >> tService.iStopDel; ar >> tLink.sName >> tLink.sTargetDestination >> tLink.sTargetFile >> tLink.sHotKey >> tLink.sDescription >> tLink.iWindStyle; } }
CJob::~CJob() { }
//Variabeln
CObArray JobList;
// CJob-Memberfunktionen
|
Ich includiere Job.h in Cl_InstallPCWizard.cpp, weil ich darin zeiger auf die CJob klasse darin erzeuge.
wenn ich das #include "Job.h" weglasse meckert der Compiler, weil er die klasse nicht kennt. Sobald ich das #include "Job h" hinzufüge meckert der Linker. Verzwickte sache! -- Gruß GuenniAtWork |