📄 elementsmain.cpp
字号:
/**
*
* @brief Main entry point for the Elements project
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDE FILES
// Class include
#include "elementsmain.h"
// System includes
#include <e32cons.h>
// User includes
#include "chemicalelement.h"
#include "elementsengine.h"
// ================= MEMBER FUNCTIONS =======================
namespace //Anonymous namespace has local file scope
{
CConsoleBase* console;
void DoExampleL()
{
//construct and install the active scheduler
CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
CleanupStack::PushL(scheduler);
CActiveScheduler::Install(scheduler);
//construct the new element engine
CElementsEngine* elementEngine = CElementsEngine::NewLC(*console); //remains on cleanup stack
elementEngine->LoadFromCsvFilesL(); //Issue the request...
CActiveScheduler::Start(); //...then start the scheduler
CleanupStack::PopAndDestroy(2, scheduler); //elementEngine, scheduler
}
void DoMainL()
{
const TSize consoleSize(KConsFullScreen, KConsFullScreen);
console = Console::NewL(KTxtSeries60Elements, consoleSize);
CleanupStack::PushL(console);
TRAPD(error, DoExampleL()); // perform example function
if (error)
{
console->Printf(KFormatTxtFailed, error);
}
else
{
console->Printf(KTxtOK);
}
console->Printf(KTxtPressAnyKey);
console->Getch(); // get and ignore character
CleanupStack::PopAndDestroy(console);
}
};
GLDEF_C TInt E32Main() // main function called by E32
{
__UHEAP_MARK;
CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
TRAPD(error, DoMainL()); // more initialization, then do example
delete cleanup; // destroy clean-up stack
__ASSERT_ALWAYS(!error, User::Panic(KTxtElements, error));
__UHEAP_MARKEND;
return 0; // and return
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -