srsf/nssvasapi/nssvascore/src/nssvasctag.cpp
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2002-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:  CNssTag implements MNssTag. In addition, it provides members for use
       
    15 *               by VAS internal components.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "nssvasctag.h"
       
    22 #include "rubydebug.h"
       
    23 
       
    24 
       
    25 // ================= MEMBER FUNCTIONS =======================
       
    26 
       
    27 // ---------------------------------------------------------
       
    28 // CNssTag::CNssTag
       
    29 // C++ constructor can NOT contain any code, that might leave.
       
    30 // ---------------------------------------------------------
       
    31 //
       
    32 CNssTag::CNssTag( CNssContext* aContext, CNssRRD* aRRD, 
       
    33                   CNssSpeechItem* aSpeechItem )
       
    34     {
       
    35     iContext = aContext;
       
    36     iRRD = aRRD;
       
    37     iSpeechItem = aSpeechItem;
       
    38     iTagId = KNssVASDbDefaultValue;
       
    39     }
       
    40 
       
    41 // ---------------------------------------------------------
       
    42 // CNssTag::~CNssTag
       
    43 // Destructor
       
    44 // ---------------------------------------------------------
       
    45 //
       
    46 CNssTag::~CNssTag()
       
    47     {
       
    48     delete iContext;
       
    49     iContext = NULL;
       
    50     
       
    51     delete iRRD;
       
    52     iRRD = NULL;
       
    53     
       
    54     delete iSpeechItem;
       
    55     iSpeechItem = NULL;
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CNssTag::Context
       
    60 // get the context object for this tag
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 MNssContext* CNssTag::Context()
       
    64     {
       
    65     return  iContext;
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // CNssTag::RRD
       
    70 // get the RRD object for this tag
       
    71 // ---------------------------------------------------------
       
    72 //
       
    73 MNssRRD* CNssTag::RRD()
       
    74     {
       
    75     return  iRRD;
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------
       
    79 // CNssTag::SpeechItem
       
    80 // get the speech item for this tag
       
    81 // ---------------------------------------------------------
       
    82 //
       
    83 MNssSpeechItem* CNssTag::SpeechItem()
       
    84     {
       
    85     return iSpeechItem;
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------
       
    89 // CNssTag::TagId
       
    90 // get the tag id for this tag
       
    91 // ---------------------------------------------------------
       
    92 //
       
    93 TInt CNssTag::TagId()
       
    94     {
       
    95     return iTagId;
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------
       
    99 // CNssTag::SetTagId
       
   100 // Set the tag id for this tag
       
   101 // ---------------------------------------------------------
       
   102 //
       
   103 void CNssTag::SetTagId(TInt aId)
       
   104     {
       
   105     iTagId = aId;
       
   106     
       
   107     if ( iSpeechItem )
       
   108         {
       
   109         iSpeechItem->SetTagId( aId );
       
   110         }
       
   111     }
       
   112 
       
   113 // ---------------------------------------------------------
       
   114 // CNssTag::CopyL
       
   115 // Make a deep copy of the tag
       
   116 // ---------------------------------------------------------
       
   117 //
       
   118 CNssTag* CNssTag::CopyL()
       
   119     {
       
   120     CNssContext *context = iContext->CopyL();
       
   121     CleanupStack::PushL( context );
       
   122     CNssRRD *rrd = iRRD->CopyL();
       
   123     CleanupStack::PushL( rrd );
       
   124     CNssSpeechItem *speechItem = iSpeechItem->CopyL( context );
       
   125     CleanupStack::PushL( speechItem );
       
   126     CNssTag* copy = new (ELeave) CNssTag( context, rrd, speechItem );
       
   127     CleanupStack::Pop( speechItem );
       
   128     CleanupStack::Pop( rrd );
       
   129     CleanupStack::Pop( context );
       
   130     copy->iTagId = iTagId;
       
   131     return copy;
       
   132     }
       
   133 
       
   134 //  End of File