summaryrefslogtreecommitdiffstats
path: root/src/nfc/doc
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 /src/nfc/doc
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>
Diffstat (limited to 'src/nfc/doc')
-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
7 files changed, 354 insertions, 44 deletions
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]