# examples/Multimedia/ICL/ICLCodec/PNGProxy.cpp

    00001 // PNGProxy.cpp
    00002 //
    00003 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
    00004 // All rights reserved.
    00005 // This component and the accompanying materials are made available
    00006 // under the terms of "Eclipse Public License v1.0"
    00007 // which accompanies this distribution, and is available
    00008 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    00009 //
    00010 // Initial Contributors:
    00011 // Nokia Corporation - initial contribution.
    00012 //
    00013 // Contributors:
    00014 //
    00015 // Description:
    00016 //
    00017 //
    00018
    00019 // Supplies the factory function called by ECom, and factories for
    00020 // the PNG decoder and encoder
    00021
    00022 // Ecom headers
    00023 #include <ecom.h>
    00024 #include <implementationproxy.h>
    00025
    00026 // ICL base class
    00027 #include <icl/imageconstruct.h>
    00028
    00029 #include "uids.h"
    00030 #include "PNGCodec.h"
    00031
    00032
    00033 //
    00034 // Factory for PNG decoder
    00035 //
    00036 class CPngDecodeConstruct : public CImageDecodeConstruct
    00037         {
    00038 public:
    00039         // Constructs the factory
    00040         static CPngDecodeConstruct* NewL();
    00041
    00042         // Supplies a new decoder
    00043         // from CImageDecodeConstruct
    00044         CImageDecoderPlugin* NewPluginL() const;
    00045         };
    00046
    00047 CPngDecodeConstruct* CPngDecodeConstruct::NewL()
    00048         {
    00049         CPngDecodeConstruct* self = new (ELeave) CPngDecodeConstruct;
    00050         return self;
    00051         }
    00052
    00053 CImageDecoderPlugin* CPngDecodeConstruct::NewPluginL() const
    00054         {
    00055         return CPngDecoder::NewL();
    00056         }
    00057
    00058
    00059 //
    00060 // Factory for PNG encoder
    00061 //
    00062 class CPngEncodeConstruct : public CImageEncodeConstruct
    00063         {
    00064 public:
    00065         // Constructs the factory
    00066         static CPngEncodeConstruct* NewL();
    00067
    00068         // Supplies a new encoder
    00069         // from CImageEncodeConstruct
    00070         CImageEncoderPlugin* NewPluginL() const;
    00071         };
    00072
    00073 CPngEncodeConstruct* CPngEncodeConstruct::NewL()
    00074         {
    00075         CPngEncodeConstruct* self = new (ELeave) CPngEncodeConstruct;
    00076         return self;
    00077         }
    00078
    00079 CImageEncoderPlugin* CPngEncodeConstruct::NewPluginL() const
    00080         {
    00081         return CPngEncoder::NewL();
    00082         }
    00083
    00084
    00085
    00086 //
    00087 // Exported proxy for ECom instantiation method resolution
    00088 //
    00089
    00090 // Define the factories for the PNG converters
    00091 const TImplementationProxy ImplementationTable[] =
    00092         {
    00093                 IMPLEMENTATION_PROXY_ENTRY(KExPNGDecoderImplementationUidValue, CPngDecodeConstruct::NewL),
    00094                 IMPLEMENTATION_PROXY_ENTRY(KExPNGEncoderImplementationUidValue, CPngEncodeConstruct::NewL)
    00095         };
    00096
    00097 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
    00098         {
    00099         aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
    00100         return ImplementationTable;
    00101         }
    00102
    00103 //
    00104 // Global panic function
    00105 //
    00106 GLDEF_C void Panic(TInt aError)
    00107         {
    00108         _LIT(KPNGPanicCategory, "PNGExConvertPlugin");
    00109         User::Panic(KPNGPanicCategory, aError);
    00110         }
    00111