Changeset 561 for trunk/src/dbus/qdbusutil_p.h
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/dbus/qdbusutil_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 58 58 59 59 #include <QtDBus/qdbusmacros.h> 60 #include <QtDBus/qdbuserror.h> 60 61 61 62 QT_BEGIN_HEADER … … 84 85 85 86 QDBUS_EXPORT QString argumentToString(const QVariant &variant); 87 88 enum AllowEmptyFlag { 89 EmptyAllowed, 90 EmptyNotAllowed 91 }; 92 93 inline bool checkInterfaceName(const QString &name, AllowEmptyFlag empty, QDBusError *error) 94 { 95 if (name.isEmpty()) { 96 if (empty == EmptyAllowed) return true; 97 *error = QDBusError(QDBusError::InvalidInterface, QLatin1String("Interface name cannot be empty")); 98 return false; 99 } 100 if (isValidInterfaceName(name)) return true; 101 *error = QDBusError(QDBusError::InvalidInterface, QString::fromLatin1("Invalid interface class: %1").arg(name)); 102 return false; 103 } 104 105 inline bool checkBusName(const QString &name, AllowEmptyFlag empty, QDBusError *error) 106 { 107 if (name.isEmpty()) { 108 if (empty == EmptyAllowed) return true; 109 *error = QDBusError(QDBusError::InvalidService, QLatin1String("Service name cannot be empty")); 110 return false; 111 } 112 if (isValidBusName(name)) return true; 113 *error = QDBusError(QDBusError::InvalidService, QString::fromLatin1("Invalid service name: %1").arg(name)); 114 return false; 115 } 116 117 inline bool checkObjectPath(const QString &path, AllowEmptyFlag empty, QDBusError *error) 118 { 119 if (path.isEmpty()) { 120 if (empty == EmptyAllowed) return true; 121 *error = QDBusError(QDBusError::InvalidObjectPath, QLatin1String("Object path cannot be empty")); 122 return false; 123 } 124 if (isValidObjectPath(path)) return true; 125 *error = QDBusError(QDBusError::InvalidObjectPath, QString::fromLatin1("Invalid object path: %1").arg(path)); 126 return false; 127 } 128 129 inline bool checkMemberName(const QString &name, AllowEmptyFlag empty, QDBusError *error, const char *nameType = 0) 130 { 131 if (!nameType) nameType = "member"; 132 if (name.isEmpty()) { 133 if (empty == EmptyAllowed) return true; 134 *error = QDBusError(QDBusError::InvalidMember, QLatin1String(nameType) + QLatin1String(" name cannot be empty")); 135 return false; 136 } 137 if (isValidMemberName(name)) return true; 138 *error = QDBusError(QDBusError::InvalidMember, QString::fromLatin1("Invalid %1 name: %2") 139 .arg(QString::fromLatin1(nameType), name)); 140 return false; 141 } 142 143 inline bool checkErrorName(const QString &name, AllowEmptyFlag empty, QDBusError *error) 144 { 145 if (name.isEmpty()) { 146 if (empty == EmptyAllowed) return true; 147 *error = QDBusError(QDBusError::InvalidInterface, QLatin1String("Error name cannot be empty")); 148 return false; 149 } 150 if (isValidErrorName(name)) return true; 151 *error = QDBusError(QDBusError::InvalidInterface, QString::fromLatin1("Invalid error name: %1").arg(name)); 152 return false; 153 } 86 154 } 87 155
Note:
See TracChangeset
for help on using the changeset viewer.