landmarks/locationlandmarks/converter/src/EPos_CPosLmBufferOutput.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     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 "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: Buffer output for encoder.
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "EPos_CPosLmBufferOutput.h"
       
    22 
       
    23 // CONSTANTS
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CPosLmBufferOutput::CPosLmBufferOutput
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CPosLmBufferOutput::CPosLmBufferOutput()
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CPosLmBufferOutput::ConstructL
       
    39 // Symbian 2nd phase constructor can leave.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 void CPosLmBufferOutput::ConstructL(TInt anExpandSize)
       
    43     {
       
    44     BaseConstructL(iBufWriteStream);
       
    45 
       
    46     iBuffer = CBufSeg::NewL(anExpandSize);
       
    47     iOwnsBuffer = ETrue;
       
    48 
       
    49     iBufWriteStream.Open(*iBuffer);
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CPosLmBufferOutput::NewL
       
    54 // Two-phased constructor.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 CPosLmBufferOutput* CPosLmBufferOutput::NewL(TInt anExpandSize)
       
    58     {
       
    59     CPosLmBufferOutput* self = new (ELeave) CPosLmBufferOutput;
       
    60     CleanupStack::PushL(self);
       
    61     self->ConstructL(anExpandSize);
       
    62     CleanupStack::Pop(self);
       
    63     return self;
       
    64     }
       
    65 
       
    66 // Destructor
       
    67 CPosLmBufferOutput::~CPosLmBufferOutput()
       
    68     {
       
    69     iBufWriteStream.Release();
       
    70 
       
    71     if (iOwnsBuffer)
       
    72         {
       
    73         delete iBuffer;
       
    74         }
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CPosLmBufferOutput::CommitL
       
    79 //
       
    80 // (other items were commented in a header).
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CPosLmBufferOutput::CommitL()
       
    84     {
       
    85     CPosLmOutput::CommitL();
       
    86     iBuffer->Compress();
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // CPosLmBufferOutput::CheckLowDiskL
       
    91 //
       
    92 // (other items were commented in a header).
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CPosLmBufferOutput::CheckLowDiskL(
       
    96     const TDesC16& /*aDesc*/)
       
    97     {
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CPosLmBufferOutput::BufferLC
       
   102 //
       
   103 // (other items were commented in a header).
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 CBufBase* CPosLmBufferOutput::BufferLC()
       
   107     {
       
   108     CBufBase* buf = iBuffer;
       
   109     CleanupStack::PushL(buf);
       
   110     iOwnsBuffer = EFalse;
       
   111     return buf;
       
   112     }
       
   113 
       
   114 //  End of File