imagingandcamerafws/imagingunittest/testcodec/src/TestProxy.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <ecom/ecom.h>
       
    17 #include <ecom/implementationproxy.h>
       
    18 #include "TestCodec.h"
       
    19 #include "BadVerTestCodec.h"
       
    20 #include "TestUids.hrh"
       
    21 #include "TestAsyncCodec.h"
       
    22 #include "TestExifDerived.h"
       
    23 
       
    24 #include <icl/imageconstruct.h>
       
    25 
       
    26 //
       
    27 //
       
    28 //
       
    29 class CTestDecodeConstruct : public CImageDecodeConstruct
       
    30 	{
       
    31 public:
       
    32 	static CTestDecodeConstruct* NewL();
       
    33 	static CTestDecodeConstruct* FailNewL();
       
    34 	virtual CImageDecoderPlugin* NewPluginL() const;	// from CImageDecodeConstruct
       
    35 	virtual TBool RequestThread() const;
       
    36 
       
    37 private:
       
    38 	CTestDecodeConstruct(TBool aLeaveCorrupt = EFalse);
       
    39 
       
    40 private:
       
    41 	TBool iLeaveCorrupt;
       
    42 	};
       
    43 
       
    44 
       
    45 CTestDecodeConstruct* CTestDecodeConstruct::NewL()
       
    46 	{
       
    47 	return new (ELeave) CTestDecodeConstruct();
       
    48 	}
       
    49 
       
    50 CTestDecodeConstruct* CTestDecodeConstruct::FailNewL()
       
    51 	{
       
    52 	return new (ELeave) CTestDecodeConstruct(ETrue);
       
    53 	}
       
    54 
       
    55 CTestDecodeConstruct::CTestDecodeConstruct(TBool aLeaveCorrupt)
       
    56  :	iLeaveCorrupt(aLeaveCorrupt)
       
    57 	{
       
    58 	}
       
    59 
       
    60 CImageDecoderPlugin* CTestDecodeConstruct::NewPluginL() const
       
    61 	{
       
    62 	return CTestDecoder::NewL(iLeaveCorrupt);
       
    63 	}
       
    64 
       
    65 TBool CTestDecodeConstruct::RequestThread() const
       
    66 	{
       
    67 	return ETrue;
       
    68 	}
       
    69 
       
    70 
       
    71 //
       
    72 //
       
    73 //
       
    74 class CTestEncodeConstruct : public CImageEncodeConstruct
       
    75 	{
       
    76 public:
       
    77 	static CTestEncodeConstruct* NewL();
       
    78 	virtual CImageEncoderPlugin* NewPluginL() const;	// from CImageEncodeConstruct
       
    79 	virtual TBool RequestThread() const;
       
    80 	};
       
    81 
       
    82 CTestEncodeConstruct* CTestEncodeConstruct::NewL()
       
    83 	{
       
    84 	return new (ELeave) CTestEncodeConstruct();
       
    85 	}
       
    86 
       
    87 CImageEncoderPlugin* CTestEncodeConstruct::NewPluginL() const
       
    88 	{
       
    89 	return CTestEncoder::NewL();
       
    90 	}
       
    91 
       
    92 TBool CTestEncodeConstruct::RequestThread() const
       
    93 	{
       
    94 	return ETrue;
       
    95 	}
       
    96 
       
    97 
       
    98 class CTestExtendedDecodeConstruct : public CImageDecodeConstruct
       
    99 	{
       
   100 public:
       
   101 	static CTestExtendedDecodeConstruct* NewL();
       
   102 	virtual CImageDecoderPlugin* NewPluginL() const;	// from CImageDecodeConstruct
       
   103 
       
   104 private:
       
   105 	CTestExtendedDecodeConstruct();
       
   106 	};
       
   107 
       
   108 CTestExtendedDecodeConstruct* CTestExtendedDecodeConstruct::NewL()
       
   109 	{
       
   110 	return new (ELeave) CTestExtendedDecodeConstruct();
       
   111 	}
       
   112 
       
   113 CImageDecoderPlugin* CTestExtendedDecodeConstruct::NewPluginL() const
       
   114 	{
       
   115 	return CTestExtendedDecoder::NewL();
       
   116 	}
       
   117 
       
   118 CTestExtendedDecodeConstruct::CTestExtendedDecodeConstruct()
       
   119 	{
       
   120 	}
       
   121 
       
   122 
       
   123 class CTestExtendedEncodeConstruct : public CImageEncodeConstruct
       
   124 	{
       
   125 public:
       
   126 	static CTestExtendedEncodeConstruct * NewL();
       
   127 	virtual CImageEncoderPlugin* NewPluginL() const;	// from CImageEncodeConstruct
       
   128 
       
   129 private:
       
   130 	CTestExtendedEncodeConstruct();
       
   131 	};
       
   132 
       
   133 CTestExtendedEncodeConstruct * CTestExtendedEncodeConstruct::NewL()
       
   134 	{
       
   135 	return new (ELeave) CTestExtendedEncodeConstruct();
       
   136 	}
       
   137 
       
   138 CImageEncoderPlugin* CTestExtendedEncodeConstruct::NewPluginL() const
       
   139 	{
       
   140 	return CTestExtendedEncoder::NewL();
       
   141 	}
       
   142 
       
   143 CTestExtendedEncodeConstruct::CTestExtendedEncodeConstruct()
       
   144 	{
       
   145 	}
       
   146 	
       
   147 //
       
   148 //
       
   149 //
       
   150 class CBadVerTestDecodeConstruct : public CImageDecodeConstruct
       
   151 	{
       
   152 public:
       
   153 	static CBadVerTestDecodeConstruct* NewL();
       
   154 	virtual CImageDecoderPlugin* NewPluginL() const;	// from CImageDecodeConstruct
       
   155 	};
       
   156 
       
   157 CBadVerTestDecodeConstruct* CBadVerTestDecodeConstruct::NewL()
       
   158 	{
       
   159 	return new (ELeave) CBadVerTestDecodeConstruct();
       
   160 	}
       
   161 
       
   162 CImageDecoderPlugin* CBadVerTestDecodeConstruct::NewPluginL() const
       
   163 	{
       
   164 	return CBadVerTestDecoder::NewL();
       
   165 	}
       
   166 
       
   167 
       
   168 //
       
   169 //
       
   170 //
       
   171 class CBadVerTestEncodeConstruct : public CImageEncodeConstruct
       
   172 	{
       
   173 public:
       
   174 	static CBadVerTestEncodeConstruct* NewL();
       
   175 	virtual CImageEncoderPlugin* NewPluginL() const;	// from CImageEncodeConstruct
       
   176 	};
       
   177 
       
   178 CBadVerTestEncodeConstruct* CBadVerTestEncodeConstruct::NewL()
       
   179 	{
       
   180 	return new (ELeave) CBadVerTestEncodeConstruct;
       
   181 	}
       
   182 
       
   183 CImageEncoderPlugin* CBadVerTestEncodeConstruct::NewPluginL() const
       
   184 	{
       
   185 	return CBadVerTestEncoder::NewL();
       
   186 	}
       
   187 
       
   188 
       
   189 //
       
   190 //
       
   191 //
       
   192 class CTestAsyncDecodeConstruct : public CImageDecodeConstruct
       
   193 	{
       
   194 public:
       
   195 	static CTestAsyncDecodeConstruct* NewL();
       
   196 	virtual CImageDecoderPlugin* NewPluginL() const; // from CImageDecodeConstruct
       
   197 	};
       
   198 
       
   199 
       
   200 CTestAsyncDecodeConstruct* CTestAsyncDecodeConstruct::NewL()
       
   201 	{
       
   202 	return new (ELeave) CTestAsyncDecodeConstruct();
       
   203 	}
       
   204 
       
   205 CImageDecoderPlugin* CTestAsyncDecodeConstruct::NewPluginL() const
       
   206 	{
       
   207 	return CTestAsyncDecoder::NewL();
       
   208 	}
       
   209 
       
   210 
       
   211 //
       
   212 //
       
   213 //
       
   214 class CTestAsyncEncodeConstruct : public CImageEncodeConstruct
       
   215 	{
       
   216 public:
       
   217 	static CTestAsyncEncodeConstruct* NewL();
       
   218 	virtual CImageEncoderPlugin* NewPluginL() const; // from CImageEncodeConstruct
       
   219 	};
       
   220 
       
   221 
       
   222 CTestAsyncEncodeConstruct* CTestAsyncEncodeConstruct::NewL()
       
   223 	{
       
   224 	return new (ELeave) CTestAsyncEncodeConstruct();
       
   225 	}
       
   226 
       
   227 CImageEncoderPlugin* CTestAsyncEncodeConstruct::NewPluginL() const
       
   228 	{
       
   229 	return CTestAsyncEncoder::NewL();
       
   230 	}
       
   231 
       
   232 
       
   233 //
       
   234 // for testing the INC059847
       
   235 //
       
   236 class CTestExifDerivedEncodeConstruct : public CImageEncodeConstruct
       
   237 	{
       
   238 public:
       
   239 	static CTestExifDerivedEncodeConstruct* NewL();
       
   240 	virtual CImageEncoder* NewEncoderL() const;		// from CImageEncodeConstruct
       
   241 	virtual CImageEncoderPlugin* NewPluginL() const;
       
   242 	};
       
   243 
       
   244 CTestExifDerivedEncodeConstruct* CTestExifDerivedEncodeConstruct::NewL()
       
   245 	{
       
   246 	return new (ELeave) CTestExifDerivedEncodeConstruct();
       
   247 	}
       
   248 
       
   249 CImageEncoderPlugin* CTestExifDerivedEncodeConstruct::NewPluginL() const
       
   250 	{
       
   251 	return CDummyExifEncoder::NewL();
       
   252 	}
       
   253 	
       
   254 CImageEncoder* CTestExifDerivedEncodeConstruct::NewEncoderL() const
       
   255 	{
       
   256 	return CTestExifDerivedEncoder::NewL();
       
   257 	}	
       
   258 
       
   259 
       
   260 //
       
   261 //
       
   262 //	
       
   263 class CTestExifDerivedDecodeConstruct : public CImageDecodeConstruct
       
   264 	{
       
   265 public:
       
   266 	static CTestExifDerivedDecodeConstruct* NewL();
       
   267 	virtual CImageDecoderPlugin* NewPluginL() const;	// from CImageDecodeConstruct
       
   268 	virtual CImageDecoder* NewDecoderL() const;
       
   269 	};
       
   270 
       
   271 CTestExifDerivedDecodeConstruct* CTestExifDerivedDecodeConstruct::NewL()
       
   272 	{
       
   273 	return new (ELeave) CTestExifDerivedDecodeConstruct();
       
   274 	}
       
   275 
       
   276 CImageDecoderPlugin* CTestExifDerivedDecodeConstruct::NewPluginL() const
       
   277 	{
       
   278 	return CDummyExifDecoder::NewL();
       
   279 	}	
       
   280 	
       
   281 CImageDecoder* CTestExifDerivedDecodeConstruct::NewDecoderL() const
       
   282 	{
       
   283 	return CTestExifDerivedDecoder::NewL();
       
   284 	}
       
   285 
       
   286 
       
   287 // Exported proxy for instantiation method resolution
       
   288 
       
   289 // Define the Implementation UIDs for TST decoder
       
   290 const TImplementationProxy ImplementationTable[] =
       
   291 	{
       
   292 	IMPLEMENTATION_PROXY_ENTRY(KTestDecoderImplementationUidValue, CTestDecodeConstruct::NewL),
       
   293 	IMPLEMENTATION_PROXY_ENTRY(KFailTestDecoderImplementationUidValue, CTestDecodeConstruct::FailNewL),
       
   294 	IMPLEMENTATION_PROXY_ENTRY(KTestEncoderImplementationUidValue, CTestEncodeConstruct::NewL),
       
   295 	IMPLEMENTATION_PROXY_ENTRY(KBadVerTestDecoderImplementationUidValue, CBadVerTestDecodeConstruct::NewL),
       
   296 	IMPLEMENTATION_PROXY_ENTRY(KBadVerTestEncoderImplementationUidValue, CBadVerTestEncodeConstruct::NewL),
       
   297 	IMPLEMENTATION_PROXY_ENTRY(KTestAsyncDecoderImplementationUidValue, CTestAsyncDecodeConstruct::NewL),
       
   298 	IMPLEMENTATION_PROXY_ENTRY(KTestAsyncEncoderImplementationUidValue, CTestAsyncEncodeConstruct::NewL),
       
   299 	IMPLEMENTATION_PROXY_ENTRY(KTestExifDummyEncoderImplementationUidValue, CTestExifDerivedEncodeConstruct::NewL),
       
   300 	IMPLEMENTATION_PROXY_ENTRY(KTestExifDummyDecoderImplementationUidValue, CTestExifDerivedDecodeConstruct::NewL),
       
   301 	IMPLEMENTATION_PROXY_ENTRY(KTestDummyDecoderExtCropUidValue, CTestExtendedDecodeConstruct::NewL),
       
   302 	IMPLEMENTATION_PROXY_ENTRY(KTestDummyDecoderExtStreamUidValue, CTestExtendedDecodeConstruct::NewL),
       
   303 	IMPLEMENTATION_PROXY_ENTRY(KTestDummyDecoderExtRotationUidValue, CTestExtendedDecodeConstruct::NewL),
       
   304 	IMPLEMENTATION_PROXY_ENTRY(KTestDummyDecoderExtScalingUidValue, CTestExtendedDecodeConstruct::NewL),
       
   305 	IMPLEMENTATION_PROXY_ENTRY(KTestDummyEncoderExtStreamUidValue, CTestExtendedEncodeConstruct::NewL),
       
   306 	IMPLEMENTATION_PROXY_ENTRY(KTestDummyEncoderExtRotationUidValue, CTestExtendedEncodeConstruct::NewL),
       
   307 	IMPLEMENTATION_PROXY_ENTRY(KTestDummyEncoderExtUseWithSetThumbnailUidValue, CTestExtendedEncodeConstruct::NewL),
       
   308 	IMPLEMENTATION_PROXY_ENTRY(KTestDummyEncoderExtMirrorHorizontalVerticalAxisUidValue, CTestExtendedEncodeConstruct::NewL),
       
   309 	IMPLEMENTATION_PROXY_ENTRY(KTestDummyDecoderExtMirrorHorizontalVerticalAxisUidValue, CTestExtendedDecodeConstruct::NewL)
       
   310 	};
       
   311 
       
   312 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   313 	{
       
   314 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   315 	return ImplementationTable;
       
   316 	}