messagingfw/msgurlhandler/urlhandler/inc/SMSSCH.H
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2001-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 // This file contains the API definition for the class CSmsSchemeHandler.
       
    15 // This class parses a descriptor into the component fields of a gsm-sms 
       
    16 // scheme as described in "draft-antti-gsm-sms-url-04" 
       
    17 // and launches the sms editor with the sms-numbers filled in.
       
    18 // 
       
    19 //
       
    20 
       
    21 /**
       
    22  @file
       
    23 */
       
    24 
       
    25 #ifndef __SMSSCH_H__
       
    26 #define __SMSSCH_H__
       
    27 
       
    28 // Local includes
       
    29 //
       
    30 #include "MSGBASE.H"
       
    31 
       
    32 
       
    33 /**
       
    34 	@struct SSmsNumber
       
    35 	Comments :	Structure containing descriptor pointer of sms-number 
       
    36 				and service center number 
       
    37 	@since 7.0
       
    38 */
       
    39 struct SSmsNumber
       
    40 /**
       
    41 @internalComponent
       
    42 @released
       
    43 */
       
    44 	{
       
    45 	SSmsNumber() : iNumber(KNullDesC), iServiceCentre(KNullDesC) {}
       
    46 	TPtrC iNumber;
       
    47 	TPtrC iServiceCentre;
       
    48 	};
       
    49 
       
    50 
       
    51 /**
       
    52 	@class
       
    53 	Comments :	Parses a descriptor into the component fields of a gsm-sms scheme 
       
    54 				as described in "draft-antti-gsm-sms-url-04"
       
    55 				and launches the sms editor with the sms-numbers filled in.
       
    56 				There are 2 fields; sms-number and service center number.
       
    57 				These fields are valid for the lifetime of this object.
       
    58 	
       
    59 	Format of a typical gsm-sms url is: 
       
    60 		sms:<sms-number>;via=<service center number>,<sms-number>;via=<service center number>...
       
    61 
       
    62 	@since 7.0
       
    63 */
       
    64 class CSmsSchemeHandler : public CMsgSchemeHandlerBase
       
    65 /**
       
    66 @internalComponent
       
    67 @released
       
    68 */
       
    69 	{
       
    70 
       
    71 public:		// Methods
       
    72 
       
    73 /**
       
    74 	@fn				NewLC()
       
    75 	Intended Usage	:	Static factory constructor. Uses two phase construction and 
       
    76 						leaves a pointer to created object on the CleanupStack.
       
    77 	@since			7.0
       
    78 	@leave		KErrNoMemory.
       
    79 	@return			A pointer to the newly created CSmsSchemeHandler object 
       
    80 	@pre 			None
       
    81 	@post			A fully constructed and initialised CSmsSchemeHandler object.
       
    82  */
       
    83 	static CSmsSchemeHandler* NewLC();
       
    84 
       
    85 /**
       
    86 	@fn				NewL()
       
    87 	Intended Usage	:	Static factory constructor. Uses two phase construction and 
       
    88 						leaves nothing on the CleanupStack.
       
    89 	@since			7.0
       
    90 	@leave		KErrNoMemory.
       
    91 	@return			A pointer to the newly created CSmsSchemeHandler object. 
       
    92 	@pre 			None
       
    93 	@post			A fully constructed and initialised CSmsSchemeHandler object.
       
    94  */
       
    95 	static CSmsSchemeHandler* NewL();
       
    96 
       
    97 /**
       
    98 	@fn				~CSmsSchemeHandler()
       
    99 	Intended Usage	:	Destructor.
       
   100 	@since			7.0
       
   101  */
       
   102 	~CSmsSchemeHandler();
       
   103 
       
   104 private:		// Methods
       
   105 
       
   106 /**
       
   107 	@fn				CSmsSchemeHandler()
       
   108 	Intended Usage	:	Constructor. First phase of two-phase construction method. Does 
       
   109 						non-allocating construction.
       
   110 	@since			7.0
       
   111  */
       
   112 	CSmsSchemeHandler();
       
   113 
       
   114 /**
       
   115 	@fn				ConstructL()
       
   116 	Intended Usage	:	Second phase of two-phase construction method. Does any 
       
   117 						allocations required to fully construct the object.
       
   118 	@since			7.0
       
   119 	@leave		KErrNoMemory.
       
   120 	@pre 			First phase of construction is complete
       
   121 	@post			The object is fully constructed and initialised.
       
   122  */
       
   123 	void ConstructL();
       
   124 
       
   125 /**
       
   126 	@fn				ParseUrlL(const TDesC& aUrl)
       
   127 	Intended Usage	: Parses a descriptor into the component fields of a gsm-sms scheme 
       
   128 					  as described in "draft-antti-gsm-sms-url-04". 
       
   129 	@since			7.0
       
   130 	@param			aUrl	A descriptor with the gsm-sms url.
       
   131 	@pre 			None
       
   132 	@post			The gsm-sms url descriptor has been parsed and field values are set.
       
   133  */
       
   134 	virtual void ParseUrlL(const TDesC& aUrl);
       
   135 
       
   136 /**
       
   137 	@fn				ParseSmsNumber(const TPtrC& aNumber, TPtrC& aParsedNumber)
       
   138 	Intended Usage	:	Parses the sms number so that it only contains the allowed characters.
       
   139 	@since			7.0
       
   140 	@param			aNumber			A descriptor pointer to the sms-number to be parsed 
       
   141 	@param			aParsedNumber	This is an output argument that is set to the 
       
   142 									parsed number. 
       
   143 	@return			An error value of KErrNotFound if the sms-number is NULL and
       
   144 					a value of KErrNone if there is a valid sms-number.  
       
   145 	@pre 			None
       
   146 	@post			The sms-number is parsed and it only contains the allowed characters.
       
   147  */
       
   148 	TInt ParseSmsNumber(const TPtrC& aNumber, TPtrC& aParsedNumber);
       
   149 
       
   150 /**
       
   151 	@fn				void GetServiceCenter(const TPtrC& aComponent, TPtrC& aServiceCenter)
       
   152 	Intended Usage	:	Sets the service center number from the component
       
   153 	@since			7.0
       
   154 	@param			aComponent			A descriptor pointer to the component.
       
   155 	@param			aServiceCenter		This is an output argument that is set to the 
       
   156 										service center number if it exists otherwise a NULL
       
   157 										descriptor is set. 
       
   158 	@pre 			None
       
   159 	@post			The service center number have been set.
       
   160  */
       
   161 	void GetServiceCenter(const TPtrC& aComponent, TPtrC& aServiceCenter);
       
   162 
       
   163 /**
       
   164 	@fn				SendL()
       
   165 	Intended Usage	:	Creates the sms message with the sms-numbers filled in 
       
   166 						and launches the sms editor.
       
   167 	@since			7.0
       
   168 	@pre 			None
       
   169 	@post			Sms message have been created and sms editor has been launched.
       
   170  */
       
   171 	virtual void SendL();
       
   172 
       
   173 private:		// Attributes
       
   174 
       
   175 	/** Array containing SSmsNumber structure */
       
   176 	RArray<SSmsNumber> iNumbers;
       
   177 
       
   178 	// To access the private members for testing 
       
   179 	friend class TSmsSchemeHandler_StateAccessor;
       
   180 	};
       
   181 
       
   182 #endif