realtimenetprots/sipfw/SIP/Codec/src/CSIPTokenizer.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     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 * Name          : CSIPTokenizer.h
       
    16 * Part of       : SIP Codec
       
    17 * Version       : SIP/4.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 
       
    29 #ifndef CSIPTOKENIZER_H
       
    30 #define CSIPTOKENIZER_H
       
    31 
       
    32 #include <e32base.h>
       
    33 #include <badesca.h>
       
    34 #include "_sipcodecdefs.h"
       
    35 
       
    36 
       
    37 class CSIPTokenizer : public CBase
       
    38 	{
       
    39 public:
       
    40 
       
    41 	static CSIPTokenizer* NewL (const TDesC8& aValue, 
       
    42                                 const TChar& aSeparator, 
       
    43                                 TBool aNoticeParenthesis = EFalse,
       
    44                                 TBool aIgnoreLastEmpty   = EFalse,
       
    45                                 TBool aSkipSeparatorsBeforeAt = EFalse);
       
    46 	static CSIPTokenizer* 
       
    47 		NewLC (const TDesC8& aValue, 
       
    48                const TChar& aSeparator,
       
    49                TBool aNoticeParenthesis = EFalse,
       
    50                TBool aIgnoreLastEmpty   = EFalse,
       
    51                TBool aSkipSeparatorsBeforeAt = EFalse);
       
    52 
       
    53     ~CSIPTokenizer ();
       
    54 
       
    55 	CPtrC8Array& Tokens ();
       
    56 
       
    57 private:
       
    58 
       
    59     CSIPTokenizer (const TDesC8& aValue, 
       
    60                    const TChar& aSeparator,
       
    61                    TBool aNoticeParenthesis,
       
    62                    TBool aIgnoreLastEmpty,
       
    63                    TBool aSkipSeparatorsBeforeAt);
       
    64 	void ConstructL ();
       
    65 
       
    66 	void TokenizeL ();
       
    67 	void HandleQuote ();
       
    68 	void HandleOpeningAngleBracketL ();
       
    69 	void HandleClosingAngleBracketL ();
       
    70     void HandleOpeningParenthesis();
       
    71     void HandleClosingParenthesis();
       
    72 	void CheckMatchingQuotesBracketsL ();
       
    73 	void HandleOtherCharacterL (const TChar& aChr);
       
    74 	void AddLastTokenL ();
       
    75 
       
    76 private: // Data
       
    77 
       
    78 	CPtrC8Array* iTokens;
       
    79 	TPtrC8 iOriginalValue;
       
    80 	TLex8 iLexer;
       
    81 	TChar iSeparator;
       
    82 	TUint iParsedSoFar;
       
    83 	TUint iTokenLength;
       
    84 	TBool iPreviousWasBackSlash;
       
    85 	TBool iInQuotes;
       
    86 	TBool iInAngleBrackets;
       
    87     TBool iInParenthesis;
       
    88 	TUint iQuoteCount;
       
    89 	TUint iAngleBracketCount;
       
    90     TUint iParenthesisCount;
       
    91     TBool iIgnoreParenthesis;
       
    92     TBool iIgnoreLastEmptyValue;
       
    93     TBool iSkipSeparatorsBeforeAt;
       
    94 
       
    95 private: // For testing purposes
       
    96 
       
    97     UNIT_TEST(CSIPTokenizerTest)
       
    98 	};
       
    99 
       
   100 #endif // CSIPTOKENIZER_H
       
   101 
       
   102 // End of File