qtms/src/qtmsbufferimpl.cpp
branchRCL_3
changeset 56 63223d4fd956
parent 55 6c1dfe4da5dd
child 59 666f9a5a90a9
equal deleted inserted replaced
55:6c1dfe4da5dd 56:63223d4fd956
     1 /*
       
     2  * Copyright (c) 2010 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: Telephony Multimedia Service
       
    15  *
       
    16  */
       
    17 
       
    18 #include <qtms.h>
       
    19 #include "tmsutility.h"
       
    20 #include "qtmsmembuffer.h"
       
    21 #include "qtmsbufferimpl.h"
       
    22 
       
    23 using namespace QTMS;
       
    24 
       
    25 gint QTMSBufferImpl::Create(QTMSBufferType buffertype, QTMSBuffer*& buffer,
       
    26     TMS::TMSBuffer*& tmsbuffer)
       
    27 {
       
    28     gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY);
       
    29     TRACE_PRN_FN_ENT;
       
    30     switch (buffertype) {
       
    31     case QTMS_BUFFER_MEMORY:
       
    32         ret = QTMSMemBuffer::Create(buffer, tmsbuffer);
       
    33         break;
       
    34     default:
       
    35         ret = QTMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED;
       
    36         break;
       
    37     }
       
    38 
       
    39     TRACE_PRN_FN_EXT;
       
    40     return ret;
       
    41 }
       
    42 
       
    43 gint QTMSBufferImpl::Delete(QTMSBuffer*& buffer)
       
    44 {
       
    45     gint ret(QTMS_RESULT_INVALID_ARGUMENT);
       
    46     TRACE_PRN_FN_ENT;
       
    47     QTMSBufferType buffertype;
       
    48     ret = buffer->GetType(buffertype);
       
    49     switch (buffertype) {
       
    50     case QTMS_BUFFER_MEMORY:
       
    51         delete (static_cast<QTMSMemBuffer*> (buffer));
       
    52         buffer = NULL;
       
    53         ret = QTMS_RESULT_SUCCESS;
       
    54         break;
       
    55     default:
       
    56         ret = QTMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED;
       
    57         break;
       
    58     }
       
    59 
       
    60     TRACE_PRN_FN_EXT;
       
    61     return ret;
       
    62 }
       
    63 
       
    64 // End of file