browserutilities/feedsengine/FeedsServer/XmlUtils/src/CleanupLibXml2.cpp
changeset 0 dd21522fd290
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:  A util class to cleanup libxml2 related instances.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <libxml2_xmlmemory.h>
       
    22 #include <libxml2_globals.h>
       
    23 
       
    24 #include "CleanupLibXml2.h"
       
    25 
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CleanupLibXml2::PushL
       
    29 //
       
    30 // Pushes a Libxml2 doc-ptr on the cleanup stack.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 void CleanupLibXml2::PushL(xmlDocPtr aDocPtr)
       
    34     {
       
    35     CleanupStack::PushL(TCleanupItem(&CleanupXmlDocPtr, aDocPtr));
       
    36     }
       
    37     
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CleanupLibXml2::PushL
       
    41 //
       
    42 // Pushes a Libxml2 string on the cleanup stack.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 void CleanupLibXml2::PushL(xmlChar* aXmlString)
       
    46     {
       
    47     CleanupStack::PushL(TCleanupItem(&CleanupXmlString, aXmlString));
       
    48     }
       
    49     
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CleanupLibXml2::PushL
       
    53 //
       
    54 // Pushes a Libxml2 buffer-ptr on the cleanup stack.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 void CleanupLibXml2::PushL(xmlBufferPtr aBufferPtr)
       
    58     {
       
    59     CleanupStack::PushL(TCleanupItem(&CleanupXmlBufferPtr, aBufferPtr));
       
    60     }
       
    61     
       
    62 
       
    63 //#if 0
       
    64 // -----------------------------------------------------------------------------
       
    65 // CleanupLibXml2::PushL
       
    66 //
       
    67 // Pushes a Libxml2 text-writer-ptr on the cleanup stack.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 void CleanupLibXml2::PushL(xmlTextWriterPtr aTextWriterPtr)
       
    71     {
       
    72     CleanupStack::PushL(TCleanupItem(&CleanupXmlTextWriterPtr, aTextWriterPtr));
       
    73     }
       
    74 //#endif    
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CleanupLibXml2::CleanupXmlDocPtr
       
    78 //
       
    79 // Cleanup stack callback method to delete a Libxml2 doc-ptr.
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 void CleanupLibXml2::CleanupXmlDocPtr(TAny *aPtr)
       
    83     {
       
    84     xmlFreeDoc(static_cast<xmlDocPtr>(aPtr));
       
    85     }
       
    86 
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CleanupLibXml2::CleanupXmlDocPtr
       
    90 //
       
    91 // Cleanup stack callback method to delete a Libxml2 doc-ptr.
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CleanupLibXml2::CleanupXmlString(TAny *aPtr)
       
    95     {
       
    96     xmlFree(static_cast<void*>(aPtr));
       
    97     }
       
    98 
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CleanupLibXml2::CleanupXmlBufferPtr
       
   102 //
       
   103 // Cleanup stack callback method to delete a Libxml2 buffer-ptr.
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 void CleanupLibXml2::CleanupXmlBufferPtr(TAny *aPtr)
       
   107     {
       
   108     xmlBufferFree(static_cast<xmlBufferPtr>(aPtr));
       
   109     }
       
   110 
       
   111 
       
   112 //#if 0
       
   113 // -----------------------------------------------------------------------------
       
   114 // CleanupLibXml2::CleanupXmlTextWriterPtr
       
   115 //
       
   116 // Cleanup stack callback method to delete a Libxml2 text-writer-ptr.
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 void CleanupLibXml2::CleanupXmlTextWriterPtr(TAny *aPtr)
       
   120     {
       
   121     xmlFreeTextWriter(static_cast<xmlTextWriterPtr>(aPtr));
       
   122     }
       
   123 //#endif