Changeset 561 for trunk/doc/src/examples/qxmlstreambookmarks.qdoc
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/doc/src/examples/qxmlstreambookmarks.qdoc
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the documentation of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 52 52 \section1 XbelWriter Class Definition 53 53 54 The \c XbelWriter class is a subclass of QXmlStreamReader, which provides55 an XML parser with a streaming API. \c XbelWriter also contains a private56 instance of QTreeWidget in order to display the bookmarks according to57 hierarchies.54 The \c XbelWriter class contains a private instance of QXmlStreamWriter, 55 which provides an XML writer with a streaming API. \c XbelWriter also 56 has a reference to the QTreeWidget instance where the bookmark hierarchy 57 is stored. 58 58 59 59 \snippet examples/xml/streambookmarks/xbelwriter.h 0 … … 76 76 \snippet examples/xml/streambookmarks/xbelwriter.cpp 1 77 77 78 The \c writeItem() function accepts a QTreeWidget object and writes it78 The \c writeItem() function accepts a QTreeWidgetItem object and writes it 79 79 to the stream, depending on its \c tagName, which can either be a "folder", 80 80 "bookmark", or "separator". … … 84 84 \section1 XbelReader Class Definition 85 85 86 The \c XbelReader class is a subclass of QXmlStreamReader, the pendent 87 class for QXmlStreamWriter. \c XbelReader contains a private instance 88 of QTreeWidget to group bookmarks according to their hierarchies. 86 The \c XbelReader contains a private instance of QXmlStreamReader, the 87 companion class to QXmlStreamWriter. \c XbelReader also contains a 88 reference to the QTreeWidget that is used to group the bookmarks according 89 to their hierarchy. 89 90 90 91 \snippet examples/xml/streambookmarks/xbelreader.h 0 … … 103 104 104 105 The \c read() function accepts a QIODevice and sets it using 105 \l{QXmlStreamReader::setDevice()}{setDevice()}. The actual process 106 of reading only takes place if the file is a valid XBEL 1.0 file. 107 Note that the XML input needs to be well-formed to be accepted by 108 QXmlStreamReader. Otherwise, the \l{QXmlStreamReader::raiseError()} 109 {raiseError()} function is used to display an error message. 106 \l{QXmlStreamReader::}{setDevice()}. The actual process of reading only 107 takes place if the file is a valid XBEL 1.0 file. Note that the XML input 108 needs to be well-formed to be accepted by QXmlStreamReader. Otherwise, the 109 \l{QXmlStreamReader::}{raiseError()} function is used to display an error 110 message. Since the XBEL reader is only concerned with reading XML elements, 111 it makes extensive use of the \l{QXmlStreamReader::}{readNextStartElement()} 112 convenience function. 110 113 111 114 \snippet examples/xml/streambookmarks/xbelreader.cpp 1 112 115 113 The \c readUnknownElement() function reads an unknown element. The 114 Q_ASSERT() macro is used to provide a pre-condition for the function. 116 The \c errorString() function is used if an error occurred, in order to 117 obtain a description of the error complete with line and column number 118 information. 115 119 116 120 \snippet examples/xml/streambookmarks/xbelreader.cpp 2 … … 119 123 the appropriate function to read it, depending on whether if its a 120 124 "folder", "bookmark" or "separator". Otherwise, it calls 121 \c readUnknownElement(). 125 \l{QXmlStreamReader::}{skipCurrentElement()}. The Q_ASSERT() macro is used 126 to provide a pre-condition for the function. 122 127 123 128 \snippet examples/xml/streambookmarks/xbelreader.cpp 3 … … 128 133 129 134 The \c readSeparator() function creates a separator and sets its flags. 130 The text is set to 30 "0xB7", the HEX equivalent for period , and then131 read using \c readElementText().135 The text is set to 30 "0xB7", the HEX equivalent for period. The element 136 is then skipped using \l{QXmlStreamReader::}{skipCurrentElement()}. 132 137 133 138 \snippet examples/xml/streambookmarks/xbelreader.cpp 5
Note:
See TracChangeset
for help on using the changeset viewer.