| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2018 The Qt Company Ltd and/or its subsidiary(-ies). |
| 4 | ** Contact: http://www.qt-project.org/legal |
| 5 | ** |
| 6 | ** This file is part of the QtSystems module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "qservicerequest_p.h" |
| 41 | |
| 42 | // Default constructor - required by meta-type system - note that we could just |
| 43 | // fall back on the one automatically created by the compiler but let's be |
| 44 | // explicit so no mistakes are made - eg, does m_reply get set to zero? |
| 45 | QServiceRequest::QServiceRequest() |
| 46 | : m_reply(0), m_scope(QService::UserScope), m_type(DefaultInterfaceRequest) |
| 47 | { |
| 48 | // nothing to do here |
| 49 | } |
| 50 | |
| 51 | QServiceRequest::QServiceRequest(const QString &interfaceName) |
| 52 | : m_interfaceName(interfaceName), |
| 53 | m_reply(0), |
| 54 | m_scope(QService::UserScope), |
| 55 | m_type(DefaultInterfaceRequest) |
| 56 | { |
| 57 | // nothing to do here |
| 58 | } |
| 59 | |
| 60 | QServiceRequest::QServiceRequest(const QServiceInterfaceDescriptor &descriptor) |
| 61 | : m_descriptor(descriptor), |
| 62 | m_reply(0), |
| 63 | m_scope(QService::UserScope), |
| 64 | m_type(DescriptorRequest) |
| 65 | { |
| 66 | // nothing to do here |
| 67 | } |
| 68 | |
| 69 | // copy constructor - required by meta-type system - again let's be explicit |
| 70 | QServiceRequest::QServiceRequest(const QServiceRequest &other) |
| 71 | : m_interfaceName(other.m_interfaceName), |
| 72 | m_descriptor(other.m_descriptor), |
| 73 | m_reply(other.m_reply), |
| 74 | m_scope(other.m_scope), |
| 75 | m_type(other.m_type) |
| 76 | { |
| 77 | } |
| 78 | |
| 79 | // public destructor - required by meta-type system |
| 80 | QServiceRequest::~QServiceRequest() |
| 81 | { |
| 82 | // nothing to do here |
| 83 | } |
| 84 | |
| 85 | // assignment operator - not needed by meta-type but handy anyway |
| 86 | QServiceRequest & QServiceRequest::operator=(const QServiceRequest &rhs) |
| 87 | { |
| 88 | if (&rhs == this) |
| 89 | return *this; |
| 90 | |
| 91 | m_interfaceName = rhs.m_interfaceName; |
| 92 | m_descriptor = rhs.m_descriptor; |
| 93 | m_reply = rhs.m_reply; |
| 94 | m_type = rhs.m_type; |
| 95 | m_scope = rhs.m_scope; |
| 96 | return *this; |
| 97 | } |
| 98 | |
| 99 | QServiceInterfaceDescriptor QServiceRequest::descriptor() const |
| 100 | { |
| 101 | return m_descriptor; |
| 102 | } |
| 103 | |
| 104 | void QServiceRequest::setDescriptor(const QServiceInterfaceDescriptor &descriptor) |
| 105 | { |
| 106 | m_type = DescriptorRequest; |
| 107 | m_descriptor = descriptor; |
| 108 | } |
| 109 | |
| 110 | void QServiceRequest::setInterfaceName(const QString &interfaceName) |
| 111 | { |
| 112 | m_type = DefaultInterfaceRequest; |
| 113 | m_interfaceName = interfaceName; |
| 114 | } |
| 115 | |
| 116 | QString QServiceRequest::interfaceName() const |
| 117 | { |
| 118 | return m_interfaceName; |
| 119 | } |
| 120 | |
| 121 | QServiceReply *QServiceRequest::reply() const |
| 122 | { |
| 123 | return m_reply; |
| 124 | } |
| 125 | |
| 126 | void QServiceRequest::setReply(QServiceReply *reply) |
| 127 | { |
| 128 | m_reply = reply; |
| 129 | } |
| 130 | |
| 131 | QService::Scope QServiceRequest::scope() const |
| 132 | { |
| 133 | return m_scope; |
| 134 | } |
| 135 | |
| 136 | void QServiceRequest::setScope(QService::Scope scope) |
| 137 | { |
| 138 | m_scope = scope; |
| 139 | } |
| 140 | |
| 141 | QServiceRequest::Request QServiceRequest::requestType() const |
| 142 | { |
| 143 | return m_type; |
| 144 | } |