elementsengine.h

来自「series60 应用程序开发的源代码 series60 应用程序开发的源代码」· C头文件 代码 · 共 91 行

H
91
字号
#ifndef ELEMENTSENGINE_H
#define ELEMENTSENGINE_H
// INCLUDES

// System includes
#include <e32def.h>
#include <f32file.h>
#include <s32std.h>
#include <s32stor.h>

// User includes
#include "csvfileloaderobserver.h"
#include "chemicalelement.h"    //TElementType
// FORWARD DECLARATIONS
class CConsoleBase;
class CCsvFileLoader;
class CElementList;

// CLASS DECLARATION

/**
*
* @class    CElementsEngine elementsengine.h
* @brief    Class to encapsulate some simple testing of the element container class. It simply
*            loads in the data from three separate csv files, then once they've all loaded in
*            it performs some sorting and finding operations by way of a test.
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
class CElementsEngine : public CBase, public MCsvFileLoaderObserver
{
public:
    /**
    * Canonical NewLC factory function. Constructs a new instance of a CElementsEngine, and leaves a pointer to
    * it on the cleanup stack
    * @returns A pointer to the newly constructed CElementsEngine class, which is left on the cleanup stack.
    */

    static CElementsEngine* NewLC(CConsoleBase& aConsole);

    /**
    * Canonical NewL factory function. Constructs a new instance of a CElementsEngine
    *
    * @returns A pointer to the newly constructed CElementsEngine class.
    */

    static CElementsEngine* NewL(CConsoleBase& aConsole);

    /**
    * Destructor.
    */

    ~CElementsEngine();
    /**
    * Loads elements from separate files asynchronously.
    */
    void LoadFromCsvFilesL();

private:
    CElementsEngine(CConsoleBase& aConsole);
    void ConstructL();
    void TestElementList();
    void TestElementListStreamingL();
    void CreateRootDictionaryL();
    void CreateStoreL();
    TStreamId WriteSpecificElementTypeToStoreL(CChemicalElement::TElementType aElementType) const;
    void WriteElementsToStoreL() const;
    void ReadElementsFromStoreL();
    void WriteRootDictionaryL() const;
    void Panic(TInt aReason);

private:    //from MCsvFileLoaderObserver
    void NotifyElementLoaded(TInt aNewElementIndex);
    void NotifyLoadCompleted(TInt aCompletionStatus, const CCsvFileLoader& aLoader);

private:    //data
    CElementList* iElementList;
    RFs iFs;
    CCsvFileLoader* iMetalsCsvFileLoader;
    CCsvFileLoader* iNonMetalsCsvFileLoader;
    CCsvFileLoader* iSemiMetalsCsvFileLoader;
    TInt iFilesCompleted;
    CConsoleBase& iConsole;
    CPersistentStore* iStore;
    CStreamDictionary* iRootDictionary;
};
#endif    // #ifndef ELEMENTSENGINE_H

// End of File

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?