example/TwitterAuthApp/inc/xmlParser.h
author cgandhi
Mon, 11 Oct 2010 21:59:54 +0530
changeset 26 83d6a149c755
permissions -rw-r--r--
Submitting following changes - AuthApps for Last.fm and Twitter added API for checking ServiceAuthorization added for SMFCredMgrClient API added for forcefully removing credential details from SMFCredMgr Extra argument checks in SMfClient APIs APIs for service login and logout from SMFClient Redundant members removed from SmfServerSymbian DSM bug fixes Test Apps included

/**
* Copyright (c) 2010 Sasken Communication Technologies Ltd.
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the "{License}"
* which accompanies  this distribution, and is available
* at the URL "{LicenseUrl}".
*
* Initial Contributors:
* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
*
* Contributors:
* Siddhartha Chandra, Sasken Communication Technologies Ltd
* Description:
* XML Parser class
*/

#ifndef FB_XML_HANDLER_H
#define FB_XML_HANDLER_H

#include <QObject>
#include <QString>
#include <QXmlDefaultHandler>
#include <QVariantList>

#include "authAppConstants.h"

// FORWARD DECLARATIONS
class FBRequest;

///////////////////////////////////////////////////////////////////////////////////////////////////
class FBXMLHandler : public QObject, public QXmlDefaultHandler
{
    Q_OBJECT

private:
    QVariantList        iStack;
    QList<QString>      iNameStack;
    QVariant            iRootObject;
    QString             iRootName;
    QString             iChars;

    QString         iParseErrorMessage;
    bool            iError;

public: /* class functions */

    FBXMLHandler();
    ~FBXMLHandler();

    inline const QString& rootName() const { return iRootName; }
    inline QVariant rootObject() const { return iRootObject; }

    inline bool parseError() const { return iError; }

private:
    /* methods from QXmlDefaultHandler */
    bool startElement( const QString & namespaceURI,
                       const QString & localName,
                       const QString & qName,
                       const QXmlAttributes & atts);
    bool characters(const QString& text);
    bool endElement( const QString & namespaceURI,
                     const QString & localName,
                     const QString & qName );

    /* methods from QXmlErrorHandler */
    bool error(const QXmlParseException& exception);
    bool fatalError(const QXmlParseException& exception);

    /* private functions*/
    const QString& topName() const;
    void flushCharacters();
    QVariant topObject(bool aCreate);

    QVariant topContainer();


    void initWhiteSpaceHash();
    QHash<QChar, bool> iWhiteSpaceAndNewLineCharSet;

};

#endif // FB_XML_HANDLER_H