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