epoc32/include/app/bcardeng.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* 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
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: 
williamr@2
    15
*      A class to convert Phonebook items to vCard stream and vice versa
williamr@2
    16
*
williamr@2
    17
*/
williamr@2
    18
williamr@2
    19
williamr@2
    20
#ifndef __BCARDENG_H__
williamr@2
    21
#define __BCARDENG_H__
williamr@2
    22
williamr@2
    23
williamr@2
    24
// INCLUDES
williamr@2
    25
#include <badesca.h>        // CDesCArrayFlat
williamr@2
    26
#include "PbkFields.hrh"    // TPbkFieldId
williamr@2
    27
williamr@2
    28
williamr@2
    29
// CONSTANTS
williamr@2
    30
_LIT(KPbkvCardFileExtension, ".vcf");
williamr@2
    31
williamr@2
    32
// FORWARD DECLARATIONS
williamr@2
    33
class CPbkContactEngine;
williamr@2
    34
class CPbkContactItem;
williamr@2
    35
class RWriteStream;
williamr@2
    36
class CBCardFieldUidMapping;
williamr@2
    37
class CBCardExportProperty;
williamr@2
    38
class CParserVCard;
williamr@2
    39
williamr@2
    40
// CLASS DECLARATION
williamr@2
    41
williamr@2
    42
/**
williamr@2
    43
 * The business card engine is able to import and export vCards and Compact 
williamr@2
    44
 * Business Cards to and from Phonebook.
williamr@2
    45
 */
williamr@2
    46
class CBCardEngine : public CBase
williamr@2
    47
	{
williamr@2
    48
    public: // Constructors and destructor
williamr@2
    49
        /**
williamr@2
    50
         * Creates a new instance of this class.
williamr@2
    51
		 * @param aEngine An open Phonebook Engine object which CBCardEngine
williamr@2
    52
		 *        uses to import and export vCard data.
williamr@2
    53
         */
williamr@2
    54
		IMPORT_C static CBCardEngine* NewL(CPbkContactEngine* aEngine);
williamr@2
    55
williamr@2
    56
        /**
williamr@2
    57
         * Destructor
williamr@2
    58
         */
williamr@2
    59
		IMPORT_C ~CBCardEngine();
williamr@2
    60
williamr@2
    61
	public: // The main public interface
williamr@2
    62
        /**
williamr@2
    63
         * Reads a vCard record from a stream into a Phonebook contact
williamr@2
    64
		 * item.
williamr@2
    65
		 * @param aDestItem Phonebook contact item where the information
williamr@2
    66
		 *        should be written to. The item should be writable. The
williamr@2
    67
		 *        caller should commit the changes.
williamr@2
    68
		 * @param aSourceStream A stream where the vCard data is read from
williamr@2
    69
         */
williamr@2
    70
		IMPORT_C void ImportBusinessCardL(CPbkContactItem& aDestItem,
williamr@2
    71
			RReadStream &aSourceStream);
williamr@2
    72
williamr@2
    73
        /**
williamr@2
    74
         * Writes a vCard record with information from a Phonebook contact
williamr@2
    75
		 * item.
williamr@2
    76
		 * @param aDestStream A stream where the vCard data is written to.
williamr@2
    77
		 *        The data written to the stream is not Committed by this method.
williamr@2
    78
		 * @param aSourceItem Phonebook contact item where the information
williamr@2
    79
		 *        should be read from
williamr@2
    80
         */
williamr@2
    81
        IMPORT_C void ExportBusinessCardL(RWriteStream& aDestStream,
williamr@2
    82
			CPbkContactItem& aSourceItem);
williamr@2
    83
williamr@2
    84
        /**
williamr@2
    85
         * Reads a Compact Business Card record from a stream into a Phonebook
williamr@2
    86
		 * contact item.
williamr@2
    87
		 * @param aDestItem Phonebook contact item where the information
williamr@2
    88
		 *        must be written to. The item must be writable.
williamr@2
    89
		 *        The caller should commit the changes.
williamr@2
    90
		 * @param aSourceStream A stream where the Compact Business Card
williamr@2
    91
		 *        is read from
williamr@2
    92
		 * @return ETrue on success
williamr@2
    93
         */
williamr@2
    94
        IMPORT_C TBool ImportCompactBusinessCardL(CPbkContactItem& aDestItem,
williamr@2
    95
			RReadStream &aSourceStream);
williamr@2
    96
williamr@2
    97
        /**
williamr@2
    98
         * Checks if given field is supported by the vCard format
williamr@2
    99
         * @param aFieldId Field id type
williamr@2
   100
         * @return ETrue if given field is supported, EFalse otherwise
williamr@2
   101
         */
williamr@2
   102
        IMPORT_C TBool SupportsFieldType(TPbkFieldId aFieldId);
williamr@2
   103
williamr@2
   104
    private:  // Constructors
williamr@2
   105
		CBCardEngine();
williamr@2
   106
		void ConstructL(CPbkContactEngine* aEngine);
williamr@2
   107
williamr@2
   108
    private:    // Private utility methods
williamr@2
   109
        void ProcessExportPropertyL(
williamr@2
   110
            CParserVCard& aParser,
williamr@2
   111
            CPbkContactItem& aSourceItem,
williamr@2
   112
            const CBCardExportProperty& aExportProperty);
williamr@2
   113
        TInt GetLineFromStreamL(TDes& aBuf, RReadStream& aSourceStream);
williamr@2
   114
        TInt GetByteFromStream(TUint8& aByte, RReadStream& aSourceStream);
williamr@2
   115
		class CBCardFieldAction;
williamr@2
   116
williamr@2
   117
    private:
williamr@2
   118
        /// Own: Filename for picture
williamr@2
   119
        HBufC* iPictureFileName;
williamr@2
   120
		/// Own: Filename for thumbnail
williamr@2
   121
		HBufC* iThumbnailFileName;
williamr@2
   122
        /// Own: Instance for property name-Uid mapping
williamr@2
   123
        CBCardFieldUidMapping* iNameUidMap;
williamr@2
   124
        /// Own: Instance for contact field handling
williamr@2
   125
        CBCardFieldAction* iFieldAction;
williamr@2
   126
        /// Ref: Phonebook engine
williamr@2
   127
        CPbkContactEngine* iEngine;
williamr@2
   128
        /// Own: Array of CBCardExportProperty instances for exporting contact
williamr@2
   129
        RPointerArray<CBCardExportProperty> iExportProperties;
williamr@2
   130
	};
williamr@2
   131
williamr@2
   132
#endif // __BCARDENG_H__
williamr@2
   133
williamr@2
   134
// End of File