author | William Roberts <williamr@symbian.org> |
Tue, 16 Mar 2010 16:12:26 +0000 | |
branch | Symbian2 |
changeset 2 | 2fe1408b6811 |
parent 0 | 061f57f2323e |
permissions | -rw-r--r-- |
williamr@2 | 1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
williamr@2 | 2 |
// All rights reserved. |
williamr@2 | 3 |
// This component and the accompanying materials are made available |
williamr@2 | 4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
williamr@2 | 5 |
// which accompanies this distribution, and is available |
williamr@2 | 6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
williamr@2 | 7 |
// |
williamr@2 | 8 |
// Initial Contributors: |
williamr@2 | 9 |
// Nokia Corporation - initial contribution. |
williamr@2 | 10 |
// |
williamr@2 | 11 |
// Contributors: |
williamr@2 | 12 |
// |
williamr@2 | 13 |
// Description: |
williamr@2 | 14 |
// |
williamr@2 | 15 |
|
williamr@2 | 16 |
#if !defined(__CONCNF_H__) |
williamr@2 | 17 |
#define __CONCNF_H__ |
williamr@2 | 18 |
|
williamr@2 | 19 |
#include <e32base.h> |
williamr@2 | 20 |
#include <f32file.h> |
williamr@2 | 21 |
#include <s32stor.h> |
williamr@2 | 22 |
#include <apmstd.h> |
williamr@2 | 23 |
#include <barsc.h> |
williamr@2 | 24 |
#include <barsread.h> |
williamr@2 | 25 |
|
williamr@2 | 26 |
/** |
williamr@2 | 27 |
@publishedAll |
williamr@2 | 28 |
@released |
williamr@2 | 29 |
*/ |
williamr@2 | 30 |
#define KMaxTranslation 50 |
williamr@2 | 31 |
|
williamr@2 | 32 |
/** Buffer to contain a localised data type name. |
williamr@2 | 33 |
|
williamr@2 | 34 |
@publishedAll |
williamr@2 | 35 |
@released */ |
williamr@2 | 36 |
typedef TBuf<KMaxTranslation> TTranslation; |
williamr@2 | 37 |
|
williamr@2 | 38 |
|
williamr@2 | 39 |
class TLanguageInfo |
williamr@2 | 40 |
/** Holds a localised name for a data type. |
williamr@2 | 41 |
|
williamr@2 | 42 |
@publishedAll |
williamr@2 | 43 |
@released */ |
williamr@2 | 44 |
{ |
williamr@2 | 45 |
public: |
williamr@2 | 46 |
TLanguageInfo(); |
williamr@2 | 47 |
IMPORT_C TLanguageInfo(TLanguage aLanguage,TTranslation aTranslation); |
williamr@2 | 48 |
public: |
williamr@2 | 49 |
void InternalizeL(RReadStream& aStream); |
williamr@2 | 50 |
void ExternalizeL(RWriteStream& aStream) const; |
williamr@2 | 51 |
TLanguage Language(); |
williamr@2 | 52 |
TTranslation Translation(); |
williamr@2 | 53 |
void ReadFromResource(TResourceReader& aReader); |
williamr@2 | 54 |
public: |
williamr@2 | 55 |
TLanguage iLanguage; |
williamr@2 | 56 |
TTranslation iTranslation; |
williamr@2 | 57 |
}; |
williamr@2 | 58 |
|
williamr@2 | 59 |
class CMimeInfo : public CBase |
williamr@2 | 60 |
/** Holds the localised names for a data type. |
williamr@2 | 61 |
|
williamr@2 | 62 |
@publishedAll |
williamr@2 | 63 |
@released */ |
williamr@2 | 64 |
{ |
williamr@2 | 65 |
public: |
williamr@2 | 66 |
IMPORT_C ~CMimeInfo(); |
williamr@2 | 67 |
IMPORT_C static CMimeInfo* NewLC(TDataType& aMime); |
williamr@2 | 68 |
static CMimeInfo* NewL(); |
williamr@2 | 69 |
static CMimeInfo* NewLC(const CMimeInfo* aInfo); |
williamr@2 | 70 |
public: |
williamr@2 | 71 |
void InternalizeL(RReadStream& aStream); |
williamr@2 | 72 |
void ExternalizeL(RWriteStream& aStream) const; |
williamr@2 | 73 |
TDataType Mime(); |
williamr@2 | 74 |
TTranslation Text(); |
williamr@2 | 75 |
IMPORT_C void AddLanguageL(TLanguageInfo aLang); |
williamr@2 | 76 |
static CMimeInfo* NewLC(TResourceReader& aReader); |
williamr@2 | 77 |
private: |
williamr@2 | 78 |
void ConstructL(); |
williamr@2 | 79 |
void ConstructL(TResourceReader& aReader); |
williamr@2 | 80 |
void AddLanguageInfoL(TResourceReader& aReader); |
williamr@2 | 81 |
private: |
williamr@2 | 82 |
TDataType iMime; |
williamr@2 | 83 |
CArrayFixFlat<TLanguageInfo> *iLanguageInfo; |
williamr@2 | 84 |
}; |
williamr@2 | 85 |
|
williamr@2 | 86 |
class CCnaConverter : public CBase |
williamr@2 | 87 |
/** Holds the inherent properties of a converter. |
williamr@2 | 88 |
|
williamr@2 | 89 |
These are its UID and the data types it supports. |
williamr@2 | 90 |
|
williamr@2 | 91 |
Note that the setter functions affect only the current object, not the stored |
williamr@2 | 92 |
information for the converter. |
williamr@2 | 93 |
|
williamr@2 | 94 |
@publishedAll |
williamr@2 | 95 |
@released */ |
williamr@2 | 96 |
{ |
williamr@2 | 97 |
public: |
williamr@2 | 98 |
static CCnaConverter* NewLC(); |
williamr@2 | 99 |
static CCnaConverter* NewL(); |
williamr@2 | 100 |
IMPORT_C static CCnaConverter* NewL(TUid aUid); |
williamr@2 | 101 |
IMPORT_C static CCnaConverter* NewLC(TUid aUid); |
williamr@2 | 102 |
IMPORT_C static CCnaConverter* NewL(const CCnaConverter& aConverter); |
williamr@2 | 103 |
IMPORT_C static CCnaConverter* NewLC(const CCnaConverter& aConverter); |
williamr@2 | 104 |
IMPORT_C ~CCnaConverter(); |
williamr@2 | 105 |
IMPORT_C void SetUid(TUid aUid); |
williamr@2 | 106 |
IMPORT_C TBool MimeFrom(const TDataType& aMimeType) const; |
williamr@2 | 107 |
IMPORT_C TBool MimeTo(const TDataType& aMimeType) const; |
williamr@2 | 108 |
IMPORT_C TTranslation MimeFromText(const TDataType& aMimeType) const; |
williamr@2 | 109 |
IMPORT_C TTranslation MimeToText(const TDataType& aMimeType) const; |
williamr@2 | 110 |
IMPORT_C TInt CountFrom() const; |
williamr@2 | 111 |
IMPORT_C TInt CountTo() const; |
williamr@2 | 112 |
IMPORT_C TDataType MimeFrom(TInt aIndex) const; |
williamr@2 | 113 |
IMPORT_C TDataType MimeTo(TInt aIndex) const; |
williamr@2 | 114 |
IMPORT_C TTranslation MimeFromText(TInt aIndex) const; |
williamr@2 | 115 |
IMPORT_C TTranslation MimeToText(TInt aIndex) const; |
williamr@2 | 116 |
inline TUid Uid() const; |
williamr@2 | 117 |
static CCnaConverter* NewL(TUid aUid,TResourceReader& aReader); |
williamr@2 | 118 |
private: |
williamr@2 | 119 |
CCnaConverter(); |
williamr@2 | 120 |
void ConstructL(); |
williamr@2 | 121 |
TBool FindMime(const TDataType& aMimeType, const CArrayPtrFlat<CMimeInfo>* aList) const; |
williamr@2 | 122 |
TTranslation FindMimeText(const TDataType& aMimeType, const CArrayPtrFlat<CMimeInfo>* aList) const; |
williamr@2 | 123 |
void ConstructL(TUid aUid,TResourceReader& aReader); |
williamr@2 | 124 |
void AddMimeDataL(TResourceReader& aReader, CArrayPtrFlat<CMimeInfo>& aMimeInfo); |
williamr@2 | 125 |
private: |
williamr@2 | 126 |
TUid iUid; |
williamr@2 | 127 |
CArrayPtrFlat<CMimeInfo>* iMimeFrom; |
williamr@2 | 128 |
CArrayPtrFlat<CMimeInfo>* iMimeTo; |
williamr@2 | 129 |
}; |
williamr@2 | 130 |
|
williamr@2 | 131 |
inline TUid CCnaConverter::Uid() const |
williamr@2 | 132 |
/** Gets the converter UID. |
williamr@2 | 133 |
|
williamr@2 | 134 |
@return Converter UID */ |
williamr@2 | 135 |
{return iUid;} |
williamr@2 | 136 |
|
williamr@2 | 137 |
class CCnaConvInfoFile2 : public CBase |
williamr@2 | 138 |
/** |
williamr@2 | 139 |
implementation class |
williamr@2 | 140 |
@internalComponent |
williamr@2 | 141 |
*/ |
williamr@2 | 142 |
{ |
williamr@2 | 143 |
public: |
williamr@2 | 144 |
~CCnaConvInfoFile2(); |
williamr@2 | 145 |
// |
williamr@2 | 146 |
protected: |
williamr@2 | 147 |
void ConstructL(); |
williamr@2 | 148 |
protected: |
williamr@2 | 149 |
RFs iFs; |
williamr@2 | 150 |
RResourceFile iResourceFile; |
williamr@2 | 151 |
CArrayPtr<CCnaConverter>* iConverters; |
williamr@2 | 152 |
}; |
williamr@2 | 153 |
|
williamr@2 | 154 |
/** Encapsulates a collection of converter properties (CCnaConverter) read from a converter |
williamr@2 | 155 |
information (.rsc) file. |
williamr@2 | 156 |
|
williamr@2 | 157 |
@publishedAll |
williamr@2 | 158 |
@released |
williamr@2 | 159 |
*/ |
williamr@2 | 160 |
// Each RSC file contains CCnaConverter information for each |
williamr@2 | 161 |
// available CConverterBase2 derived class in its associated DLL. |
williamr@2 | 162 |
|
williamr@2 | 163 |
// In addition there may be INI files for each converter which supply run time extended |
williamr@2 | 164 |
// CCnaConverter information such as additional mime types. |
williamr@2 | 165 |
class CCnaConvInfoFileReader2 : public CCnaConvInfoFile2 |
williamr@2 | 166 |
{ |
williamr@2 | 167 |
public: |
williamr@2 | 168 |
IMPORT_C static CCnaConvInfoFileReader2* NewLC(const TDesC& aFileName); |
williamr@2 | 169 |
IMPORT_C static CCnaConvInfoFileReader2* NewL(const TDesC& aFileName); |
williamr@2 | 170 |
IMPORT_C TInt Count(); |
williamr@2 | 171 |
IMPORT_C CCnaConverter* AtL(TInt anIndex); |
williamr@2 | 172 |
// |
williamr@2 | 173 |
IMPORT_C void RestoreL(); |
williamr@2 | 174 |
private: |
williamr@2 | 175 |
CCnaConvInfoFileReader2(); |
williamr@2 | 176 |
void RestoreConverterL(TResourceReader& aReader); |
williamr@2 | 177 |
void ConstructL(const TDesC& aFileName); |
williamr@2 | 178 |
}; |
williamr@2 | 179 |
|
williamr@2 | 180 |
#endif |