os/persistentdata/traceservices/tracefw/ulogger/src/pluginframework/inputdata.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // ULogger
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @internalTechnology
    21  @prototype
    22 */
    23 
    24 #ifndef INPUTDATA_H_
    25 #define INPUTDATA_H_
    26 
    27 #ifdef __SYMBIAN32__
    28 #include <e32base.h>
    29 #include <e32cmn.h>
    30 #else
    31 #include <iostream.h>
    32 #include <memory.h>
    33 #endif
    34 
    35 
    36 //define ControlData type
    37 typedef char ControlData; 
    38 
    39 //const values
    40 const char DATA_SEPARATOR = ' '; //space 
    41 const char CD_CR = 0x0D; //end os line in MacOS style
    42 const char CD_LF = 0x0A; //end of line in Unix/Linux style
    43 const int SIZE_OF_EOL = 2;
    44 const char CD_EOL[SIZE_OF_EOL] = {CD_CR,CD_LF}; //end of line in Windows OS style
    45 
    46 
    47 
    48 /**This class should be used to create, update and parse Control Data packages.
    49 Write type functions create new control data chunk and update existing one, whereas 
    50 read type functions can parse and return certain data from existing control data packages.
    51 */
    52 class CInputData
    53 {
    54 public:
    55 	IMPORT_C CInputData(unsigned int aMinPackageSize=2);
    56 	IMPORT_C virtual ~CInputData();
    57 	
    58 	//read type functions
    59 	IMPORT_C unsigned long GetSize(const ControlData *aDataPtr);
    60 	IMPORT_C unsigned long GetChunksCount(const ControlData *aDataPtr);
    61 	IMPORT_C const void* GetChunk(const ControlData* aDataPtr, unsigned long aChunkNumber, unsigned long &aChunkSize);
    62 	
    63 	//write type functions
    64 	IMPORT_C ControlData* CreatePackage(void* aCommand, signed long aCommandSize);
    65 	IMPORT_C unsigned long AppendNewData(ControlData *&aDataPtr, const void* aAddData, unsigned long aAddDataSize);
    66 	
    67 private:
    68 	unsigned int iMinPackageSize;
    69 	unsigned long FindAvailablePlace(const ControlData *aDataPtr);
    70 	unsigned long CalcNumberOfPaddingChars(const ControlData *aDataPtr);
    71 	
    72 };
    73 
    74 #endif /*CONTROLDATAMANAGER_H_*/