epoc32/include/mw/senfragment.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:        Central place for debug-type macros
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
williamr@2
    25
#ifndef SEN_FRAGMENT_H
williamr@2
    26
#define SEN_FRAGMENT_H
williamr@2
    27
williamr@2
    28
//  INCLUDES
williamr@2
    29
#include <e32base.h>
williamr@2
    30
#include <s32strm.h>
williamr@4
    31
#include <xml/attribute.h>
williamr@2
    32
#include <SenXmlReader.h>
williamr@2
    33
#include <SenElement.h>
williamr@2
    34
#include <MSenFragment.h>
williamr@2
    35
// CLASS DECLARATION
williamr@2
    36
williamr@2
    37
/**
williamr@2
    38
* Abstract base class declaring XML fragment interface.
williamr@2
    39
* @lib SenXML.dll
williamr@2
    40
* @since Series60 3.0
williamr@2
    41
*/
williamr@2
    42
class CSenFragment : public CBase, public MSenFragment
williamr@2
    43
    {
williamr@2
    44
    public: // New functions
williamr@2
    45
williamr@2
    46
        /**
williamr@2
    47
         * Getting the fragment as an XML element. This method will panic if 
williamr@2
    48
         * element has not been initialized for any reason.
williamr@2
    49
         * @return the current object as element. Ownership is not transferred.
williamr@2
    50
         */
williamr@2
    51
        virtual CSenElement& AsElement() = 0;
williamr@2
    52
williamr@2
    53
        /**
williamr@2
    54
         * @return the current object as element. May return NULL.
williamr@2
    55
         *          Caller takes ownership.
williamr@2
    56
         *
williamr@2
    57
         * Note(!): the return value (CSenElement) STRONGLY suggests that
williamr@2
    58
         * subclasses INHERIT CSenFragment in order properly comply the
williamr@2
    59
         * requirement of the ExtractElement() implementation.
williamr@2
    60
         */
williamr@2
    61
        virtual CSenElement* ExtractElement() = 0;
williamr@2
    62
williamr@2
    63
        /**
williamr@2
    64
         * Sets the XML reader to be used for parsing for the fragment.
williamr@2
    65
         * @param aReader:      the reader to be used. 
williamr@2
    66
         *                      Ownership is NOT transferred.
williamr@2
    67
         */
williamr@2
    68
        virtual void SetReader(CSenXmlReader& aReader) = 0;
williamr@2
    69
williamr@2
    70
        /**
williamr@2
    71
         * Gets the XML reader which this fragment uses for parsing.
williamr@2
    72
         * @param aReader:      the reader to be used. 
williamr@2
    73
         *                      Ownerships is not transferred.
williamr@2
    74
         */
williamr@2
    75
        virtual CSenXmlReader* Reader() = 0;
williamr@2
    76
williamr@2
    77
        /**
williamr@2
    78
         * Method to invoke parsing of a XML data.
williamr@2
    79
         * Note: SetReader() must be called before this method can be used.
williamr@2
    80
         * @param aXml: The XML data to be parsed.
williamr@2
    81
         */
williamr@2
    82
        virtual void ParseL(const TDesC8& aXml) = 0;
williamr@2
    83
williamr@2
    84
        /**
williamr@2
    85
         * Same as ParseL() except that it doesn't leave in case of an error. 
williamr@2
    86
         * Instead errors are trapped and error is returned.
williamr@2
    87
         * SetReader() must be called before this method can be used.
williamr@2
    88
         * @return KErrNone or other system-wide Symbian error codes.
williamr@2
    89
         */
williamr@2
    90
        virtual TInt BuildFrom(const TDesC8& aBuf) = 0;
williamr@2
    91
williamr@2
    92
        /**
williamr@2
    93
         * Let the delegate MSenFragment handle the following SAX events.
williamr@2
    94
         * This fragment is made the owner of the delegate and
williamr@2
    95
         * the delegate is expected to make this MSenFragment the receiver
williamr@2
    96
         * of SAX events once it has seen the end element for itself.
williamr@2
    97
         * @param aDelegate:    the fragment to start handling the SAX events.
williamr@2
    98
         */
williamr@2
    99
        virtual void DelegateParsingL(MSenFragment& aDelegate) = 0;
williamr@2
   100
williamr@2
   101
        /**
williamr@2
   102
         * Creates a new fragment and lets the created MSenFragment handle 
williamr@2
   103
         * the following SAX events.
williamr@2
   104
         * This fragment is made the owner of the delegate and
williamr@2
   105
         * the delegate is expected to make this MSenFragment the receiver
williamr@2
   106
         * of SAX events once it has seen the end element for itself.
williamr@2
   107
         * @param aNsUri:       the namespace URI of the new delegate
williamr@2
   108
         * @param aLocalName:   the local name of the new delegate
williamr@2
   109
         * @param aQName:       the qualified name of the new delegate
williamr@2
   110
         * @param aAttrs:       the attributes which to be set for the new delegate
williamr@2
   111
         */
williamr@2
   112
        virtual void DelegateParsingL(const TDesC8& aNsUri,
williamr@2
   113
                                      const TDesC8& aLocalName,
williamr@2
   114
                                      const TDesC8& aQName,
williamr@2
   115
                                      const RAttributeArray& aAttrs) = 0;
williamr@2
   116
williamr@2
   117
        /**
williamr@2
   118
         * Sets the reader for this fragment and sets this to be the 
williamr@2
   119
         * content handler of the following SAX events.
williamr@2
   120
         * @param aReader:  Reader to be used.
williamr@2
   121
         */
williamr@2
   122
        virtual void ParseWithL(CSenXmlReader& aReader) = 0;
williamr@2
   123
williamr@2
   124
        /**
williamr@2
   125
         * Sets a new parent for this fragment.
williamr@2
   126
         * @param aFragment:    the new parent.
williamr@2
   127
         */
williamr@2
   128
        virtual void SetOwner(MSenFragment& aFragment) = 0;
williamr@2
   129
williamr@2
   130
        /**
williamr@2
   131
         * Resumes the parsing. Usually called by the delegate fragment which was
williamr@2
   132
         * parsing itself after DelegateParsingL().
williamr@2
   133
         * @param aNsUri        The namespace URI of the current element
williamr@2
   134
         * @param aLocalName    The local name of the current element
williamr@2
   135
         * @param aQName        The qualified name of the current element
williamr@2
   136
         */
williamr@2
   137
        virtual void ResumeParsingFromL(const TDesC8& aNsUri,
williamr@2
   138
                                        const TDesC8& aLocalName,
williamr@2
   139
                                        const TDesC8& aQName) = 0;
williamr@2
   140
williamr@2
   141
        /**
williamr@2
   142
         * Sets the attributes for the fragment.
williamr@2
   143
         * @param aAttrs:   the array of attributes.
williamr@2
   144
         */
williamr@2
   145
        virtual void SetAttributesL(const RAttributeArray& aAttrs) = 0;
williamr@2
   146
williamr@2
   147
        /**
williamr@2
   148
         * Writes the start element tag to the content stream. 
williamr@2
   149
         * Derivants can override the basic usage used in BaseFragment.
williamr@2
   150
         * @param aNsUri        The namespace URI of the current element
williamr@2
   151
         * @param aLocalName    The local name of the current element
williamr@2
   152
         * @param aQName        The qualified name of the current element
williamr@2
   153
         * @param aAttrs:       the array of attributes.
williamr@2
   154
         */
williamr@2
   155
        virtual void WriteStartElementL(const TDesC8& aNsUri,
williamr@2
   156
                                        const TDesC8& aLocalName,
williamr@2
   157
                                        const TDesC8& aQName,
williamr@2
   158
                                        const RAttributeArray& aAttrs) = 0;
williamr@2
   159
williamr@2
   160
        /**
williamr@2
   161
         * Writes the end element tag to the content stream. 
williamr@2
   162
         * Derivants can override the basic usage used in BaseFragment.
williamr@2
   163
         * @param aNsUri        The namespace URI of the current element
williamr@2
   164
         * @param aLocalName    The local name of the current element
williamr@2
   165
         * @param aQName        The qualified name of the current element
williamr@2
   166
         */
williamr@2
   167
        virtual void WriteEndElementL(const TDesC8& aNsUri,
williamr@2
   168
                                      const TDesC8& aLocalName,
williamr@2
   169
                                      const TDesC8& aQName) = 0;
williamr@2
   170
williamr@2
   171
        /**
williamr@2
   172
        * Getter for Fragment's local name.
williamr@2
   173
        * @return Localname or KNullDesC if not set.
williamr@2
   174
        */
williamr@2
   175
        virtual const TDesC8& LocalName() const = 0;
williamr@2
   176
williamr@2
   177
        /**
williamr@2
   178
        * Getter for Fragment's namespace URI.
williamr@2
   179
        * @return Namespace URI or KNullDesC if not set.
williamr@2
   180
        */
williamr@2
   181
        virtual const TDesC8& NsUri() const = 0;
williamr@2
   182
williamr@2
   183
        /**
williamr@2
   184
         * Getter for namespace prefix of this fragment.
williamr@2
   185
         * @return namespace prefix or KNullDesC if not set.
williamr@2
   186
         */
williamr@2
   187
        virtual const TDesC8& NsPrefix() const = 0;
williamr@2
   188
williamr@2
   189
        /**
williamr@2
   190
         * Fragment writes itself to a write stream using UTF-8 charset encoding.
williamr@2
   191
         * @param aWriteStream: The stream to write to.
williamr@2
   192
         */
williamr@2
   193
        virtual void WriteAsXMLToL(RWriteStream& aWriteStream) = 0;
williamr@2
   194
williamr@2
   195
        /**
williamr@2
   196
         * Gets the fragment as an unicode XML buffer. 
williamr@2
   197
         * Buffer will contain all the childs etc.
williamr@2
   198
         * @return  fragment as XML. Caller takes ownership.
williamr@2
   199
         */
williamr@2
   200
        virtual HBufC* AsXmlUnicodeL() = 0;
williamr@2
   201
williamr@2
   202
        /**
williamr@2
   203
         * Gets the fragment as an XML buffer.
williamr@2
   204
         * @return  fragment as XML. Caller takes ownership.
williamr@2
   205
         */
williamr@2
   206
        virtual HBufC8* AsXmlL() = 0;
williamr@2
   207
williamr@2
   208
        /**
williamr@2
   209
         * Getter for the content. Returns content namespaces if there are any.
williamr@2
   210
         * @return Content.
williamr@2
   211
         */
williamr@2
   212
        virtual TPtrC8 Content() = 0;
williamr@2
   213
williamr@2
   214
        /**
williamr@2
   215
         * Checks if fragment matches to another fragment 
williamr@2
   216
         * by its content and child elements. 
williamr@2
   217
         * Fragment can contain more data than the given candidate.
williamr@2
   218
         * @since Series60 3.0
williamr@2
   219
         * @param aCandidate    The pattern to be matched. Must contain same or 
williamr@2
   220
         *                      less data for match to come true.
williamr@2
   221
         * @return ETrue if content and possible children match exactly 
williamr@2
   222
         *          to given pattern. EFalse otherwise.
williamr@2
   223
         */
williamr@2
   224
        virtual TBool ConsistsOfL(MSenFragment& aCandidate) = 0;
williamr@2
   225
    };
williamr@2
   226
williamr@2
   227
#endif // SEN_FRAGMENT_H
williamr@2
   228
williamr@2
   229
// End of File
williamr@2
   230
williamr@2
   231