contentmgmt/contentaccessfwfordrm/source/caf/data.cpp
changeset 8 35751d3474b7
parent 0 2c201484c85f
child 15 da2ae96f639b
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <apmstd.h>
    19 #include <apmstd.h>
    20 
    20 
    21 #include "data.h"
    21 #include <caf/data.h>
    22 #include "agentinterface.h"
    22 #include <caf/agentinterface.h>
    23 #include "agentinfo.h"
    23 #include "agentinfo.h"
    24 #include "agentfactory.h"
    24 #include <caf/agentfactory.h>
    25 #include "attributeset.h"
    25 #include <caf/attributeset.h>
    26 #include "virtualpath.h"
    26 #include <caf/virtualpath.h>
    27 #include "resolver.h"
    27 #include "resolver.h"
    28 #include "agentinfo.h"
    28 #include "agentinfo.h"
       
    29 #include <e32def.h>
    29 
    30 
    30 using namespace ContentAccess;
    31 using namespace ContentAccess;
    31 
    32 
    32 EXPORT_C CData* CData::NewL(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode)
    33 EXPORT_C CData* CData::NewL(const TVirtualPathPtr& aVirtualPath, TIntent aIntent, TContentShareMode aShareMode)
    33 	{
    34 	{
   254 	{
   255 	{
   255 	// ask the agent for the data size of the current content object
   256 	// ask the agent for the data size of the current content object
   256 	iAgentData->DataSizeL(aSize);
   257 	iAgentData->DataSizeL(aSize);
   257 	}
   258 	}
   258 
   259 
       
   260 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   261 EXPORT_C void CData::DataSize64L(TInt64& aSize)
       
   262 	{
       
   263 	// ask the agent for the data size of the current content object
       
   264 	TRAPD(err, iAgentData->DataSize64L(aSize));
       
   265 	if(err == KErrCANotSupported)
       
   266 		{
       
   267 		//fallback to 32bit API
       
   268 		TInt size32;
       
   269 		iAgentData->DataSizeL(size32);
       
   270 		aSize = size32;
       
   271 		}
       
   272 	else
       
   273 		User::LeaveIfError(err);
       
   274 	}
       
   275 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   276 
   259 EXPORT_C TInt CData::EvaluateIntent(TIntent aIntent)
   277 EXPORT_C TInt CData::EvaluateIntent(TIntent aIntent)
   260 	{
   278 	{
   261 	// ask the agent to re-evaluate the intent on the current content object
   279 	// ask the agent to re-evaluate the intent on the current content object
   262 	return iAgentData->EvaluateIntent(aIntent);
   280 	return iAgentData->EvaluateIntent(aIntent);
   263 	}
   281 	}
   297 	
   315 	
   298 EXPORT_C void CData::ReadCancel(TRequestStatus &aStatus) const
   316 EXPORT_C void CData::ReadCancel(TRequestStatus &aStatus) const
   299 	{
   317 	{
   300 	iAgentData->ReadCancel(aStatus);
   318 	iAgentData->ReadCancel(aStatus);
   301 	}
   319 	}
   302 EXPORT_C TInt CData::Read(TInt aPos, TDes8& aDes,
   320 
       
   321 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   322 	EXPORT_C TInt CData::Read_Unused(TInt aPos, TDes8& aDes, 
       
   323 								TInt aLength, TRequestStatus& aStatus) const
       
   324 #else
       
   325 	EXPORT_C TInt CData::Read(TInt aPos, TDes8& aDes, 
       
   326 								TInt aLength, TRequestStatus& aStatus) const
       
   327 #endif
       
   328 	{
       
   329 	// ask the agent to read plaintext from the content object 
       
   330 	if(aPos<0)
       
   331 		return KErrArgument;
       
   332 	return iAgentData->Read(aPos, aDes, aLength, aStatus);
       
   333 	}
       
   334 
       
   335 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   336 EXPORT_C TInt CData::Read(TInt64 aPos, TDes8& aDes,
   303 						  TInt aLength, TRequestStatus& aStatus) const
   337 						  TInt aLength, TRequestStatus& aStatus) const
   304 	{
   338 	{
       
   339 	// If agent does not support 64bit Read, a fallback to 32bit Read is provided automatically
   305 	// The above API method signature allows error codes to be returned
   340 	// The above API method signature allows error codes to be returned
   306 	// via two different routes (return code & aStatus). Should the async request 
   341 	// via two different routes (return code & aStatus). Should the async request 
   307 	// dispatch fail then an error code is returned immediately via the 
   342 	// dispatch fail then an error code is returned immediately via the 
   308 	// aStatus parameter rather than via the return code of the function.	
   343 	// aStatus parameter rather than via the return code of the function.	
   309 
   344 
   310 	// NOTE: it is not generally not recommended for functions to be able to return
   345 	// NOTE: it is not generally not recommended for functions to be able to return
   311 	// error codes in two different ways as this places a bigger error-checking
   346 	// error codes in two different ways as this places a bigger error-checking
   312 	// burden on clients.
   347 	// burden on clients.
   313 	
       
   314 	
       
   315 	// ask the agent to read plaintext from the content object 
       
   316 	if(aPos<0)
   348 	if(aPos<0)
   317 		return KErrArgument;
   349 		return KErrArgument;
   318 	return iAgentData->Read(aPos, aDes, aLength, aStatus);
   350 	
   319 	}
   351 	TInt rval = iAgentData->Read64(aPos, aDes, aLength, aStatus);
   320 
   352 	return (rval == KErrCANotSupported? iAgentData->Read((TInt)aPos, aDes, aLength, aStatus) : rval );
       
   353 	}
       
   354 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   321 
   355 
   322 EXPORT_C TInt CData::Seek(TSeek aMode,TInt& aPos) const
   356 EXPORT_C TInt CData::Seek(TSeek aMode,TInt& aPos) const
   323 	{
   357 	{
   324 	// ask the agent to seek witin the plaintext 
   358 	// ask the agent to seek witin the plaintext 
   325 	return iAgentData->Seek(aMode, aPos);
   359 	return iAgentData->Seek(aMode, aPos);
   326 	}
   360 	}
       
   361 
       
   362 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   363 EXPORT_C TInt CData::Seek64(TSeek aMode,TInt64& aPos) const
       
   364 	{
       
   365 	// ask the agent to seek witin the plaintext 
       
   366 	TInt rval64 = iAgentData->Seek64(aMode, aPos);
       
   367 	if(rval64 == KErrCANotSupported)
       
   368 		{
       
   369 		//fallback to 32bit API
       
   370 		TInt pos32 = I64INT(aPos);
       
   371 		TInt rval32 = iAgentData->Seek(aMode, pos32);
       
   372 		aPos = pos32;
       
   373 		return rval32;
       
   374 		}
       
   375 	return rval64;
       
   376 	}
       
   377 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   327 
   378 
   328 EXPORT_C TInt CData::SetProperty(TAgentProperty aProperty, TInt aValue)
   379 EXPORT_C TInt CData::SetProperty(TAgentProperty aProperty, TInt aValue)
   329 	{
   380 	{
   330 	// Set a property within the agent
   381 	// Set a property within the agent
   331 	return iAgentData->SetProperty(aProperty, aValue);
   382 	return iAgentData->SetProperty(aProperty, aValue);