KD SOAP
 All Classes Functions Enumerations Enumerator Pages
KDSoapNamespacePrefixes_p.h
1 /****************************************************************************
2 ** Copyright (C) 2010-2013 Klaralvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Soap library.
5 **
6 ** Licensees holding valid commercial KD Soap licenses may use this file in
7 ** accordance with the KD Soap Commercial License Agreement provided with
8 ** the Software.
9 **
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU Lesser General Public License version 2 and version 3 as published by the
13 ** Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** Contact info@kdab.com if any conditions of this licensing are not
19 ** clear to you.
20 **
21 **********************************************************************/
22 #ifndef KDSOAPNAMESPACESPREFIXES_H
23 #define KDSOAPNAMESPACESPREFIXES_H
24 
25 #include <QtCore/QMap>
26 #include <QtCore/QXmlStreamWriter>
27 
28 #include "KDSoapClientInterface.h"
29 
30 class KDSoapNamespacePrefixes : public QMap<QString /*ns*/, QString /*prefix*/>
31 {
32 public:
33  void writeStandardNamespaces(QXmlStreamWriter& writer,
35 
36  void writeNamespace(QXmlStreamWriter& writer, const QString& ns, const QString& prefix) {
37  //qDebug() << "writeNamespace" << ns << prefix;
38  insert(ns, prefix);
39  writer.writeNamespace(ns, prefix);
40  }
41  QString resolve(const QString& ns, const QString& localName) const {
42  const QString prefix = value(ns);
43  if (prefix.isEmpty()) {
44  qWarning("ERROR: Namespace not found: %s (for localName %s)", qPrintable(ns), qPrintable(localName));
45  }
46  return prefix + QLatin1Char(':') + localName;
47  }
48 };
49 
50 #endif // KDSOAPNAMESPACESPREFIXES_H

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-soap/