|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 |
|
22 #include "xqservicelog.h" |
|
23 |
|
24 #include "xqsfwinterface_p.h" |
|
25 |
|
26 QT_BEGIN_NAMESPACE |
|
27 /*! |
|
28 \class SFWInterface |
|
29 |
|
30 SFWInterface class is used by service metadata parser to keep interface related information (interface name and description) |
|
31 from service XML registry file\n |
|
32 */ |
|
33 |
|
34 |
|
35 /*! |
|
36 * Class constructor |
|
37 * |
|
38 * @param anInterfaceName interface name |
|
39 */ |
|
40 SFWInterface::SFWInterface(const QString& anInterfaceName) |
|
41 { |
|
42 XQSERVICE_DEBUG_PRINT("SFWInterface::SFWInterface(1)"); |
|
43 XQSERVICE_DEBUG_PRINT("anInterfaceName: %s", qPrintable(anInterfaceName)); |
|
44 interfaceName = anInterfaceName; |
|
45 } |
|
46 |
|
47 /*! |
|
48 Creates a copy of \a other. |
|
49 */ |
|
50 SFWInterface::SFWInterface(const SFWInterface& other) |
|
51 { |
|
52 XQSERVICE_DEBUG_PRINT("SFWInterface::SFWInterface(2)"); |
|
53 (*this) = other; //use assignment operator |
|
54 |
|
55 } |
|
56 |
|
57 /* |
|
58 Copies the content of the SFWInterface object \a other |
|
59 into this one. |
|
60 */ |
|
61 SFWInterface& SFWInterface::operator=(const SFWInterface&other) |
|
62 { |
|
63 XQSERVICE_DEBUG_PRINT("SFWInterface::operator="); |
|
64 interfaceName = other.interfaceName; |
|
65 serviceName = other.serviceName; |
|
66 interfaceDescription = other.interfaceDescription; |
|
67 interfaceCapabilities = other.interfaceCapabilities; |
|
68 interfaceVersion = other.interfaceVersion; |
|
69 |
|
70 return *this; |
|
71 } |
|
72 |
|
73 |
|
74 /*! |
|
75 * Class destructor |
|
76 */ |
|
77 SFWInterface::~SFWInterface() |
|
78 { |
|
79 XQSERVICE_DEBUG_PRINT("SFWInterface::~SFWInterface"); |
|
80 } |
|
81 |
|
82 /*! |
|
83 * Gets the interface name |
|
84 * |
|
85 * @return interface name or default value (empty string) if it is not available |
|
86 */ |
|
87 QString SFWInterface::name() const |
|
88 { |
|
89 XQSERVICE_DEBUG_PRINT("SFWInterface::name"); |
|
90 XQSERVICE_DEBUG_PRINT("interfaceName: %s", qPrintable(interfaceName)); |
|
91 return interfaceName; |
|
92 } |
|
93 |
|
94 /*! |
|
95 * Gets the interface description |
|
96 * |
|
97 * @return interface description or default value (empty string) if it is not available |
|
98 */ |
|
99 QString SFWInterface::description() const |
|
100 { |
|
101 XQSERVICE_DEBUG_PRINT("SFWInterface::description"); |
|
102 XQSERVICE_DEBUG_PRINT("interfaceDescription: %s", qPrintable(interfaceDescription)); |
|
103 return interfaceDescription; |
|
104 } |
|
105 |
|
106 |
|
107 /*! |
|
108 * Sets the interface description |
|
109 * |
|
110 * @param aDescription |
|
111 */ |
|
112 void SFWInterface::setDescription(const QString& aDescription) |
|
113 { |
|
114 XQSERVICE_DEBUG_PRINT("SFWInterface::setDescription"); |
|
115 XQSERVICE_DEBUG_PRINT("aDescription: %s", qPrintable(aDescription)); |
|
116 interfaceDescription = aDescription; |
|
117 } |
|
118 |
|
119 /*! |
|
120 Returns the list of capabilities required by this interface. |
|
121 */ |
|
122 QStringList SFWInterface::capabilities() const |
|
123 { |
|
124 XQSERVICE_DEBUG_PRINT("SFWInterface::capabilities"); |
|
125 for (int i = 0; i < interfaceCapabilities.size(); ++i){ |
|
126 XQSERVICE_DEBUG_PRINT("capability: %s", qPrintable(interfaceCapabilities.at(i))); |
|
127 } |
|
128 return interfaceCapabilities; |
|
129 } |
|
130 |
|
131 /*! |
|
132 Sets the interface \a apabilites. |
|
133 */ |
|
134 void SFWInterface::setCapabilities(const QList<QString>& capabilities) |
|
135 { |
|
136 XQSERVICE_DEBUG_PRINT("SFWInterface::setCapabilities"); |
|
137 for (int i = 0; i < capabilities.size(); ++i){ |
|
138 XQSERVICE_DEBUG_PRINT("capability: %s", qPrintable(capabilities.at(i))); |
|
139 } |
|
140 interfaceCapabilities = capabilities; |
|
141 } |
|
142 |
|
143 /*! |
|
144 Returns the version tag of the interface. |
|
145 */ |
|
146 QString SFWInterface::version() const |
|
147 { |
|
148 XQSERVICE_DEBUG_PRINT("SFWInterface::version"); |
|
149 XQSERVICE_DEBUG_PRINT("interfaceVersion: %s", qPrintable(interfaceVersion)); |
|
150 return interfaceVersion; |
|
151 } |
|
152 |
|
153 /*! |
|
154 Sets the version tag of this interface to \a version. |
|
155 */ |
|
156 void SFWInterface::setVersion(const QString& version) |
|
157 { |
|
158 XQSERVICE_DEBUG_PRINT("SFWInterface::setVersion(1)"); |
|
159 XQSERVICE_DEBUG_PRINT("version: %s", qPrintable(version)); |
|
160 interfaceVersion = version; |
|
161 } |
|
162 |
|
163 /*! |
|
164 Sets the version tag of this interface based on \a maj and \a min. |
|
165 */ |
|
166 void SFWInterface::setVersion(int maj, int min) |
|
167 { |
|
168 XQSERVICE_DEBUG_PRINT("SFWInterface::setVersion(2)"); |
|
169 XQSERVICE_DEBUG_PRINT("maj: %d, min: %d", maj, min); |
|
170 interfaceVersion = QString::number(maj) + "." + QString::number(min); |
|
171 } |
|
172 |
|
173 /*! |
|
174 Returns the service associated with this interface. |
|
175 */ |
|
176 QString SFWInterface::service() const |
|
177 { |
|
178 XQSERVICE_DEBUG_PRINT("SFWInterface::service"); |
|
179 XQSERVICE_DEBUG_PRINT("serviceName: %s", qPrintable(serviceName)); |
|
180 return serviceName; |
|
181 } |
|
182 |
|
183 /*! |
|
184 Sets the service name associated with this interface |
|
185 */ |
|
186 void SFWInterface::setService(const QString &service) |
|
187 { |
|
188 XQSERVICE_DEBUG_PRINT("SFWInterface::setService"); |
|
189 XQSERVICE_DEBUG_PRINT("service: %s", qPrintable(service)); |
|
190 serviceName = service; |
|
191 } |
|
192 QT_END_NAMESPACE |