email/imap4mtm/imapsession/inc/cimapatom.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 1998-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 // CImapAtom header
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __CIMAPATOM_H__
       
    19 #define __CIMAPATOM_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32cons.h>
       
    23 #include <mentact.h>
       
    24 #include <imsk.h>
       
    25 #include <iapprefs.h>
       
    26 
       
    27 /**
       
    28 Represents an atom of data from incoming IMAP bodystructure data.
       
    29 This class contains a TPtrC which points to the data 'owned' by 
       
    30 this atom in the buffer. It also contains next (sibling) and child pointers,
       
    31 with which the tree is constructed.
       
    32 
       
    33 @internalComponent
       
    34 @prototype
       
    35 */
       
    36 class CImapAtom : public CBase
       
    37 	{
       
    38 	friend class CImapAtomParser;
       
    39  
       
    40 public:
       
    41 	static CImapAtom* NewLC();
       
    42 	~CImapAtom();
       
    43 	
       
    44 	void		Set(const TDesC8& aAtom, TBool aAtomIsQuoted);
       
    45 	void		AddChild(CImapAtom *aNewChild);
       
    46 	void		AddNext(CImapAtom *aNewNext);
       
    47 
       
    48 	// Get child/next pointers
       
    49 	CImapAtom*	Child();
       
    50 	CImapAtom*	Next();
       
    51 
       
    52 	const TDesC8& Atom(TBool aNString);
       
    53 	TBool AtomIsQuoted();
       
    54 	
       
    55 	TBool		Match(const TDesC8& aValue);
       
    56 
       
    57 private:
       
    58 	CImapAtom();
       
    59 
       
    60 	// Only to be used by CImapAtomParser
       
    61 	void FixupL(const HBufC8 *aNewBuffer, const TText8 *aOldBuffer);
       
    62 
       
    63 private:
       
    64 	/**
       
    65 	The string data for this atom.
       
    66 	*/
       
    67 	TPtrC8		iAtom;
       
    68 	/**
       
    69 	Whether the data for this atom was delivered within quotes.
       
    70 	*/
       
    71 	TBool		iAtomIsQuoted;
       
    72 	
       
    73 	/**
       
    74 	Pointer to the first nested atom after an opening bracket (which may or may not be an opening bracket too)
       
    75 	Not owned by this class, but can be set to NULL when this atom does not have a child.
       
    76 	*/
       
    77 	CImapAtom*	iChild;
       
    78 	/**
       
    79 	If this atom is an opening bracket, then this points to the next atom after the matching closing bracket
       
    80 	Otherwise, this just points to the next atom that was found.
       
    81 	Not owned by this class, but can be set to NULL when this atom does not have a next atom.
       
    82 	*/
       
    83 	CImapAtom*	iNext;
       
    84 	};
       
    85 
       
    86 #endif // __CIMAPATOM_H__