ncdengine/provider/client/src/ncdclientsubscribablecontent.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncdclientsubscribablecontent.h"
       
    20 #include "catalogsdebug.h"
       
    21 
       
    22 CNcdClientSubscribableContent::CNcdClientSubscribableContent()
       
    23     {
       
    24     }
       
    25 
       
    26 void CNcdClientSubscribableContent::ConstructL()
       
    27     {
       
    28     ResetMemberVariables();
       
    29     }
       
    30 
       
    31 CNcdClientSubscribableContent* CNcdClientSubscribableContent::NewL()
       
    32     {
       
    33     CNcdClientSubscribableContent* self = NewLC();
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 CNcdClientSubscribableContent* CNcdClientSubscribableContent::NewLC()
       
    39     {
       
    40     CNcdClientSubscribableContent* self =
       
    41         new (ELeave) CNcdClientSubscribableContent;
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL();
       
    44     return self;
       
    45     }
       
    46 
       
    47 CNcdClientSubscribableContent::~CNcdClientSubscribableContent()
       
    48     {
       
    49     ResetMemberVariables();
       
    50     }
       
    51 
       
    52 
       
    53 void CNcdClientSubscribableContent::InternalizeL( RReadStream& aStream )
       
    54     {
       
    55     DLTRACEIN((""));
       
    56     
       
    57     DLINFO(( "Internalizing subscribable content info." ));
       
    58     
       
    59     ResetMemberVariables();
       
    60     
       
    61     TInt64 intValidUntil( 0 );
       
    62     aStream >> intValidUntil;
       
    63     iValidUntil = intValidUntil;
       
    64     DLINFO(( "Valid until as integer: %Ld", iValidUntil.Int64() ));
       
    65     iValidUntilSet = aStream.ReadInt32L();
       
    66 
       
    67     iSubscriptionType = 
       
    68         static_cast<MNcdSubscription::TType>(aStream.ReadInt32L());    
       
    69     DLINFO(( "Subscription type: %d", iSubscriptionType ));
       
    70         
       
    71     iChildSeparatelyPurchasable = aStream.ReadInt32L();
       
    72     DLINFO(( "Child separately purchaseable: %d",
       
    73              iChildSeparatelyPurchasable ));    
       
    74     
       
    75     DLTRACEOUT((""));
       
    76     }
       
    77 
       
    78 
       
    79 
       
    80 
       
    81 TTime CNcdClientSubscribableContent::ValidUntil() const
       
    82     {
       
    83     return iValidUntil;
       
    84     }
       
    85 
       
    86 TBool CNcdClientSubscribableContent::ValidUntilSet() const
       
    87     {
       
    88     return iValidUntilSet;
       
    89     }
       
    90 
       
    91 TBool CNcdClientSubscribableContent::ChildSeparatelyPurchasable() const
       
    92     {
       
    93     return iChildSeparatelyPurchasable;
       
    94     }
       
    95 
       
    96     
       
    97 void CNcdClientSubscribableContent::ResetMemberVariables()
       
    98     {
       
    99     iValidUntil = 0;
       
   100     iValidUntilSet = EFalse;
       
   101     
       
   102     // It does not matter so much which type of the subscription is used
       
   103     // as the initial value. Probably if it is of any type that is incorrect
       
   104     // things are not looking great.
       
   105     
       
   106     iChildSeparatelyPurchasable = ETrue;    
       
   107     }