taskswitcher/utils/src/tsvisibilitymsg.cpp
changeset 116 305818acdca4
equal deleted inserted replaced
112:dbfb5e38438b 116:305818acdca4
       
     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:  Task list entry
       
    15 *
       
    16 */
       
    17 #include <s32mem.h>
       
    18 #include "tsvisibilitymsg.h"
       
    19 // -----------------------------------------------------------------------------
       
    20 CTsVisibilitMsg* CTsVisibilitMsg::NewLC(RReadStream& stream)
       
    21 {
       
    22     CTsVisibilitMsg *self = new (ELeave)CTsVisibilitMsg();
       
    23     CleanupStack::PushL(self);
       
    24     self->ConstructL(stream);
       
    25     return self;
       
    26 }
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 CTsVisibilitMsg* CTsVisibilitMsg::NewLC(TInt windowGroupId, Visibility visi)
       
    30 {
       
    31     CTsVisibilitMsg *self = new (ELeave)CTsVisibilitMsg();
       
    32     CleanupStack::PushL(self);
       
    33     self->ConstructL(windowGroupId, visi);
       
    34     return self;
       
    35 }
       
    36 // -----------------------------------------------------------------------------
       
    37 TInt CTsVisibilitMsg::size()
       
    38 {
       
    39     return sizeof(TInt) * 2;
       
    40 }
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 CTsVisibilitMsg::~CTsVisibilitMsg()
       
    44 {
       
    45     //No implementation required
       
    46 }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 TInt CTsVisibilitMsg::windowGroupId() const
       
    50 {
       
    51     return mWindowGroupId;
       
    52 }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 Visibility CTsVisibilitMsg::visibility() const
       
    56 {
       
    57     return mVisibility;
       
    58 }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 HBufC8* CTsVisibilitMsg::ExternalizeLC() const
       
    62 {
       
    63     HBufC8* retVal = HBufC8::NewLC(size());
       
    64     TPtr8 des(retVal->Des());
       
    65     RDesWriteStream stream(des);
       
    66     CleanupClosePushL(stream);
       
    67     stream << (*this);
       
    68     CleanupStack::PopAndDestroy(&stream);
       
    69     return retVal;
       
    70 }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 void CTsVisibilitMsg::ExternalizeL(RWriteStream &stream) const
       
    74 {
       
    75     stream.WriteInt32L(mWindowGroupId);
       
    76     stream.WriteInt32L(mVisibility);
       
    77     
       
    78 }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 void CTsVisibilitMsg::InternalizeL(RReadStream &stream)
       
    82 {
       
    83     mWindowGroupId = stream.ReadInt32L();
       
    84     mVisibility = static_cast<Visibility>(stream.ReadInt32L());
       
    85 }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 CTsVisibilitMsg::CTsVisibilitMsg()
       
    89 {
       
    90     //No implementaton required
       
    91 }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 void CTsVisibilitMsg::ConstructL(RReadStream &stream)
       
    95 {
       
    96     stream >> (*this);
       
    97 }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 void CTsVisibilitMsg::ConstructL(TInt windowGroupId, Visibility visi)
       
   101 {
       
   102     mWindowGroupId = windowGroupId;
       
   103     mVisibility = visi;
       
   104 }
       
   105