ncdengine/provider/protocol/inc/ncdparser.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:   MNcdParser interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NcdPARSER_H
       
    20 #define NcdPARSER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class MNcdParserObserverBundle;
       
    25 class MNcdProtocolDefaultObserver;
       
    26 class CNcdSubParser;
       
    27 
       
    28 /**
       
    29  * Parser interface.
       
    30  */
       
    31 class MNcdParser 
       
    32     {
       
    33 public:
       
    34     /**
       
    35      * Destructor
       
    36      */
       
    37     virtual ~MNcdParser() {}
       
    38 
       
    39     /**
       
    40      * Retrieves the observer bundle. The caller must set some 
       
    41      * observers prior to beginning the operation, or BeginL()-methods will fail.
       
    42      */
       
    43     virtual MNcdParserObserverBundle& Observers() const = 0;
       
    44 
       
    45     /**
       
    46      * Retrieves the default observer. All events not handled or handled by 
       
    47      * the client should be passed to the default observer.
       
    48      * It will further handle the events and free the memory.
       
    49      */
       
    50     virtual MNcdProtocolDefaultObserver& DefaultObserver() const = 0;
       
    51 
       
    52     /**
       
    53      * Sets the origin of data for this parser. This is passed to some
       
    54      * observers, as session observer.
       
    55      */
       
    56     virtual void SetOriginL( const TDesC& aOrigin ) = 0;
       
    57 
       
    58     /** 
       
    59      * Begin parsing in asynchronous manner. 
       
    60      * After this, data may fed to the parser.
       
    61      */
       
    62     virtual void BeginAsyncL() = 0;
       
    63     
       
    64     /**
       
    65      * Begin parsing in asynchronous manner using the given parser
       
    66      *
       
    67      * @param aSubParser Parser. If NULL, normal top level parser is used. Ownership is transferred.
       
    68      * @note Ownership is always transferred so aSubParser must NOT be deleted
       
    69      * by the calling code even if this method leaves
       
    70      */
       
    71     virtual void BeginAsyncL( CNcdSubParser* aSubParser ) = 0;
       
    72     
       
    73     /** 
       
    74      * Begin parsing in synchronous manner.
       
    75      * After this, data may fed to the parser.
       
    76      */
       
    77     virtual void BeginSyncL( ) = 0;
       
    78     
       
    79     /**
       
    80      * Begin parsing in asynchronous manner using the given parser
       
    81      *
       
    82      * @param aSubParser Parser. If NULL, normal top level parser is used. Ownership is transferred.
       
    83      * @note Ownership is always transferred so aSubParser must NOT be deleted
       
    84      * by the calling code even if this method leaves
       
    85      */
       
    86     virtual void BeginSyncL( CNcdSubParser* aSubParser ) = 0;
       
    87 
       
    88     /**
       
    89      * Parse some data.
       
    90      * @param aData UTF8 format XML data
       
    91      */
       
    92     virtual void ParseL( const TDesC8& aUTF8Data ) = 0;
       
    93     /**
       
    94      * Parse some data.
       
    95      * @param aData 16-bit unicode format XML data
       
    96      */
       
    97     virtual void ParseL( const TDesC16& aData ) = 0;
       
    98     /**
       
    99      * End parsing. 
       
   100      * This method must be called when all the data has been fed to the parser.
       
   101      * In synchronous mode, a callback will be immediately issued.
       
   102      * In asynchronous mode, a callback will be issued after all data
       
   103      * in the buffers has been processed.
       
   104      */
       
   105     virtual void EndL() = 0;
       
   106     /**
       
   107      * Cancel ongoing asynchronous parsing process.
       
   108      * A callback will not be issued.
       
   109      */
       
   110     virtual void CancelParsing() = 0;
       
   111     };
       
   112 
       
   113 
       
   114 #endif