1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/concnf.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,180 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#if !defined(__CONCNF_H__)
1.20 +#define __CONCNF_H__
1.21 +
1.22 +#include <e32base.h>
1.23 +#include <f32file.h>
1.24 +#include <s32stor.h>
1.25 +#include <apmstd.h>
1.26 +#include <barsc.h>
1.27 +#include <barsread.h>
1.28 +
1.29 +/**
1.30 +@publishedAll
1.31 +@released
1.32 +*/
1.33 +#define KMaxTranslation 50
1.34 +
1.35 +/** Buffer to contain a localised data type name.
1.36 +
1.37 +@publishedAll
1.38 +@released */
1.39 +typedef TBuf<KMaxTranslation> TTranslation;
1.40 +
1.41 +
1.42 +class TLanguageInfo
1.43 +/** Holds a localised name for a data type.
1.44 +
1.45 +@publishedAll
1.46 +@released */
1.47 + {
1.48 +public:
1.49 + TLanguageInfo();
1.50 + IMPORT_C TLanguageInfo(TLanguage aLanguage,TTranslation aTranslation);
1.51 +public:
1.52 + void InternalizeL(RReadStream& aStream);
1.53 + void ExternalizeL(RWriteStream& aStream) const;
1.54 + TLanguage Language();
1.55 + TTranslation Translation();
1.56 + void ReadFromResource(TResourceReader& aReader);
1.57 +public:
1.58 + TLanguage iLanguage;
1.59 + TTranslation iTranslation;
1.60 + };
1.61 +
1.62 +class CMimeInfo : public CBase
1.63 +/** Holds the localised names for a data type.
1.64 +
1.65 +@publishedAll
1.66 +@released */
1.67 + {
1.68 +public:
1.69 + IMPORT_C ~CMimeInfo();
1.70 + IMPORT_C static CMimeInfo* NewLC(TDataType& aMime);
1.71 + static CMimeInfo* NewL();
1.72 + static CMimeInfo* NewLC(const CMimeInfo* aInfo);
1.73 +public:
1.74 + void InternalizeL(RReadStream& aStream);
1.75 + void ExternalizeL(RWriteStream& aStream) const;
1.76 + TDataType Mime();
1.77 + TTranslation Text();
1.78 + IMPORT_C void AddLanguageL(TLanguageInfo aLang);
1.79 + static CMimeInfo* NewLC(TResourceReader& aReader);
1.80 +private:
1.81 + void ConstructL();
1.82 + void ConstructL(TResourceReader& aReader);
1.83 + void AddLanguageInfoL(TResourceReader& aReader);
1.84 +private:
1.85 + TDataType iMime;
1.86 + CArrayFixFlat<TLanguageInfo> *iLanguageInfo;
1.87 + };
1.88 +
1.89 +class CCnaConverter : public CBase
1.90 +/** Holds the inherent properties of a converter.
1.91 +
1.92 +These are its UID and the data types it supports.
1.93 +
1.94 +Note that the setter functions affect only the current object, not the stored
1.95 +information for the converter.
1.96 +
1.97 +@publishedAll
1.98 +@released */
1.99 + {
1.100 +public:
1.101 + static CCnaConverter* NewLC();
1.102 + static CCnaConverter* NewL();
1.103 + IMPORT_C static CCnaConverter* NewL(TUid aUid);
1.104 + IMPORT_C static CCnaConverter* NewLC(TUid aUid);
1.105 + IMPORT_C static CCnaConverter* NewL(const CCnaConverter& aConverter);
1.106 + IMPORT_C static CCnaConverter* NewLC(const CCnaConverter& aConverter);
1.107 + IMPORT_C ~CCnaConverter();
1.108 + IMPORT_C void SetUid(TUid aUid);
1.109 + IMPORT_C TBool MimeFrom(const TDataType& aMimeType) const;
1.110 + IMPORT_C TBool MimeTo(const TDataType& aMimeType) const;
1.111 + IMPORT_C TTranslation MimeFromText(const TDataType& aMimeType) const;
1.112 + IMPORT_C TTranslation MimeToText(const TDataType& aMimeType) const;
1.113 + IMPORT_C TInt CountFrom() const;
1.114 + IMPORT_C TInt CountTo() const;
1.115 + IMPORT_C TDataType MimeFrom(TInt aIndex) const;
1.116 + IMPORT_C TDataType MimeTo(TInt aIndex) const;
1.117 + IMPORT_C TTranslation MimeFromText(TInt aIndex) const;
1.118 + IMPORT_C TTranslation MimeToText(TInt aIndex) const;
1.119 + inline TUid Uid() const;
1.120 + static CCnaConverter* NewL(TUid aUid,TResourceReader& aReader);
1.121 +private:
1.122 + CCnaConverter();
1.123 + void ConstructL();
1.124 + TBool FindMime(const TDataType& aMimeType, const CArrayPtrFlat<CMimeInfo>* aList) const;
1.125 + TTranslation FindMimeText(const TDataType& aMimeType, const CArrayPtrFlat<CMimeInfo>* aList) const;
1.126 + void ConstructL(TUid aUid,TResourceReader& aReader);
1.127 + void AddMimeDataL(TResourceReader& aReader, CArrayPtrFlat<CMimeInfo>& aMimeInfo);
1.128 +private:
1.129 + TUid iUid;
1.130 + CArrayPtrFlat<CMimeInfo>* iMimeFrom;
1.131 + CArrayPtrFlat<CMimeInfo>* iMimeTo;
1.132 + };
1.133 +
1.134 +inline TUid CCnaConverter::Uid() const
1.135 +/** Gets the converter UID.
1.136 +
1.137 +@return Converter UID */
1.138 + {return iUid;}
1.139 +
1.140 +class CCnaConvInfoFile2 : public CBase
1.141 +/**
1.142 +implementation class
1.143 +@internalComponent
1.144 +*/
1.145 + {
1.146 +public:
1.147 + ~CCnaConvInfoFile2();
1.148 + //
1.149 +protected:
1.150 + void ConstructL();
1.151 +protected:
1.152 + RFs iFs;
1.153 + RResourceFile iResourceFile;
1.154 + CArrayPtr<CCnaConverter>* iConverters;
1.155 + };
1.156 +
1.157 +/** Encapsulates a collection of converter properties (CCnaConverter) read from a converter
1.158 +information (.rsc) file.
1.159 +
1.160 +@publishedAll
1.161 +@released
1.162 +*/
1.163 +// Each RSC file contains CCnaConverter information for each
1.164 +// available CConverterBase2 derived class in its associated DLL.
1.165 +
1.166 +// In addition there may be INI files for each converter which supply run time extended
1.167 +// CCnaConverter information such as additional mime types.
1.168 +class CCnaConvInfoFileReader2 : public CCnaConvInfoFile2
1.169 + {
1.170 +public:
1.171 + IMPORT_C static CCnaConvInfoFileReader2* NewLC(const TDesC& aFileName);
1.172 + IMPORT_C static CCnaConvInfoFileReader2* NewL(const TDesC& aFileName);
1.173 + IMPORT_C TInt Count();
1.174 + IMPORT_C CCnaConverter* AtL(TInt anIndex);
1.175 + //
1.176 + IMPORT_C void RestoreL();
1.177 +private:
1.178 + CCnaConvInfoFileReader2();
1.179 + void RestoreConverterL(TResourceReader& aReader);
1.180 + void ConstructL(const TDesC& aFileName);
1.181 + };
1.182 +
1.183 +#endif