Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

CGameDocument.cpp

Go to the documentation of this file.
00001 // Copyright 2002 Kenneth Guy,
00002 // 
00003 // You are free to take the source and do as you wish with it.
00004 // However it would be nice if you let me know if the code was useful
00005 // to you and give me an acknowledgement if you use a significant portion
00006 // of the code in an application.
00007 // 
00008 // CGameDocument.cpp
00009 
00013 //
00014 
00015 #include "CGameAppUi.h"
00016 #include "CGameAppView.h"
00017 #include "CGameApplication.h"
00018 #include "CGameDocument.h"
00019 #include "CGameState.h"
00020 #include "CScoreDialog.h"
00021 #include "CHighScores.h"
00022 
00025 CGameDocument::CGameDocument(CEikApplication& aApp)
00026                 : CEikDocument(aApp) {
00027         
00028 }
00029 
00031 CGameDocument* CGameDocument::NewL(CEikApplication& aApp) {     
00032   CGameDocument* self=new (ELeave) CGameDocument(aApp);
00033   CleanupStack::PushL(self);
00034   self->ConstructL();
00035   CleanupStack::Pop();
00036   return self;
00037 }
00038 
00044 void CGameDocument::ConstructL() {      
00045   TParse parse;
00046   parse.Set(Application()->DllName(),NULL,NULL);
00047   _LIT(KScores,"scores");
00048   HBufC* filename=HBufC::NewLC(parse.DriveAndPath().Length()+
00049                                KScores().Length());
00050   filename->Des().Append(parse.DriveAndPath());
00051   filename->Des().Append(KScores);
00052   iGameState = CGameState::NewL(*filename);
00053   CleanupStack::PopAndDestroy(filename);
00054 }
00055 
00058 CGameDocument::~CGameDocument() {       
00059   delete iGameState;
00060 }
00061 
00062 
00065 CEikAppUi* CGameDocument::CreateAppUiL() {      
00066   return new(ELeave) CGameAppUi();
00067 }
00068 
00070 CGameState* CGameDocument::GameState() {
00071   return iGameState;
00072 }

Documentation for Game (Beta) version 1.44.