upnp/upnpstack/serviceframework/inc/upnperrorcodeseekercontenthandler.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2007 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:  Declares the CUpnpErrorCodeSeekerContentHandler class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __UPNPERRORCODESEEKERCONTENTHANDLER_H__
       
    21 #define __UPNPERRORCODESEEKERCONTENTHANDLER_H__
       
    22 
       
    23 #include "upnpcontenthandler.h"
       
    24 
       
    25 using namespace Xml;
       
    26 
       
    27 /**
       
    28 *  This class handles soap xml subtree starting with fault element.
       
    29 *  The only data we're interested in this subtree is upnp errorCode
       
    30 *  Rest of subtree is ignored
       
    31 *  <s:Fault>
       
    32 *  <faultcode>s:Client</faultcode>
       
    33 *  <faultstring>UPnPError</faultstring>
       
    34 *  <detail>
       
    35 *  <UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
       
    36 *  <errorCode>error code</errorCode>
       
    37 *  <errorDescription>error string</errorDescription>
       
    38 *  </UPnPError>
       
    39 *  </detail>
       
    40 *  </s:Fault>
       
    41 *  It is designed to be used by upnp controler that delegates to it events from xml sax parser
       
    42 *
       
    43 */
       
    44 NONSHARABLE_CLASS( CUpnpErrorCodeSeekerContentHandler ) : public CUpnpContentHandler
       
    45 {
       
    46 public:
       
    47 
       
    48     /**
       
    49     * Two-phased constructor
       
    50     * @param aControler controler of parsing process
       
    51     * @param aErrorValue out parameter where error value found will be stored
       
    52     * @return instance of CUpnpErrorCodeSeekerContentHandler class
       
    53     */
       
    54     static CUpnpErrorCodeSeekerContentHandler* NewL(
       
    55             CUpnpContentHandlersController& aController,
       
    56             RBuf8& aErrorValue );
       
    57 
       
    58     /**
       
    59     * Two-phased constructor. Leaves the object on CleanupStack
       
    60     * @param aControler controler of parsing process
       
    61     * @param aErrorValue out parameter where error value found will be stored
       
    62     * @return instance of CUpnpErrorCodeSeekerContentHandler class
       
    63     */
       
    64     static CUpnpErrorCodeSeekerContentHandler* NewLC(
       
    65             CUpnpContentHandlersController& aController,
       
    66             RBuf8& aErrorValue );
       
    67 
       
    68     /**
       
    69     * Destructor of CUpnpErrorCodeSeekerContentHandler class
       
    70     *
       
    71     */
       
    72     virtual ~CUpnpErrorCodeSeekerContentHandler();
       
    73 
       
    74 public:	// from CUpnpContentHandler
       
    75 
       
    76     /**
       
    77     * This method is a callback to indicate an element has been parsed.
       
    78     * @param				aElement is a handle to the element's details.
       
    79     * @param				aAttributes contains the attributes for the element.
       
    80     */
       
    81     virtual void OnStartElementL( const RTagInfo& aElement,
       
    82                                   const RAttributeArray& aAttributes );
       
    83 
       
    84     /**
       
    85     * This method is a callback to indicate the end of the element has been reached.
       
    86     * @param              aElement is a handle to the element's details.
       
    87     */
       
    88     virtual void OnEndElementL( const RTagInfo& aElement );
       
    89 
       
    90     /**
       
    91     * This method is a callback that sends the content of the element.
       
    92     * @param              aBytes is the raw content data for the element in one chunk
       
    93     */
       
    94     virtual void OnContentL( const TDesC8& aBytes );
       
    95 
       
    96     /**
       
    97      * Returns value if class is interested in tags all namespaces
       
    98      *
       
    99      * @return ETrue when the class is interested in tags in all namespaces
       
   100      */
       
   101     virtual TBool InterestedInAllNamespaces();
       
   102 
       
   103 protected:
       
   104 
       
   105     /**
       
   106     * Default C++ constructor
       
   107     */
       
   108     CUpnpErrorCodeSeekerContentHandler( CUpnpContentHandlersController& aController,
       
   109         RBuf8& aErrorCode );
       
   110 
       
   111 
       
   112     /**
       
   113      * Set next state of parsing. If we're interested in particular subtree
       
   114      * state will be handeled by this class, otherwise by ignore handler
       
   115      * @param aFoundTagName name of currently analyzed tag
       
   116      */
       
   117     void SetNextStateL( const TDesC8& aFoundTagName );
       
   118 
       
   119     /**
       
   120      * Set previous state of parsing. When particular tag is ended
       
   121      * state of parsind process should be updated.
       
   122      */
       
   123     void SetPreviousState();
       
   124 
       
   125     /**
       
   126      * Set particular next state of parsing. If we're interested in particular subtree
       
   127      * state will be handeled by this class, otherwise by ignore handler.
       
   128      * @param aNextAcceptedState next state that should be set if current tag is correct
       
   129      * @param aFoundTagName name of currently analyzed tag
       
   130      */
       
   131     void SetParticularNextStateL(
       
   132         const TDesC8& aNextAcceptedState, const TDesC8& aFoundTagName );
       
   133 
       
   134 private:
       
   135 
       
   136     RBuf8& iErrorValue;
       
   137 
       
   138     TPtrC8 iCurrentState;
       
   139 
       
   140 };
       
   141 
       
   142 #endif //__UPNPERRORCODESEEKERCONTENTHANDLER_H__