ncdengine/provider/protocol/inc/ncdparserimpl.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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 "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:   CNcdParserImpl declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NcdPARSERIMPL_H
       
    20 #define NcdPARSERIMPL_H
       
    21 
       
    22 #include <xml/parser.h>
       
    23 #include <badesca.h>
       
    24 
       
    25 
       
    26 #include "ncdparser.h"
       
    27 #include "ncdparserobserver.h"
       
    28 #include "ncdsubparser.h"
       
    29 
       
    30 class CNcdParserObserverBundleImpl;
       
    31 class MNcdProtocolDefaultObserver;
       
    32 
       
    33 /**
       
    34  * Parser implementation class.
       
    35  */
       
    36 class CNcdParserImpl : //public CBase,
       
    37     public CActive,
       
    38     public MNcdParser,
       
    39     public MNcdSubParserObserver
       
    40    
       
    41     {
       
    42 public:
       
    43     /**
       
    44      * Constructor
       
    45      *
       
    46      * @param Default observer. Ownership is transferred to parser
       
    47      * @return CNcdParserImpl*
       
    48      */
       
    49     static CNcdParserImpl* NewL( 
       
    50         MNcdProtocolDefaultObserver* aDefaultObserver );
       
    51     /**
       
    52      * Destructor
       
    53      */
       
    54     virtual ~CNcdParserImpl();
       
    55     
       
    56 protected:
       
    57     /**
       
    58      * Constructor
       
    59      */
       
    60     CNcdParserImpl( MNcdProtocolDefaultObserver* aDefaultObserver );
       
    61     /**
       
    62      * Constructor
       
    63      */
       
    64     void ConstructL();
       
    65 
       
    66 private: // From CActive
       
    67 
       
    68     /**
       
    69      * @see CActive::DoCancel()
       
    70      */
       
    71     void DoCancel();
       
    72     /**
       
    73      * @see CActive::RunL()
       
    74      */
       
    75     void RunL();
       
    76     /**
       
    77      * @see CActive::RunError()
       
    78      */
       
    79     TInt RunError( TInt aError );
       
    80        
       
    81        
       
    82 public: // From MNcdParser
       
    83     /**
       
    84      * @see MNcdParser::Observers()
       
    85      */
       
    86     MNcdParserObserverBundle& Observers() const;
       
    87     /**
       
    88      * @see MNcdParser::DefaultObserver()
       
    89      */
       
    90     MNcdProtocolDefaultObserver& DefaultObserver() const;
       
    91     
       
    92     /**
       
    93      * @see MNcdParser::BeginAsyncL()
       
    94      */     
       
    95     void BeginAsyncL();
       
    96 
       
    97     /**
       
    98      * @see MNcdParser::BeginAsyncL()
       
    99      */     
       
   100     void BeginAsyncL( CNcdSubParser* aSubParser );
       
   101 
       
   102     /**
       
   103      * @see MNcdParser::BeginSyncL()
       
   104      */
       
   105     void BeginSyncL();
       
   106     
       
   107     /**
       
   108      * @see MNcdParser::BeginSyncL()
       
   109      */
       
   110     void BeginSyncL( CNcdSubParser* aSubParser );
       
   111     /**
       
   112      * @see MNcdParser::ParseL()
       
   113      */
       
   114     void ParseL( const TDesC8& aData );
       
   115     /**
       
   116      * @see MNcdParser::ParseL()
       
   117      */
       
   118     void ParseL( const TDesC16& aData );
       
   119     /**
       
   120      * @see MNcdParser::EndL()
       
   121      */
       
   122     void EndL();
       
   123     /**
       
   124      * @see MNcdParser::CancelParsing()
       
   125      */
       
   126     void CancelParsing();
       
   127 
       
   128     /**
       
   129      * @see MNcdParser::SetOriginL
       
   130      */
       
   131     void SetOriginL( const TDesC& aOrigin );
       
   132 
       
   133 
       
   134 public: // From MNcdParserObserver
       
   135 
       
   136     /**
       
   137      * @see MNcdSubParserObserver::SubParserFinishedL
       
   138      */
       
   139     void SubParserFinishedL( const TDesC8& aTag, TInt aErrorCode );
       
   140 
       
   141 private:
       
   142 
       
   143     void BeginL( CNcdSubParser* aSubParser );
       
   144 
       
   145 protected:
       
   146     /**
       
   147      * Observer for parser events
       
   148      */
       
   149     CNcdParserObserverBundleImpl* iObservers;
       
   150 
       
   151     /**
       
   152      * Default observer for parser events
       
   153      * Owned.
       
   154      */
       
   155     MNcdProtocolDefaultObserver* iDefaultObserver;
       
   156         
       
   157     /**
       
   158      * Subparser used for further parsing
       
   159      */
       
   160     CNcdSubParser* iSubParser;
       
   161     
       
   162     /**
       
   163      * XML parser instance
       
   164      */
       
   165     Xml::CParser* iXmlParser;
       
   166     
       
   167     /**
       
   168      * Data buffer
       
   169      */
       
   170     CBufBase* iInputBuffer;
       
   171 
       
   172     /**
       
   173      * Set to ETrue by user when all data has been fed to the parser.
       
   174      * After processing the data, observer is called to indicate comlpetion.
       
   175      */
       
   176     TBool iPleaseFinish;
       
   177     /**
       
   178      * Status flag to indicate running in synchronous or asynchronous mode.
       
   179      */
       
   180     TBool iSynchronous;
       
   181 
       
   182     /**
       
   183      * Status flag indicating cancellation. The parsing should be stopped.
       
   184      */
       
   185     TBool iCancelled;
       
   186 
       
   187     /**
       
   188      * Origin data field, set according to SetOriginL(). Passed to some
       
   189      * observers.
       
   190      */
       
   191     HBufC* iOrigin;
       
   192     
       
   193 private:
       
   194     HBufC8* iFeedBuffer;
       
   195     
       
   196     
       
   197     };
       
   198 
       
   199 #endif