meetingrequest/mrcalremoteattachment/remoteattachment/src/ccalremoteattachment.cpp
branchRCL_3
changeset 12 4ce476e64c59
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
       
     1 /*
       
     2 * Copyright (c) 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 *
       
    16 */
       
    17 
       
    18 #include "ccalremoteattachment.h"
       
    19 
       
    20 
       
    21 // ======== MEMBER FUNCTIONS ========
       
    22 // ---------------------------------------------------------------------------
       
    23 // CCalRemoteAttachment::CCalRemoteAttachment
       
    24 // ---------------------------------------------------------------------------
       
    25 //
       
    26 CCalRemoteAttachment::CCalRemoteAttachment(
       
    27         TInt aAttachmentSizeInBytes,
       
    28         MCalRemoteAttachment::TCalRemoteAttachmentState aState ) :
       
    29     iSizeInBytes( aAttachmentSizeInBytes ),
       
    30     iState( aState )
       
    31     {
       
    32     
       
    33     }
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // CCalRemoteAttachment::~CCalRemoteAttachment
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 EXPORT_C CCalRemoteAttachment::~CCalRemoteAttachment()
       
    40     {
       
    41     delete iLabel;
       
    42     delete iIdentifier;
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CCalRemoteAttachment::NewL
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 EXPORT_C CCalRemoteAttachment* CCalRemoteAttachment::NewL(
       
    50             const TDesC& aAttachmentIdentifier,
       
    51             const TDesC& aAttachmentLabel,
       
    52             TInt aAttachmentSizeInBytes,
       
    53             MCalRemoteAttachment::TCalRemoteAttachmentState aState )
       
    54     {
       
    55     CCalRemoteAttachment* self = 
       
    56             new (ELeave) CCalRemoteAttachment( 
       
    57                     aAttachmentSizeInBytes, aState );
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL( aAttachmentIdentifier, aAttachmentLabel );
       
    60     CleanupStack::Pop( self );
       
    61     return self;
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CCalRemoteAttachment::ConstructL
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 void CCalRemoteAttachment::ConstructL(
       
    69         const TDesC& aAttachmentIdentifier,
       
    70         const TDesC& aAttachmentLabel )
       
    71     {    
       
    72     iIdentifier = aAttachmentIdentifier.AllocL();
       
    73     iLabel = aAttachmentLabel.AllocL();
       
    74     }
       
    75     
       
    76 // ---------------------------------------------------------------------------
       
    77 // CCalRemoteAttachment::SetAttachmentLabelL
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 void CCalRemoteAttachment::SetAttachmentLabelL(
       
    81         const TDesC& aAttachmentLabel )
       
    82     {
       
    83     HBufC* newLabel = aAttachmentLabel.AllocL();
       
    84     delete iLabel;
       
    85     iLabel = newLabel;  
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CCalRemoteAttachment::AttachmentLabel
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 const TDesC& CCalRemoteAttachment::AttachmentLabel() const
       
    93     {
       
    94     return *iLabel;
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CCalRemoteAttachment::SetAttachmentIdentifierL
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 void CCalRemoteAttachment::SetAttachmentIdentifierL(
       
   102         const TDesC& aAttachmentIdentifier )
       
   103     {
       
   104     HBufC* newLabel = aAttachmentIdentifier.AllocL();
       
   105     delete iIdentifier;
       
   106     iIdentifier = newLabel;
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CCalRemoteAttachment::AttachmentIdentifier
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 const TDesC& CCalRemoteAttachment::AttachmentIdentifier() const
       
   114     {
       
   115     return *iIdentifier;
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // CCalRemoteAttachment::SetAttachmentSize
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 void CCalRemoteAttachment::SetAttachmentSize(
       
   123         TInt aAttachmentSizeInBytes )
       
   124     {
       
   125     iSizeInBytes = aAttachmentSizeInBytes;
       
   126     }
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // CCalRemoteAttachment::AttachmentSizeInBytes
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 TInt CCalRemoteAttachment::AttachmentSizeInBytes() const
       
   133     {
       
   134     return iSizeInBytes;
       
   135     }
       
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 // CCalRemoteAttachment::SetAttachmentState
       
   139 // ---------------------------------------------------------------------------
       
   140 //
       
   141 void CCalRemoteAttachment::SetAttachmentState(
       
   142         MCalRemoteAttachment::TCalRemoteAttachmentState aAttachmentState )
       
   143     {
       
   144     iState = aAttachmentState;
       
   145     }
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // CCalRemoteAttachment::AttachmenState
       
   149 // ---------------------------------------------------------------------------
       
   150 //
       
   151 MCalRemoteAttachment::TCalRemoteAttachmentState CCalRemoteAttachment::AttachmenState() const
       
   152     {
       
   153     return iState;
       
   154     }
       
   155 
       
   156 // EOF