presetserver/serversrc/Pspendingpreset.cpp
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2006-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:  Represents a pending preset that has not yet been committed
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "pspendingpreset.h"
       
    20 
       
    21 // ======== LOCAL FUNCTIONS ========
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // Two-phased constructor.
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CPSPendingPreset* CPSPendingPreset::NewL( TInt aId )
       
    30     {
       
    31     CPSPendingPreset* self = new ( ELeave ) CPSPendingPreset( aId );
       
    32     CleanupStack::PushL( self );
       
    33     self->ConstructL();
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // Constructor.
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 CPSPendingPreset::CPSPendingPreset( TInt aId )
       
    43     : iId( aId )
       
    44     {
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // Second-phase constructor.
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 void CPSPendingPreset::ConstructL()
       
    52     {
       
    53     iName.CreateL( KNullDesC );
       
    54     iData.CreateL( KNullDesC8 );
       
    55     }
       
    56     
       
    57 // ---------------------------------------------------------------------------
       
    58 // Destructor.
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 CPSPendingPreset::~CPSPendingPreset()
       
    62     {
       
    63     iName.Close();
       
    64     iData.Close();
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // Returns the ID of the preset.
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 TInt CPSPendingPreset::Id() const
       
    72     {
       
    73     return iId;
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // Sets the index of the preset.
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 void CPSPendingPreset::SetIndex( TInt aIndex )
       
    81     {
       
    82     iIndex = aIndex;
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // Returns the index of the preset.
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 TInt CPSPendingPreset::Index() const
       
    90     {
       
    91     return iIndex;
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // Sets the name of the preset.
       
    96 // ---------------------------------------------------------------------------
       
    97 //
       
    98 void CPSPendingPreset::SetNameL( const TDesC& aName )
       
    99     {
       
   100     iName.Close();
       
   101     iName.CreateL( aName );
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // Returns the name of the preset.
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 const TDesC& CPSPendingPreset::Name() const
       
   109     {
       
   110     return iName;
       
   111     }
       
   112 
       
   113 // ---------------------------------------------------------------------------
       
   114 // Sets the data of the preset.
       
   115 // ---------------------------------------------------------------------------
       
   116 //
       
   117 void CPSPendingPreset::SetDataL( const TDesC8& aData )
       
   118     {
       
   119     iData.Close();
       
   120     iData.CreateL( aData );
       
   121     }
       
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 // Returns the data of the preset.
       
   125 // ---------------------------------------------------------------------------
       
   126 //
       
   127 const TDesC8& CPSPendingPreset::Data() const
       
   128     {
       
   129     return iData;
       
   130     }
       
   131 
       
   132 // ======== GLOBAL FUNCTIONS ========