summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2013-06-19 12:26:48 +0200
committerAlex <alexander.blasche@digia.com>2013-06-20 11:21:58 +0200
commit68c4041d39658fe615cc4366e52ba8a439aae66f (patch)
tree33ca553b1af123a9175d7f36055acd90f861d7d2
parentc11663a36b4baceb0af9bd87c6c1df76d69d72ca (diff)
Improve/Fix QtNFC documentation
Fix qdoc warnings, snippet imports and proper documentation versioning Change-Id: Id1799ec67bf0fe6fe44c16b1ca314d8db8892bb1 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
-rw-r--r--src/imports/nfc/qdeclarativendeffilter.cpp2
-rw-r--r--src/imports/nfc/qdeclarativendefmimerecord_p.h4
-rw-r--r--src/imports/nfc/qdeclarativendeftextrecord_p.h4
-rw-r--r--src/imports/nfc/qdeclarativendefurirecord_p.h4
-rw-r--r--src/imports/nfc/qdeclarativenearfield_p.h2
-rw-r--r--src/nfc/doc/qtnfc.qdocconf11
-rw-r--r--src/nfc/doc/snippets/doc_src_qtnfc.pro86
-rw-r--r--src/nfc/doc/snippets/doc_src_qtnfc.qml1
-rw-r--r--src/nfc/doc/snippets/foorecord.cpp114
-rw-r--r--src/nfc/doc/snippets/foorecord.h68
-rw-r--r--src/nfc/doc/snippets/main.cpp45
-rw-r--r--src/nfc/doc/snippets/nfc.cpp73
-rw-r--r--src/nfc/qdeclarativendefrecord.cpp4
-rw-r--r--src/nfc/qndefmessage.h4
-rw-r--r--src/nfc/qndefnfctextrecord.cpp12
-rw-r--r--src/nfc/qndefnfctextrecord.h9
-rw-r--r--src/nfc/qndefnfcurirecord.cpp11
-rw-r--r--src/nfc/qndefnfcurirecord.h9
-rw-r--r--src/nfc/qndefrecord.cpp4
-rw-r--r--src/nfc/qnearfieldtagtype3.h4
-rw-r--r--src/nfc/qnearfieldtagtype4.h4
21 files changed, 425 insertions, 50 deletions
diff --git a/src/imports/nfc/qdeclarativendeffilter.cpp b/src/imports/nfc/qdeclarativendeffilter.cpp
index fe526e07..d028dcb3 100644
--- a/src/imports/nfc/qdeclarativendeffilter.cpp
+++ b/src/imports/nfc/qdeclarativendeffilter.cpp
@@ -75,7 +75,7 @@
This property holds the NDEF record type that the filter matches. This property must be set to
the fully qualified record type, i.e. including the NIS and NSS prefixes. For example set to
- \li {urn:nfc:wkt:U} to match NFC RTD-URI records.
+ \c {urn:nfc:wkt:U} to match NFC RTD-URI records.
*/
/*!
diff --git a/src/imports/nfc/qdeclarativendefmimerecord_p.h b/src/imports/nfc/qdeclarativendefmimerecord_p.h
index 6f58f0a5..be656749 100644
--- a/src/imports/nfc/qdeclarativendefmimerecord_p.h
+++ b/src/imports/nfc/qdeclarativendefmimerecord_p.h
@@ -46,6 +46,10 @@
QT_USE_NAMESPACE_NFC
+#ifdef Q_QDOC
+// workaround for qdoc parsing error in namespaced classes (see QTBUG-31851)
+class ForcePrivateForQDoc;
+#endif
class QDeclarativeNdefMimeRecord : public QDeclarativeNdefRecord
{
Q_OBJECT
diff --git a/src/imports/nfc/qdeclarativendeftextrecord_p.h b/src/imports/nfc/qdeclarativendeftextrecord_p.h
index 2b1b1cde..c1f77096 100644
--- a/src/imports/nfc/qdeclarativendeftextrecord_p.h
+++ b/src/imports/nfc/qdeclarativendeftextrecord_p.h
@@ -48,6 +48,10 @@
QT_USE_NAMESPACE_NFC
+#ifdef Q_QDOC
+// workaround for qdoc parsing error in namespaced classes (see QTBUG-31851)
+class ForcePrivateForQDoc;
+#endif
class QDeclarativeNdefTextRecord : public QDeclarativeNdefRecord
{
Q_OBJECT
diff --git a/src/imports/nfc/qdeclarativendefurirecord_p.h b/src/imports/nfc/qdeclarativendefurirecord_p.h
index 436ce266..7db6296a 100644
--- a/src/imports/nfc/qdeclarativendefurirecord_p.h
+++ b/src/imports/nfc/qdeclarativendefurirecord_p.h
@@ -50,6 +50,10 @@
QT_USE_NAMESPACE_NFC
+#ifdef Q_QDOC
+// workaround for qdoc parsing error in namespaced classes (see QTBUG-31851)
+class ForcePrivateForQDoc;
+#endif
class QDeclarativeNdefUriRecord : public QDeclarativeNdefRecord
{
Q_OBJECT
diff --git a/src/imports/nfc/qdeclarativenearfield_p.h b/src/imports/nfc/qdeclarativenearfield_p.h
index 3d19decc..c1f168f8 100644
--- a/src/imports/nfc/qdeclarativenearfield_p.h
+++ b/src/imports/nfc/qdeclarativenearfield_p.h
@@ -49,10 +49,10 @@
#include "qdeclarativendefrecord.h"
-class QDeclarativeNdefFilter;
QT_USE_NAMESPACE_NFC
+class QDeclarativeNdefFilter;
class QDeclarativeNearField : public QObject, public QQmlParserStatus
{
Q_OBJECT
diff --git a/src/nfc/doc/qtnfc.qdocconf b/src/nfc/doc/qtnfc.qdocconf
index 188ef92b..05f10278 100644
--- a/src/nfc/doc/qtnfc.qdocconf
+++ b/src/nfc/doc/qtnfc.qdocconf
@@ -2,21 +2,22 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtNfc
description = Qt NFC Reference Documentation
-version = 5.0.0
+url = http://qt-project.org/doc/qt-$QT_VER/qtnfc
+version = $QT_VERSION
examplesinstallpath = nfc
qhp.projects = QtNfc
qhp.QtNfc.file = qtnfc.qhp
-qhp.QtNfc.namespace = org.qt-project.qtnfc.500
+qhp.QtNfc.namespace = org.qt-project.qtnfc.$QT_VERSION_TAG
qhp.QtNfc.virtualFolder = qtnfc
qhp.QtNfc.indexTitle = Qt NFC
qhp.QtNfc.indexRoot =
-qhp.QtNfc.filterAttributes = qtnfc 5.0.0 qtrefdoc
-qhp.QtNfc.customFilters.Qt.name = QtNfc 5.0.0
-qhp.QtNfc.customFilters.Qt.filterAttributes = qtnfc 5.0.0
+qhp.QtNfc.filterAttributes = qtnfc $QT_VERSION qtrefdoc
+qhp.QtNfc.customFilters.Qt.name = QtNfc $QT_VERSION
+qhp.QtNfc.customFilters.Qt.filterAttributes = qtnfc $QT_VERSION
qhp.QtNfc.subprojects = overviews classes qml examples
qhp.QtNfc.subprojects.classes.title = C++ Classes
qhp.QtNfc.subprojects.classes.indexTitle = Qt NFC C++ Classes
diff --git a/src/nfc/doc/snippets/doc_src_qtnfc.pro b/src/nfc/doc/snippets/doc_src_qtnfc.pro
index 03a552a6..5730e227 100644
--- a/src/nfc/doc/snippets/doc_src_qtnfc.pro
+++ b/src/nfc/doc/snippets/doc_src_qtnfc.pro
@@ -1,43 +1,51 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Aaron McCarthy <mccarthy.aaron@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+#****************************************************************************
+#*
+#* Copyright (C) 2013 Aaron McCarthy <mccarthy.aaron@gmail.com>
+#* Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+#* Contact: http://www.qt-project.org/legal
+#*
+#* This file is part of the documentation of the Qt Toolkit.
+#*
+#* $QT_BEGIN_LICENSE:BSD$
+#* You may use this file under the terms of the BSD license as follows:
+#*
+#* "Redistribution and use in source and binary forms, with or without
+#* modification, are permitted provided that the following conditions are
+#* met:
+#* * Redistributions of source code must retain the above copyright
+#* notice, this list of conditions and the following disclaimer.
+#* * Redistributions in binary form must reproduce the above copyright
+#* notice, this list of conditions and the following disclaimer in
+#* the documentation and/or other materials provided with the
+#* distribution.
+#* * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+#* of its contributors may be used to endorse or promote products derived
+#* from this software without specific prior written permission.
+#*
+#*
+#* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#*
+#* $QT_END_LICENSE$
+#*
+#***************************************************************************/
#! [project modification]
QT += nfc
#! [project modification]
+
+SOURCES += main.cpp \
+ doc_src_qtnfc.cpp \
+ nfc.cpp \
+ foorecord.cpp
+
+HEADERS += foorecord.h
diff --git a/src/nfc/doc/snippets/doc_src_qtnfc.qml b/src/nfc/doc/snippets/doc_src_qtnfc.qml
index 2cf2488a..867004f6 100644
--- a/src/nfc/doc/snippets/doc_src_qtnfc.qml
+++ b/src/nfc/doc/snippets/doc_src_qtnfc.qml
@@ -42,3 +42,4 @@
import QtNfc 5.0
//! [import]
+Item { }
diff --git a/src/nfc/doc/snippets/foorecord.cpp b/src/nfc/doc/snippets/foorecord.cpp
new file mode 100644
index 00000000..be0a6f89
--- /dev/null
+++ b/src/nfc/doc/snippets/foorecord.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "foorecord.h"
+#include <qndefrecord.h>
+
+//! [Declare foo record]
+Q_DECLARE_NDEFRECORD(QDeclarativeNdefFooRecord, QNdefRecord::ExternalRtd, "com.example:f")
+//! [Declare foo record]
+
+//! [createFooRecord]
+static inline QNdefRecord createFooRecord()
+{
+ QNdefRecord foo;
+ foo.setTypeNameFormat(QNdefRecord::ExternalRtd);
+ foo.setType("com.example:f");
+ foo.setPayload(QByteArray(sizeof(int), char(0)));
+ return foo;
+}
+//! [createFooRecord]
+
+//! [copyFooRecord]
+static inline QNdefRecord copyFooRecord(const QNdefRecord &record)
+{
+ if (record.typeNameFormat() != QNdefRecord::ExternalRtd)
+ return createFooRecord();
+ if (record.type() != "com.example:f")
+ return createFooRecord();
+
+ return record;
+}
+//! [copyFooRecord]
+
+//! [Constructors]
+QDeclarativeNdefFooRecord::QDeclarativeNdefFooRecord(QObject *parent)
+: QDeclarativeNdefRecord(createFooRecord(), parent)
+{
+}
+
+QDeclarativeNdefFooRecord::QDeclarativeNdefFooRecord(const QNdefRecord &record, QObject *parent)
+: QDeclarativeNdefRecord(copyFooRecord(record), parent)
+{
+}
+//! [Constructors]
+
+QDeclarativeNdefFooRecord::~QDeclarativeNdefFooRecord()
+{
+}
+
+int QDeclarativeNdefFooRecord::foo() const
+{
+ QByteArray payload = record().payload();
+
+ int value = payload.at(0) << 24 |
+ payload.at(1) << 16 |
+ payload.at(2) << 8 |
+ payload.at(3) << 0;
+
+ return value;
+}
+
+void QDeclarativeNdefFooRecord::setFoo(int value)
+{
+ if (foo() == value)
+ return;
+
+ QByteArray payload;
+ payload[0] = (value >> 24) & 0xff;
+ payload[1] = (value >> 16) & 0xff;
+ payload[2] = (value >> 8) & 0xff;
+ payload[3] = (value >> 0) & 0xff;
+
+ QNdefRecord r = record();
+ r.setPayload(payload);
+ setRecord(r);
+ emit fooChanged();
+}
diff --git a/src/nfc/doc/snippets/foorecord.h b/src/nfc/doc/snippets/foorecord.h
new file mode 100644
index 00000000..ab5f439d
--- /dev/null
+++ b/src/nfc/doc/snippets/foorecord.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FOORECORD_H
+#define FOORECORD_H
+
+#include <qdeclarativendefrecord.h>
+
+QT_USE_NAMESPACE_NFC
+
+//! [Foo declaration]
+class QDeclarativeNdefFooRecord : public QDeclarativeNdefRecord
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int foo READ foo WRITE setFoo NOTIFY fooChanged)
+
+public:
+ explicit QDeclarativeNdefFooRecord(QObject *parent = 0);
+ Q_INVOKABLE QDeclarativeNdefFooRecord(const QNdefRecord &record, QObject *parent = 0);
+ ~QDeclarativeNdefFooRecord();
+
+ int foo() const;
+ void setFoo(int value);
+
+signals:
+ void fooChanged();
+};
+//! [Foo declaration]
+
+#endif // FOORECORD_H
diff --git a/src/nfc/doc/snippets/main.cpp b/src/nfc/doc/snippets/main.cpp
new file mode 100644
index 00000000..5c08502c
--- /dev/null
+++ b/src/nfc/doc/snippets/main.cpp
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+int main(int /*argc*/, char ** /*argv*/)
+{
+ return 0;
+}
+
diff --git a/src/nfc/doc/snippets/nfc.cpp b/src/nfc/doc/snippets/nfc.cpp
new file mode 100644
index 00000000..2091ad08
--- /dev/null
+++ b/src/nfc/doc/snippets/nfc.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtNfc/qndefrecord.h>
+#include <QtNfc/qndefnfctextrecord.h>
+
+#include <QtCore/QDebug>
+
+QT_USE_NAMESPACE_NFC
+
+void snippet_recordConversion()
+{
+ QNdefRecord record;
+
+ //! [Record conversion]
+ if (record.isRecordType<QNdefNfcTextRecord>()) {
+ QNdefNfcTextRecord textRecord(record);
+
+ qDebug() << textRecord.text();
+ }
+ //! [Record conversion]
+}
+
+//! [Specialized class definition]
+class ExampleComF : public QNdefRecord
+{
+public:
+ Q_DECLARE_NDEF_RECORD(ExampleComF, QNdefRecord::ExternalRtd, "example.com:f",
+ QByteArray(sizeof(int), char(0)))
+
+ int foo() const;
+ void setFoo(int v);
+};
+
+Q_DECLARE_ISRECORDTYPE_FOR_NDEF_RECORD(ExampleComF, QNdefRecord::ExternalRtd, "example.com:f")
+//! [Specialized class definition]
diff --git a/src/nfc/qdeclarativendefrecord.cpp b/src/nfc/qdeclarativendefrecord.cpp
index fbe5b02b..11054057 100644
--- a/src/nfc/qdeclarativendefrecord.cpp
+++ b/src/nfc/qdeclarativendefrecord.cpp
@@ -71,11 +71,11 @@ QT_BEGIN_NAMESPACE_NFC
For example the declaration of such a class may look like the following.
- \snippet ../doc/src/snippets/foorecord.h Foo declaration
+ \snippet foorecord.h Foo declaration
Within the implementation file the Q_DECLARE_NDEFRECORD() macro is expanded:
- \snippet ../doc/src/snippets/foorecord.cpp Declare foo record
+ \snippet foorecord.cpp Declare foo record
Finially the application or plugin code calls qmlRegisterType():
diff --git a/src/nfc/qndefmessage.h b/src/nfc/qndefmessage.h
index 133469a1..975ed9af 100644
--- a/src/nfc/qndefmessage.h
+++ b/src/nfc/qndefmessage.h
@@ -51,6 +51,10 @@
QT_BEGIN_NAMESPACE_NFC
+#ifdef Q_QDOC
+// workaround for qdoc parsing error in namespaced classes (see QTBUG-31851)
+class ForcePrivateForQDoc;
+#endif
class Q_NFC_EXPORT QNdefMessage : public QList<QNdefRecord>
{
public:
diff --git a/src/nfc/qndefnfctextrecord.cpp b/src/nfc/qndefnfctextrecord.cpp
index 6f213cf4..aef5b22e 100644
--- a/src/nfc/qndefnfctextrecord.cpp
+++ b/src/nfc/qndefnfctextrecord.cpp
@@ -66,6 +66,18 @@ QT_BEGIN_NAMESPACE_NFC
*/
/*!
+ \fn QNdefNfcTextRecord::QNdefNfcTextRecord()
+
+ Constructs an empty NFC text record of type \l QNdefRecord::NfcRtd.
+*/
+
+/*!
+ \fn QNdefNfcTextRecord::QNdefNfcTextRecord(const QNdefRecord& other)
+
+ Constructs a new NFC text record that is a copy of \a other.
+*/
+
+/*!
Returns the locale of the text record.
*/
QString QNdefNfcTextRecord::locale() const
diff --git a/src/nfc/qndefnfctextrecord.h b/src/nfc/qndefnfctextrecord.h
index 5fe593ba..b56c0cff 100644
--- a/src/nfc/qndefnfctextrecord.h
+++ b/src/nfc/qndefnfctextrecord.h
@@ -47,10 +47,19 @@
QT_BEGIN_NAMESPACE_NFC
+#ifdef Q_QDOC
+// workaround for qdoc parsing error in namespaced classes (see QTBUG-31851)
+class ForcePrivateForQDoc;
+#endif
class Q_NFC_EXPORT QNdefNfcTextRecord : public QNdefRecord
{
public:
+#ifndef Q_QDOC
Q_DECLARE_NDEF_RECORD(QNdefNfcTextRecord, QNdefRecord::NfcRtd, "T", QByteArray(1, char(0)))
+#else
+ QNdefNfcTextRecord();
+ QNdefNfcTextRecord(const QNdefRecord& other);
+#endif
QString locale() const;
void setLocale(const QString &locale);
diff --git a/src/nfc/qndefnfcurirecord.cpp b/src/nfc/qndefnfcurirecord.cpp
index dbe9cd5a..07f49788 100644
--- a/src/nfc/qndefnfcurirecord.cpp
+++ b/src/nfc/qndefnfcurirecord.cpp
@@ -58,6 +58,17 @@ QT_BEGIN_NAMESPACE_NFC
RTD-URI encapsulates a URI.
*/
+/*!
+ \fn QNdefNfcUriRecord::QNdefNfcUriRecord()
+
+ Constructs an empty NFC uri record.
+*/
+
+/*!
+ \fn QNdefNfcUriRecord::QNdefNfcUriRecord(const QNdefRecord& other)
+
+ Constructs a new NFC uri record that is a copy of \a other.
+*/
static const char * const abbreviations[] = {
0,
"http://www.",
diff --git a/src/nfc/qndefnfcurirecord.h b/src/nfc/qndefnfcurirecord.h
index 8d852b35..d83967ca 100644
--- a/src/nfc/qndefnfcurirecord.h
+++ b/src/nfc/qndefnfcurirecord.h
@@ -49,10 +49,19 @@ QT_FORWARD_DECLARE_CLASS(QUrl)
QT_BEGIN_NAMESPACE_NFC
+#ifdef Q_QDOC
+// workaround for qdoc parsing error in namespaced classes (see QTBUG-31851)
+class ForcePrivateForQDoc;
+#endif
class Q_NFC_EXPORT QNdefNfcUriRecord : public QNdefRecord
{
public:
+#ifndef Q_QDOC
Q_DECLARE_NDEF_RECORD(QNdefNfcUriRecord, QNdefRecord::NfcRtd, "U", QByteArray(0, char(0)))
+#else
+ QNdefNfcUriRecord();
+ QNdefNfcUriRecord(const QNdefRecord& other);
+#endif
QUrl uri() const;
void setUri(const QUrl &uri);
diff --git a/src/nfc/qndefrecord.cpp b/src/nfc/qndefrecord.cpp
index 77dc71e9..3a56e17a 100644
--- a/src/nfc/qndefrecord.cpp
+++ b/src/nfc/qndefrecord.cpp
@@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE_NFC
to test if a conversion is possible. The following example shows how to test if a QNdefRecord
is an NFC RTD Text record and extract the text information from it.
- \snippet ../doc/src/snippets/nfc.cpp Record conversion
+ \snippet nfc.cpp Record conversion
\section1 Creating specialized NDEF record classes
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE_NFC
declaration of the hypothetical \e {example.com:f} record type that encapsulates a single int
property foo.
- \snippet ../doc/src/snippets/nfc.cpp Specialized class definition
+ \snippet nfc.cpp Specialized class definition
The developer only needs to provide implementations for the \c {foo()} and \c {setFoo()}
functions that parse and set the contents of the NDEF record's payload.
diff --git a/src/nfc/qnearfieldtagtype3.h b/src/nfc/qnearfieldtagtype3.h
index bc16610d..52ab7cf5 100644
--- a/src/nfc/qnearfieldtagtype3.h
+++ b/src/nfc/qnearfieldtagtype3.h
@@ -48,6 +48,10 @@
QT_BEGIN_NAMESPACE_NFC
+#ifdef Q_QDOC
+// workaround for qdoc parsing error in namespaced classes (see QTBUG-31851)
+class ForcePrivateForQDoc;
+#endif
class Q_NFC_EXPORT QNearFieldTagType3 : public QNearFieldTarget
{
Q_OBJECT
diff --git a/src/nfc/qnearfieldtagtype4.h b/src/nfc/qnearfieldtagtype4.h
index 57ce0e42..0522fdf9 100644
--- a/src/nfc/qnearfieldtagtype4.h
+++ b/src/nfc/qnearfieldtagtype4.h
@@ -46,6 +46,10 @@
QT_BEGIN_NAMESPACE_NFC
+#ifdef Q_QDOC
+// workaround for qdoc parsing error in namespaced classes (see QTBUG-31851)
+class ForcePrivateForQDoc;
+#endif
class Q_NFC_EXPORT QNearFieldTagType4 : public QNearFieldTarget
{
Q_OBJECT