messagingfw/biomsgfw/BDBINC/BIODB.H
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 1999-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 // BIODB.H
       
    15 // 
       
    16 /**
       
    17  * @file 
       
    18  * BIO information file (BIF) database.
       
    19  *
       
    20  * @publishedAll
       
    21  * @released
       
    22  */
       
    23 
       
    24 #ifndef __BIODB_H__
       
    25 #define __BIODB_H__
       
    26 
       
    27 #include <bif.h>				// the bif reader
       
    28 #include <f32file.h>
       
    29 
       
    30 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS 
       
    31 #include <bifchangeobserver.h>
       
    32 #endif
       
    33 
       
    34 class CBifEntry;
       
    35 
       
    36 /** BIO information file (BIF) database.
       
    37 
       
    38 This class reads the installed BIF files and allows information from them 
       
    39 to be easily extracted.
       
    40 
       
    41 @see BIO_INFO_FILE 
       
    42 @publishedAll
       
    43 @released
       
    44 */
       
    45 class CBIODatabase : public CBase
       
    46 	{
       
    47 public:
       
    48 	/** Search methods. */
       
    49 	enum TSearchList
       
    50 		{
       
    51 		/** Begin search from the start. */
       
    52 		EStart, 
       
    53 		/** Begin search from the last index position. */
       
    54 		ENext
       
    55 		};
       
    56 public:
       
    57 	IMPORT_C static CBIODatabase* NewLC(RFs& afileSystem);
       
    58 	IMPORT_C static CBIODatabase* NewL(RFs& afileSystem);
       
    59 	IMPORT_C ~CBIODatabase();
       
    60 
       
    61 public:
       
    62 	// BIF files contain all the information that needs to be registered
       
    63 	// for each BIO Message type
       
    64 
       
    65 	// Completely refresh the database will all the BIF Files in the
       
    66 	// default directory
       
    67 	IMPORT_C void AddAllBifsL(RFs& afileSystem);
       
    68 
       
    69 	// Add one bifFile using the file name, then using Neil's handy 
       
    70 	// class to read it
       
    71 	// This will add the Parser
       
    72 	IMPORT_C void AddBifL(CBioInfoFileReader* aBifReader);
       
    73 	IMPORT_C void RemoveBifL(TUid aMsgID);
       
    74 	IMPORT_C void RemoveBifL(TInt aIndex);
       
    75 
       
    76 	// BIO Messages are determined to of a BIO type if we have the BIO
       
    77 	// Parser identified by a WAP/NBS port, IANA MIME type or a Pattern
       
    78 	IMPORT_C TInt BIOCount();
       
    79 
       
    80 	// Get the BioEntry at this index
       
    81 	// Return Index if found, NULL if not
       
    82 	IMPORT_C const CArrayFix<TBioMsgId>* BIOEntryLC(TInt index);
       
    83 	
       
    84 
       
    85 	// Get the whole bif file class
       
    86 	IMPORT_C const CBioInfoFileReader& BifReader(TInt aIndex) const;
       
    87      
       
    88 	// Get the BIO Entry based on what type it is, pos indicates where to start looking 
       
    89 	// after, and will get updated to current pos
       
    90 	IMPORT_C const CArrayFix<TBioMsgId>* BioEntryByTypeLC(
       
    91 								TSearchList aSearchType,
       
    92 								TBioMsgIdType portType, 
       
    93 								TInt& rIndex);
       
    94 
       
    95 	IMPORT_C void GetBioIndexWithMsgIDL(TUid aMsgID, TInt& rIndex);
       
    96 
       
    97 	// Get the BioMessageID for the Index
       
    98 	IMPORT_C void GetBioMsgID(TInt aIndex, TUid& rMsgID);
       
    99 
       
   100 	// Get the BioParserName for the Index
       
   101 	IMPORT_C const TPtrC GetBioParserName(TInt aIndex);
       
   102 	
       
   103 	// Get the BioParserName for the BioMessageID
       
   104 	IMPORT_C const TPtrC GetBioParserNameL(TUid aMsgID);
       
   105 	
       
   106 	// Get the ControlID for the Index
       
   107 	IMPORT_C void GetBioControlID(TInt aIndex, TUid& rControlID);
       
   108 	
       
   109 	// Get the ControlID for the BioMessageID
       
   110 	IMPORT_C void GetBioControlIDL(TUid aMsgID, TUid& rControlID);
       
   111 	
       
   112 	IMPORT_C const TPtrC GetBioControlName(TInt aIndex);
       
   113 	IMPORT_C const TPtrC GetBioControlNameL(TUid aMsgID);
       
   114 	
       
   115 	// Get the String Extension for the BioMessageID
       
   116 	IMPORT_C const TPtrC GetFileExtL(TUid aMsgID);
       
   117 
       
   118 	IMPORT_C void GetDefaultSendBearerL(TUid aBioUID, TBioMsgId& rBioMsgIdentifier);
       
   119 	IMPORT_C void GetDefaultSendBearerTypeL(TUid aBioUID, TBioMsgIdType& rPortType);
       
   120 	IMPORT_C void GetDefaultSendBearerByTypeL(TUid aBioUID, TBioMsgIdType aPortType, TBioMsgId& rBioMsgIdentifier);
       
   121 
       
   122 	// BIO Messages are determined to of a BIO type if we have the BIO
       
   123 	// Parser identified by a WAP/NBS port, IANA MIME type or a Pattern
       
   124 	// Return an Index
       
   125 
       
   126 	// Get the Port# or Identifying string for sending
       
   127 	IMPORT_C void GetPortNumberL(TUid aMsgID, TBioMsgIdType aPortType, TInt& aPortNumber);
       
   128 	IMPORT_C void GetIdentifierTextL(TUid aMsgID, TBioMsgIdType aPortType, TBioMsgIdText& aText);
       
   129 
       
   130 	// Test to see if this is a BioMessage
       
   131 	// Pass in the type ... if its NBS or IANA pass in the string pattern
       
   132 	//						if its WAP or SecureWap, pass in the port number
       
   133 	// return kErrNone if success, kErrNotFound if it fails
       
   134 	IMPORT_C TInt IsBioMessageL(TBioMsgIdType aPortType, const TDesC& aPattern, TUint16 aPort, TUid& rBioMsgUID);
       
   135 
       
   136 	IMPORT_C TInt IsBioMessageL(TBioMsgId bioMessageData, TUid& rBioMsgUID);
       
   137 
       
   138 private:
       
   139 	CBIODatabase();
       
   140 	void ConstructL(RFs& afileSystem);
       
   141 
       
   142 private:
       
   143 	//Utilities
       
   144 	void GetTransportIDL(TInt aIndex, TBioMsgIdType aPortType, TBioMsgId& aBioMsgID);
       
   145 	TBool IsLanguageFileL(const TDesC& aFileName, TInt& aExtLength) const;
       
   146 	// If Persistence is required...
       
   147 	// void InternalizeL(RReadStream& aStream);		
       
   148 	// void ExternalizeL(RWriteStream& aStream) const;	
       
   149 	
       
   150 private:
       
   151 	CArrayPtrFlat<CBioInfoFileReader>* iBifReaders;
       
   152 
       
   153 };
       
   154 
       
   155 #endif	// __BIODB_H__