epoc32/include/app/miutatch.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 1998-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@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.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 (__MIUTATCH_H__)
williamr@2
    17
#define __MIUTATCH_H__
williamr@2
    18
williamr@2
    19
williamr@2
    20
#if !defined (__S32FILE_H__)
williamr@2
    21
#include <s32file.h>
williamr@2
    22
#endif
williamr@2
    23
williamr@2
    24
const TInt KDataLineBufferLength = 4096;
williamr@2
    25
_LIT(KImcvAttachFormatStr, "%S(%d)%S");
williamr@2
    26
williamr@2
    27
/**
williamr@2
    28
@internalTechnology
williamr@2
    29
@released
williamr@2
    30
*/
williamr@2
    31
enum TImAttachmentFileState
williamr@2
    32
	{ 
williamr@2
    33
	EFileNotOpen, 
williamr@2
    34
	EFileIsOpen, 
williamr@2
    35
	EFileIsClosed,		
williamr@2
    36
	EFileIsCorrupt,		// UU data being decoded is corrupt
williamr@2
    37
	EFileIsIncomplete,	// file write failed
williamr@2
    38
	EFileFailedToOpen,	// can't open attach file
williamr@2
    39
	EFileTopIncomplete	// File is incomplete due to top
williamr@2
    40
	};
williamr@2
    41
williamr@2
    42
class TImAttachmentFile		// utility class to handle file operations with Email attachments
williamr@2
    43
/**
williamr@2
    44
@internalAll
williamr@2
    45
@released
williamr@2
    46
*/
williamr@2
    47
    {
williamr@2
    48
public:
williamr@2
    49
 	enum TImFileOpenMode
williamr@2
    50
		{
williamr@2
    51
		/**
williamr@2
    52
		File opened for read mode
williamr@2
    53
		*/
williamr@2
    54
		EImFileRead = 0,
williamr@2
    55
		/**
williamr@2
    56
		File opened for write mode
williamr@2
    57
		*/
williamr@2
    58
		EImFileWrite,
williamr@2
    59
		};   
williamr@2
    60
public:
williamr@2
    61
    IMPORT_C TImAttachmentFile(RFs& aFileSession);  // constructor
williamr@2
    62
    IMPORT_C ~TImAttachmentFile();  // destructor
williamr@2
    63
williamr@2
    64
    IMPORT_C TInt MakeDir (const TDesC& aDirPath);
williamr@2
    65
    IMPORT_C TInt OpenFile (const TDesC& aDirPath ,const TDesC& aFileName );
williamr@2
    66
    IMPORT_C TInt CreateFile (const TDesC& aDirPath ,const TDesC& aFileName );
williamr@2
    67
    IMPORT_C TInt ReadFile (TDes8& rBuffer, TInt aNumBytes );
williamr@2
    68
    IMPORT_C TInt WriteFile (const TDesC8& aBuffer);
williamr@2
    69
    IMPORT_C TInt WriteFile (const TDesC16& aBuffer);
williamr@2
    70
    IMPORT_C TInt CloseFile();
williamr@2
    71
	IMPORT_C TInt DeleteAttachment(const TDesC& aDirPath,const TDesC& aFileName);
williamr@2
    72
	
williamr@2
    73
	IMPORT_C void SetFileHandle(RFile& aFile,TImFileOpenMode aFileMode);
williamr@2
    74
						
williamr@2
    75
	TInt AppendValidFile(const TDesC& aDirPath, const TDesC& aFileName, TFileName& rFullFilePath);
williamr@2
    76
private:
williamr@2
    77
	void Reset();
williamr@2
    78
	TInt WriteFile ();
williamr@2
    79
    TInt ReadFile ();
williamr@2
    80
	TInt FlushFile();
williamr@2
    81
	TPtrC8 SelectFileData(TInt& abufLen, TInt& aDataLen);
williamr@2
    82
williamr@2
    83
private:
williamr@2
    84
    RFs&		    iFileSession;
williamr@2
    85
	RFile			iFile;
williamr@2
    86
	TFileText		iFileText;
williamr@2
    87
	TFileName		iFullFilePath;
williamr@2
    88
	TBuf8<KDataLineBufferLength>		iDataLine;
williamr@2
    89
	TBool			iWritingToFile;
williamr@2
    90
	TInt			iSpaceOnCache;
williamr@2
    91
	TInt			iPositionInCache;
williamr@2
    92
    };
williamr@2
    93
williamr@2
    94
#endif