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