testtoolsconn/stat/desktop/source/lib/inc/statscriptdecoder.h
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef STATSCRIPTDECODER_H
       
    22 #define STATSCRIPTDECODER_H
       
    23 
       
    24 #include "stat.h"
       
    25 #include "CSTATDataFormatConverter.h"
       
    26 #include "CSTATImageVerify.h"
       
    27 
       
    28 class CSTATScriptCommand
       
    29 {
       
    30 public:
       
    31 	CSTATScriptCommand();
       
    32 	~CSTATScriptCommand();
       
    33 	char *Command()			{ return pCommand; }
       
    34 	unsigned long Length()	{ return ulLength; }
       
    35 	bool SetData(const char *pData, const unsigned long theLength);
       
    36 	void Reset();
       
    37 
       
    38 	char cCommandID;
       
    39 	unsigned long ulLength;
       
    40 
       
    41 private:
       
    42 	char *pCommand;
       
    43 };
       
    44 
       
    45 class CSTATScriptDecoder
       
    46 {
       
    47 public:
       
    48 	CSTATScriptDecoder(CSTATLogFile *theLog);
       
    49 	~CSTATScriptDecoder();
       
    50 	int Initialise(const CString& file, bool bIsFile);
       
    51 	int GetNextCommand(CSTATScriptCommand **ppCommand);
       
    52 	void Release();
       
    53 
       
    54 private:
       
    55 	int ReadDataIntoMemory(const CString& commands);
       
    56 	int ReadFileIntoMemory(CFile& scriptdata);
       
    57 	int ValidateScript();
       
    58 	int ExtractComment();
       
    59 	bool IncrementCounter(void);
       
    60 
       
    61 	CSTATLogFile *pLog;
       
    62 	char *lpBuffer;										// buffer that holds read script file
       
    63 	long lFileLength;									// length of file read
       
    64 	int iCounter;										// step counter through file
       
    65 	CSTATScriptCommand LastCommand;
       
    66 };
       
    67 
       
    68 #endif