srsf/vcommandhandler/inc/tagcommandconverter.h
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 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:  Converts VCommands into tags and vise veraa
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19  
       
    20 #ifndef TAGCOMMANDCONVERTER_H
       
    21 #define TAGCOMMANDCONVERTER_H
       
    22 
       
    23 #include <nssvasmtag.h>
       
    24 #include <nssvasmtagmgr.h>
       
    25 #include "vcommandinternalapi.h"
       
    26 
       
    27 class CVCommand;
       
    28 
       
    29 /**
       
    30 * A VCommand can be translated in no more, than KMaxTagsPerCommand tags
       
    31 */
       
    32 const TInt KMaxTagsPerCommand = 2;
       
    33 
       
    34 /** Index of the voice command id in the voice tag's rrd int array */
       
    35 const TInt KCommandIdRrdIntIndex = 0;
       
    36 
       
    37 
       
    38 
       
    39 /**
       
    40 * Converts VCommands into tags and vise veraa
       
    41 */
       
    42 class CTagCommandConverter : public CBase
       
    43 	{
       
    44 	public:
       
    45 		/**
       
    46 		* Converts given tags to the VCommand. These tags must have been generated
       
    47 		* from a single VCommand (via CommandToTagsLC2 ) 
       
    48 		* @leave KErrOverflow if given array has more, than two elements
       
    49 		* @leave KErrUnderflow if given array is empty
       
    50 		* @leave KErrArgument if given tags correspond to the different VCommands
       
    51 		*/
       
    52 		static CStoredVCommand* TagsToCommandLC( const CArrayPtr<MNssTag>& aTags );
       
    53 		
       
    54 		/**
       
    55 		* Constructs new VAS tags from a command and a context. 
       
    56 		* Does not save to VAS, just creates. At the end of this function two
       
    57 		* items are pushed to the cleanup stack. The first PopAndDestroy will
       
    58 		* ResetAndDestroy the generated tags, the second one will delete the
       
    59 		* CArrayPtr itself
       
    60 		*
       
    61 		* @return array of one or two VAS tags. Two tags are created if a given 
       
    62 		*         command has a UserText set. The created tags bear the identical
       
    63 		*         data
       
    64 		*/
       
    65 		static CArrayPtr<MNssTag>* CommandToTagsLC2( const CVCommand& aCommand, 
       
    66 						const MNssContext& aContext, MNssTagMgr& aTagMgr );
       
    67 		
       
    68 		/**
       
    69 		* Converts given tag to the CStoredVCommand
       
    70 		* @leave KErrTotalLossOfPrecision if the aTag's intArray is empty
       
    71 		*/
       
    72 		static CStoredVCommand* TagToCommandLC( const MNssTag& aTag );
       
    73 		
       
    74 		/**
       
    75 		* Constructs a new VAS tag from a command and a context. 
       
    76 		* Does not save to VAS, just creates. Created tag stores the streamed
       
    77 		* VCommand in its RRDText array. The tag's rrd int array of the created 
       
    78 		* tag is empty
       
    79 		*/
       
    80 		static MNssTag* CommandToTagLC( const CVCommand& aCommand, 
       
    81 						const MNssContext& aContext, MNssTagMgr& aTagMgr );
       
    82 	};
       
    83 
       
    84 #endif // TAGCOMMANDCONVERTER_H