cbsref/telephonyrefplugins/atltsy/comms/inc/stringparser.h
branchRCL_3
changeset 19 630d2f34d719
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cbsref/telephonyrefplugins/atltsy/comms/inc/stringparser.h	Tue Aug 31 16:23:08 2010 +0300
@@ -0,0 +1,81 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// CStringParser
+
+#ifndef STRINGPARSER_H_
+#define STRINGPARSER_H_
+
+//system include
+#include <e32base.h>
+
+//user include
+#include "mcommobserver.h"
+
+
+class CStringParser : public CBase
+	{
+public:
+	static CStringParser* NewL(TInt aBufferSize);
+	
+	static CStringParser* NewLC(TInt aBufferSize);
+	
+	virtual ~CStringParser();
+	
+public:
+	void ProcessReadString(const TDesC8& aReadString);
+	
+	TPtrC8 Buffer() const;
+	
+	TPtrC8 CurrentLine() const;
+	
+	void ClearBuffer();
+	
+	void ClearCurrentLine();
+	
+	//Must be call this function
+	void SetReadLineNotify(MCommReadLineNotifier* aNofity);
+	
+protected:
+	
+	CStringParser();
+	
+	void ConstructL(TInt aBufferSize);
+	
+	void CreateL(TInt aBufferSize);
+	
+private:
+	TText8 *iBuffer;
+	TText8 *iBufferEnd;
+	/**
+	* The last char added in the current line
+	*/
+	TText8 *iLastChar;
+	
+	/**
+	* The start of \r\n delimited line
+	*/
+	TText8 *iLineStart;
+	
+	/**
+	* Means if current char is a delimiter
+	*/
+	TBool iInDelimiter;
+	
+	/**
+	*
+	*/
+	MCommReadLineNotifier *iReadLineNotify; //Not owned
+	};
+
+#endif /*STRINGPARSER_H_*/