javaextensions/pim/framework/src.s60/cpimstringvalue.cpp
changeset 21 2a9601315dfc
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Specialized string value class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // CLASS HEADER
       
    20 #include "cpimstringvalue.h"
       
    21 
       
    22 // INTERNAL INCLUDES
       
    23 #include "pimpanics.h"
       
    24 #include "logger.h"
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CPIMStringValue::NewL
       
    30 // Default two-phase constructor
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 CPIMStringValue* CPIMStringValue::NewL(TPIMAttribute aAttributes,
       
    34                                        HBufC* aStringValue)
       
    35 {
       
    36     JELOG2(EPim);
       
    37     CPIMStringValue* self =
       
    38         new(ELeave) CPIMStringValue(aAttributes, aStringValue);
       
    39 
       
    40     return self;
       
    41 }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CPIMStringValue::NewLC
       
    45 // Default two-phase constructor. The newly created object is left to the
       
    46 // cleanup stack
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CPIMStringValue* CPIMStringValue::NewLC(TPIMAttribute aAttributes,
       
    50                                         HBufC* aStringValue)
       
    51 {
       
    52     JELOG2(EPim);
       
    53     CPIMStringValue* self = CPIMStringValue::NewL(aAttributes, aStringValue);
       
    54     CleanupStack::PushL(self);
       
    55     return self;
       
    56 }
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // Destructor
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 CPIMStringValue::~CPIMStringValue()
       
    63 {
       
    64     JELOG2(EPim);
       
    65     delete iStringValue;
       
    66 }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CPIMStringValue::SetValue
       
    70 // Other items were commented in the header
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 void CPIMStringValue::SetStringValue(const HBufC* aStringValue)
       
    74 {
       
    75     JELOG2(EPim);
       
    76     // Remove existing value if there is one
       
    77     delete iStringValue;
       
    78     iStringValue = aStringValue;
       
    79 }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // CPIMStringValue::Value
       
    83 // Other items were commented in the header
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 const HBufC* CPIMStringValue::StringValue() const
       
    87 {
       
    88     JELOG2(EPim);
       
    89     __ASSERT_DEBUG(iStringValue, User::Panic(KPIMPanicCategory,
       
    90                    EPIMPanicNullArgument));
       
    91     return iStringValue;
       
    92 }
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // CPIMStringValue::CPIMStringValue
       
    96 // Default C++ constructor
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 inline CPIMStringValue::CPIMStringValue(TPIMAttribute aAttributes,
       
   100                                         HBufC* aStringValue) :
       
   101         CPIMValueBase(aAttributes), iStringValue(aStringValue)
       
   102 {
       
   103     JELOG2(EPim);
       
   104 }
       
   105 
       
   106 // End of file