localisation/apparchitecture/apgrfx/APGAIR.CPP
branchSymbian3
changeset 57 b8d18c84f71c
parent 56 aa99f2208aad
child 58 7a02f8565ef5
equal deleted inserted replaced
56:aa99f2208aad 57:b8d18c84f71c
     1 // Copyright (c) 2004-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 the License "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 "APGAIR.H"
       
    17 #include "APGAPLST.H"
       
    18 #include "APGICNFL.H" 
       
    19 #include "APFDEF.H"
       
    20 
       
    21 extern void CleanupServiceArray(TAny* aServiceArray);
       
    22 
       
    23 CApaAppInfoReader::CApaAppInfoReader(RFs& aFs, const TUid aAppUid)
       
    24 	: iFs(aFs),
       
    25 	iAppUid(aAppUid),
       
    26 	iTimeStamp(0),
       
    27 	iDefaultScreenNumber(0),
       
    28 #ifndef SYMBIAN_APPARC_APPINFO_CACHE
       
    29 	iDefaultIconsUsed(EFalse),
       
    30 #endif	//SYMBIAN_APPARC_APPINFO_CACHE
       
    31 	iNonMbmIconFile(EFalse),
       
    32 	iLocalisableResourceFileTimeStamp(0),
       
    33 	iApplicationLanguage(ELangNone),
       
    34 	iIndexOfFirstOpenService(-1)
       
    35 	{
       
    36 	}
       
    37 
       
    38 CApaAppInfoReader::~CApaAppInfoReader()
       
    39 	{
       
    40 	delete iAppBinaryFullName;
       
    41 	delete iCaption;
       
    42 	delete iShortCaption;
       
    43 	delete iIcons;
       
    44 	if (iViewDataArray)
       
    45 		{
       
    46 		iViewDataArray->ResetAndDestroy();
       
    47 		delete iViewDataArray;
       
    48 		}
       
    49 	delete iOwnedFileArray;
       
    50 	delete iIconFileName;
       
    51 	delete iLocalisableResourceFileName;
       
    52 	
       
    53 	if (iServiceArray)
       
    54  		{
       
    55  		CleanupServiceArray(iServiceArray);
       
    56  		iServiceArray = NULL;
       
    57   		}
       
    58 	delete iOpaqueData;
       
    59 	}
       
    60 
       
    61 // The behaviour of the following function is a little non-standard, as it
       
    62 // transfers ownership of the pointer owned by a CApaAppInfoReader derived object
       
    63 // to the caller. This means that this function is only designed to be called once.
       
    64 // Doing things this way provides a small performance optimisation by enabling the caller
       
    65 // to delete it's stored pointer, and replace it with one returned by this function,
       
    66 // instead of having to copy the object (copying could be expensive for the methods
       
    67 // of this class that need to return arrays).
       
    68 HBufC* CApaAppInfoReader::AppBinaryFullName()
       
    69 	{
       
    70 	HBufC* fileName = iAppBinaryFullName;
       
    71 	iAppBinaryFullName = NULL; // ownership transferred to caller
       
    72 	return fileName;
       
    73 	}
       
    74 
       
    75 TUidType CApaAppInfoReader::AppBinaryUidType() const
       
    76 	{
       
    77 	return iAppBinaryUidType;
       
    78 	}
       
    79 
       
    80 TTime CApaAppInfoReader::TimeStamp() const
       
    81 	{
       
    82 	return iTimeStamp;
       
    83 	}
       
    84 
       
    85 TTime CApaAppInfoReader::IconFileTimeStamp() const
       
    86      {
       
    87      return iIconFileTimeStamp;
       
    88      }
       
    89 
       
    90 void CApaAppInfoReader::Capability(TDes8& aCapabilityBuf) const
       
    91 	{
       
    92 	TApaAppCapabilityBuf buf(iCapability);
       
    93 	TApaAppCapability::CopyCapability(aCapabilityBuf, buf);
       
    94 	}
       
    95 
       
    96 TUint CApaAppInfoReader::DefaultScreenNumber() const
       
    97 	{
       
    98 	return iDefaultScreenNumber;
       
    99 	}
       
   100 
       
   101 // The behaviour of the following function is a little non-standard, as it
       
   102 // transfers ownership of the pointer owned by a CApaAppInfoReader derived object
       
   103 // to the caller. This means that this function is only designed to be called once.
       
   104 // Doing things this way provides a small performance optimisation by enabling the caller
       
   105 // to delete it's stored pointer, and replace it with one returned by this function,
       
   106 // instead of having to copy the object (copying could be expensive for the methods
       
   107 // of this class that need to return arrays).
       
   108 HBufC* CApaAppInfoReader::Caption()
       
   109 	{
       
   110 	HBufC* caption = iCaption;
       
   111 	iCaption = NULL; // ownership transferred to caller
       
   112 	return caption;
       
   113 	}
       
   114 
       
   115 // The behaviour of the following function is a little non-standard, as it
       
   116 // transfers ownership of the pointer owned by a CApaAppInfoReader derived object
       
   117 // to the caller. This means that this function is only designed to be called once.
       
   118 // Doing things this way provides a small performance optimisation by enabling the caller
       
   119 // to delete it's stored pointer, and replace it with one returned by this function,
       
   120 // instead of having to copy the object (copying could be expensive for the methods
       
   121 // of this class that need to return arrays).
       
   122 HBufC* CApaAppInfoReader::ShortCaption()
       
   123 	{
       
   124 	HBufC* shortCaption = iShortCaption;
       
   125 	iShortCaption = NULL; // ownership transferred to caller
       
   126 	return shortCaption;
       
   127 	}
       
   128 
       
   129 // The behaviour of the following function is a little non-standard, as it
       
   130 // transfers ownership of the pointer owned by a CApaAppInfoReader derived object
       
   131 // to the caller. This means that this function is only designed to be called once.
       
   132 // Doing things this way provides a small performance optimisation by enabling the caller
       
   133 // to delete it's stored pointer, and replace it with one returned by this function,
       
   134 // instead of having to copy the object (copying could be expensive for the methods
       
   135 // of this class that need to return arrays).
       
   136 CApaAppIconArray* CApaAppInfoReader::Icons()
       
   137 	{
       
   138 	CApaAppIconArray* icons = iIcons;
       
   139 	iIcons = NULL; // ownership transferred to caller
       
   140 	return icons;
       
   141 	}
       
   142 
       
   143 #ifndef SYMBIAN_APPARC_APPINFO_CACHE
       
   144 TBool CApaAppInfoReader::DefaultIconsUsed() const
       
   145 	{
       
   146 	return iDefaultIconsUsed;
       
   147 	}
       
   148 #else
       
   149 TInt CApaAppInfoReader::NumOfAppIcons() const
       
   150 	{
       
   151 	return iNumOfAppIcons;
       
   152 	}
       
   153 #endif // SYMBIAN_APPARC_APPINFO_CACHE
       
   154 
       
   155 // The behaviour of the following function is a little non-standard, as it
       
   156 // transfers ownership of the pointer owned by a CApaAppInfoReader derived object
       
   157 // to the caller. This means that this function is only designed to be called once.
       
   158 // Doing things this way provides a small performance optimisation by enabling the caller
       
   159 // to delete it's stored pointer, and replace it with one returned by this function,
       
   160 // instead of having to copy the object (copying could be expensive for the methods
       
   161 // of this class that need to return arrays).
       
   162 CArrayPtrFlat<CApaAppViewData>* CApaAppInfoReader::Views()
       
   163 	{
       
   164 	CArrayPtrFlat<CApaAppViewData>* viewDataArray = iViewDataArray;
       
   165 	iViewDataArray = NULL; // ownership transferred to caller
       
   166 	return viewDataArray;
       
   167 	}
       
   168 	
       
   169 // The behaviour of the following function is a little non-standard, as it
       
   170 // transfers ownership of the pointer owned by a CApaAppInfoReader derived object
       
   171 // to the caller. This means that this function is only designed to be called once.
       
   172 // Doing things this way provides a small performance optimisation by enabling the caller
       
   173 // to delete it's stored pointer, and replace it with one returned by this function,
       
   174 // instead of having to copy the object (copying could be expensive for the methods
       
   175 // of this class that need to return arrays).
       
   176 CDesCArray* CApaAppInfoReader::OwnedFiles()
       
   177 	{
       
   178 	CDesCArray* ownedFileArray = iOwnedFileArray;
       
   179 	iOwnedFileArray = NULL; // ownership transferred to caller
       
   180 	return ownedFileArray;
       
   181 	}
       
   182 
       
   183 // The behaviour of the following function is a little non-standard, as it
       
   184 // transfers ownership of the pointer owned by a CApaAppInfoReader derived object
       
   185 // to the caller. This means that this function is only designed to be called once.
       
   186 // Doing things this way provides a small performance optimisation by enabling the caller
       
   187 // to delete it's stored pointer, and replace it with one returned by this function,
       
   188 // instead of having to copy the object (copying could be expensive for the methods
       
   189 // of this class that need to return arrays).
       
   190 HBufC* CApaAppInfoReader::IconFileName()
       
   191 	{
       
   192 	HBufC* iconFileName = iIconFileName;
       
   193 	iIconFileName = NULL; // ownership transferred to caller
       
   194 	return iconFileName;
       
   195 	}
       
   196 
       
   197 TBool CApaAppInfoReader::NonMbmIconFile() const
       
   198 	{
       
   199 	return iNonMbmIconFile;
       
   200 	}
       
   201 
       
   202 // The behaviour of the following function is a little non-standard, as it
       
   203 // transfers ownership of the pointer owned by a CApaAppInfoReader derived object
       
   204 // to the caller. This means that this function is only designed to be called once.
       
   205 // Doing things this way provides a small performance optimisation by enabling the caller
       
   206 // to delete it's stored pointer, and replace it with one returned by this function,
       
   207 // instead of having to copy the object (copying could be expensive for the methods
       
   208 // of this class that need to return arrays).
       
   209 HBufC* CApaAppInfoReader::LocalisableResourceFileName()
       
   210 	{
       
   211 	HBufC* localisableResourceFileName = iLocalisableResourceFileName;
       
   212 	iLocalisableResourceFileName = NULL; // ownership transferred to caller
       
   213 	return localisableResourceFileName;
       
   214 	}
       
   215 
       
   216 TTime CApaAppInfoReader::LocalisableResourceFileTimeStamp() const
       
   217 	{
       
   218 	return iLocalisableResourceFileTimeStamp;
       
   219 	}
       
   220 	
       
   221 TLanguage CApaAppInfoReader::AppLanguage() const
       
   222 	{
       
   223 	return iApplicationLanguage;
       
   224 	}
       
   225 
       
   226 // The behaviour of the following function is a little non-standard, as it
       
   227 // transfers ownership of the pointer owned by a CApaAppInfoReader derived object
       
   228 // to the caller. This means that this function is only designed to be called once.
       
   229 // Doing things this way provides a small performance optimisation by enabling the caller
       
   230 // to delete it's stored pointer, and replace it with one returned by this function,
       
   231 // instead of having to copy the object (copying could be expensive for the methods
       
   232 // of this class that need to return arrays).
       
   233 CArrayFixFlat<TApaAppServiceInfo>* CApaAppInfoReader::ServiceArray(TInt& aIndexOfFirstOpenService)
       
   234 	{
       
   235 	CArrayFixFlat<TApaAppServiceInfo>* serviceArray = iServiceArray;
       
   236 	iServiceArray = NULL;
       
   237 	aIndexOfFirstOpenService = iIndexOfFirstOpenService;
       
   238 	return serviceArray;
       
   239 	}
       
   240 
       
   241 
       
   242 // The behaviour of the following function is a little non-standard, as it
       
   243 // transfers ownership of the pointer owned by a CApaAppInfoReader derived object
       
   244 // to the caller. This means that this function is only designed to be called once.
       
   245 // Doing things this way provides a small performance optimisation by enabling the caller
       
   246 // to delete it's stored pointer, and replace it with one returned by this function,
       
   247 // instead of having to copy the object (copying could be expensive for the methods
       
   248 // of this class that need to return arrays).
       
   249 HBufC8* CApaAppInfoReader::OpaqueData()
       
   250 	{
       
   251 	HBufC8* opaqueData = iOpaqueData;
       
   252 	iOpaqueData = NULL;
       
   253 	return opaqueData;
       
   254 	}