browserutilities/feedsengine/FeedsServer/Common/src/PackedFeed.cpp
changeset 0 dd21522fd290
child 36 0ed94ceaa377
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2005 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 the License "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:  Is a serialized version of CFeed suitable for transfer between
       
    15 *                client and server.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "PackedAttributes.h"
       
    21 #include "FeedAttributes.h"
       
    22 #include "PackedFeed.h"
       
    23 #include "Logger.h"
       
    24 
       
    25 
       
    26 const TInt KTokenArrayIncrementSize = 1000;
       
    27 const TInt KStringTableIncrementSize = 10240;
       
    28 
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CPackedFeed::NewL
       
    32 //
       
    33 // Two-phased constructor.  Used on both the client and server.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CPackedFeed* CPackedFeed::NewL()
       
    37     {
       
    38     CPackedFeed* self = new (ELeave) CPackedFeed(KTokenArrayIncrementSize, 
       
    39             KStringTableIncrementSize);
       
    40 
       
    41     CleanupStack::PushL(self);
       
    42     self->ConstructL();
       
    43     CleanupStack::Pop();
       
    44 
       
    45     return self;
       
    46     }
       
    47 
       
    48         
       
    49 // -----------------------------------------------------------------------------
       
    50 // CPackedFeed::CPackedFeed
       
    51 //
       
    52 // C++ default constructor can NOT contain any code, that
       
    53 // might leave.  Used on both the client and server.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CPackedFeed::CPackedFeed(TInt aTokenArrayInc, TInt aStringTableInc):
       
    57         CPacked(aTokenArrayInc, aStringTableInc), iLeakTracker(CLeakTracker::EPackedFeed)
       
    58     {
       
    59     }
       
    60         
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CPackedFeed::ConstructL
       
    64 //
       
    65 // Symbian 2nd phase constructor can leave.  Used on both the client and server.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 void CPackedFeed::ConstructL()
       
    69     {
       
    70     BaseConstructL();
       
    71     }
       
    72         
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CPackedFeed::~CPackedFeed
       
    76 //
       
    77 // Deconstructor.  Used on both the client and server.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 CPackedFeed::~CPackedFeed()
       
    81     {
       
    82     }
       
    83 
       
    84         
       
    85 // -----------------------------------------------------------------------------
       
    86 // CPackedFeed::FeedBeginsL
       
    87 //
       
    88 // Insert the begining of a feed.   Used only on the server.
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 void CPackedFeed::FeedBeginsL()
       
    92     {
       
    93     InsertTokenL(EFeedTokenFeedBegin);
       
    94     }
       
    95 
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CPackedFeed::FeedEndsL
       
    99 //
       
   100 // Insert the ending of a feed.    Used only on the server.
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 void CPackedFeed::FeedEndsL()
       
   104     {
       
   105     InsertTokenL(EFeedTokenFeedEnd);
       
   106     
       
   107     // Done packing the feed so wrap a descriptor around iTokenArray.
       
   108     iTokenArrayAsDes.Set((const TUint8*) iTokenArray, iTokenArrayLength * sizeof(TUint));
       
   109     }
       
   110 
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CPackedFeed::ItemBeginsL
       
   114 //
       
   115 // Insert the begining of a item.   Used only on the server.
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 void CPackedFeed::ItemBeginsL()
       
   119     {
       
   120     InsertTokenL(EFeedTokenItemBegin);
       
   121     }
       
   122 
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CPackedFeed::ItemEndsL
       
   126 //
       
   127 // Insert the ending of a item.   Used only on the server.
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 void CPackedFeed::ItemEndsL()
       
   131     {
       
   132     InsertTokenL(EFeedTokenItemEnd);
       
   133     }
       
   134 
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CPackedFeed::EnclosureBeginsL
       
   138 //
       
   139 // Insert the begining of a enclosure.   Used only on the server.
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 void CPackedFeed::EnclosureBeginsL()
       
   143     {
       
   144     InsertTokenL(EFeedTokenEnclosureBegin);
       
   145     }
       
   146 
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CPackedFeed::EnclosureEndsL
       
   150 //
       
   151 // Insert the ending of a enclosure.   Used only on the server.
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 void CPackedFeed::EnclosureEndsL()
       
   155     {
       
   156     InsertTokenL(EFeedTokenEnclosureEnd);
       
   157     }
       
   158 
       
   159 
       
   160 // -----------------------------------------------------------------------------
       
   161 // CPackedFeed::OtherTitleL
       
   162 //
       
   163 // Insert an unimportant token.  The client can use this information for feed 
       
   164 // validation. Used only on the server.
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 void CPackedFeed::OtherTitleL()
       
   168     {
       
   169     InsertTokenL(EFeedTokenOtherTitle);
       
   170     }
       
   171 
       
   172 
       
   173 // -----------------------------------------------------------------------------
       
   174 // CPackedFeed::OtherDescriptionL
       
   175 //
       
   176 // Insert an unimportant token.  The client can use this information for feed 
       
   177 // validation. Used only on the server.
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 void CPackedFeed::OtherDescriptionL()
       
   181     {
       
   182     InsertTokenL(EFeedTokenOtherDescription);
       
   183     }
       
   184 
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // CPackedFeed::OtherLinkL
       
   188 //
       
   189 // Insert an unimportant token.  The client can use this information for feed 
       
   190 // validation. Used only on the server.
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 void CPackedFeed::OtherLinkL()
       
   194     {
       
   195     InsertTokenL(EFeedTokenOtherLink);
       
   196     }
       
   197 
       
   198 
       
   199