pushmtm/MtmUtilInc/WhiteListImporter.h
changeset 51 48e827313edd
parent 37 481242ead638
child 53 f427d27b98d8
equal deleted inserted replaced
37:481242ead638 51:48e827313edd
     1 /*
       
     2 * Copyright (c) 2003, 2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Declatarion of CWhiteListImporter.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WHITE_LIST_CONVERTER_H
       
    20 #define WHITE_LIST_CONVERTER_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <e32std.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 
       
    29 class CPushInitiatorList;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 * Converter utility.
       
    35 * Import White List data from a comma and semicolon separated descriptor to 
       
    36 * push initiator list, or export that to a descriptor.
       
    37 */
       
    38 class CWhiteListConverter : public CBase
       
    39     {
       
    40     public:     // Constructors and destructor
       
    41 
       
    42         /**
       
    43         * Two-phased constructor. Leaves on failure.
       
    44         * @param aPushInitiatorList PushInitiatorList.
       
    45         * @return The constructed importer.
       
    46         */
       
    47         static CWhiteListConverter* NewL( CPushInitiatorList& aPushInitiatorList );
       
    48 
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~CWhiteListConverter();
       
    53 
       
    54     public:     // New methods
       
    55 
       
    56         /**
       
    57         * Import White List data from a comma and semicolon 
       
    58         * separated descriptor.
       
    59         * @param aSource Input descriptor.
       
    60         * @throw KErrOverflow No more space in input buffer.
       
    61         * @throw KErrCorrupt Corrupt input.
       
    62         */
       
    63         void Buffer2ListL( const TDesC& aSource );
       
    64 
       
    65         /**
       
    66         * Export White List data to a comma and semicolon separated descriptor.
       
    67         * @return Output descriptor. Ownership transferred to the caller.
       
    68         * @throw KErrOverflow No more space in input buffer.
       
    69         * @throw KErrCorrupt Corrupt input.
       
    70         */
       
    71         HBufC* List2BufferL();
       
    72 
       
    73     private:    // Constructors and destructor
       
    74 
       
    75         /**
       
    76         * Constructor.
       
    77         */
       
    78         CWhiteListConverter( CPushInitiatorList& aPushInitiatorList );
       
    79 
       
    80         /**
       
    81         * Second phase constructor. Leaves on failure.
       
    82         */
       
    83         void ConstructL();
       
    84 
       
    85     private:    // New methods
       
    86 
       
    87         /**
       
    88         * Get next character and store it in iCurCh.
       
    89         */
       
    90         inline void GetChar();
       
    91 
       
    92         /**
       
    93         * Process next line = Record.
       
    94         * @return ETrue if more lines to go, EFalse on EOS.
       
    95         */
       
    96         TBool NextLineL();
       
    97 
       
    98         /**
       
    99         * Parse next token = Unit. 
       
   100         * Next token spans from current character up to (but excluding) 
       
   101         * to the next stop character.
       
   102         * @param aStopChar Stop character (terminate the token).
       
   103         * @return Pointer to token. This may be empty string. Note that the
       
   104         * returned pointer is valid until next call (consecutive calls reuse
       
   105         * the same buffer).
       
   106         */
       
   107         TPtrC NextTokenL( TUint aStopChar );
       
   108 
       
   109         /**
       
   110         * Parse the separated list of White List entries and 
       
   111         * add it to PushMtmSettings.
       
   112         */
       
   113         void AttrsL();
       
   114 
       
   115     private:    // data
       
   116 
       
   117         CPushInitiatorList& iPushInitiatorList; ///< The initiator list.
       
   118         TLex  iSource;  ///< Helper to parse iSource.
       
   119         TUint iCurCh;   ///< Current (lookahead) character.
       
   120         TText* iBuf;    ///< Token buffer. Owned.
       
   121         TText* iNextCh; ///< Next character is stored here. Not owned.
       
   122         TText* iMaxCh;  ///< End of buffer (points past the buffer). Not owned.
       
   123         HBufC* iConverterBuf; ///< Owned.
       
   124     };
       
   125 
       
   126 #endif // WHITE_LIST_CONVERTER_H
       
   127             
       
   128 // End of File