mmsharing/mmshengine/inc/musenguriparser.h
changeset 0 f0cf47e981f9
child 32 73a1feb507fb
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     1 /*
       
     2 * Copyright (c) 2005 - 2006 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:  Parser for recipient's address
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MUSENGURIPARSER_H
       
    20 #define MUSENGURIPARSER_H
       
    21 
       
    22 //  INCLUDES
       
    23 
       
    24 #include "musunittesting.h"
       
    25 #include <e32cmn.h>
       
    26 
       
    27 const TInt KMaxUriLength = 512;
       
    28 _LIT8( KMusEngAtSign, "@" );
       
    29 _LIT8( KMusEngPlusSign, "+" );
       
    30 _LIT8( KMusEngSipPrefix, "sip:" );
       
    31 _LIT8( KMusEngSipsPrefix, "sips:" );
       
    32 _LIT8( KMusEngTelPrefix, "tel:" );
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 * 
       
    38 */
       
    39 class TMusEngUriParser
       
    40     {
       
    41     MUS_UNITTEST( UT_TMusEngUriParser ) 
       
    42     
       
    43     public:
       
    44     
       
    45         enum TMusEngUriType
       
    46             {
       
    47             ENotParsed = 0,
       
    48             ESip,
       
    49             ETel
       
    50             };
       
    51     
       
    52     public:
       
    53      
       
    54 		/**
       
    55 		* Default constructor
       
    56 		*/
       
    57      	IMPORT_C TMusEngUriParser( const TDesC16& aUri );
       
    58      	
       
    59      	/**
       
    60 		* @returns Uri type
       
    61 		*/
       
    62      	IMPORT_C TMusEngUriType UriType();
       
    63 
       
    64 		/**
       
    65 		* @returns Parsed and validated 8-bit version of contained URI
       
    66 		*          Ownership is transferred
       
    67 		* @pre UriType() != ENotParsed
       
    68 		* @leave KErrNotReady if precondition is not fulfilled
       
    69 		*/
       
    70      	IMPORT_C HBufC8* GetUri8L();
       
    71      	
       
    72      	/**
       
    73      	* @param aPrefix if ETrue, also sip: or tel:prefix is returned
       
    74 		* @returns Parsed and validated 16-bit version of contained URI
       
    75 		*          Ownership is transferred
       
    76 		* @pre UriType() != ENotParsed
       
    77 		* @leave KErrNotReady if precondition is not fulfilled
       
    78 		*/
       
    79      	IMPORT_C HBufC16* GetUri16L( TBool aPrefix );
       
    80      
       
    81      	/**
       
    82         * Parses and validates contained URI
       
    83         * @leave KErrCorrupt if URI is not valid SIP or TEL URI
       
    84         * @post UriType() != ENotParsed
       
    85         */
       
    86         IMPORT_C void ParseUriL();
       
    87         
       
    88      	
       
    89     private:
       
    90 
       
    91         void HandleSipUriL();
       
    92         void HandleTelUriL();
       
    93         void HandleLocalTelUriL();
       
    94         
       
    95     
       
    96 		TBuf8<KMaxUriLength> iUri;
       
    97 
       
    98         TMusEngUriType iUriType;
       
    99         
       
   100     };
       
   101 
       
   102 #endif