diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-05-20 23:22:18 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-05-20 23:22:18 +0900 |
commit | 00b00f996127cbb0e9d677494494b971cbdadb3d (patch) | |
tree | aa64ef1b3d0956409c59ce28bd8382d3aadc4551 /src | |
parent | 6b319e048259b4ea4962d8b7c2cd514a07898745 (diff) | |
download | dbus-1-tqt-00b00f996127cbb0e9d677494494b971cbdadb3d.tar.gz dbus-1-tqt-00b00f996127cbb0e9d677494494b971cbdadb3d.zip |
Modified TQT_DBusObjectPath to inherit from TQString instead of
TQCString.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src')
-rw-r--r-- | src/tqdbusmarshall.cpp | 2 | ||||
-rw-r--r-- | src/tqdbusobjectpath.cpp | 55 | ||||
-rw-r--r-- | src/tqdbusobjectpath.h | 15 |
3 files changed, 40 insertions, 32 deletions
diff --git a/src/tqdbusmarshall.cpp b/src/tqdbusmarshall.cpp index 7f0781f..f0cc9c0 100644 --- a/src/tqdbusmarshall.cpp +++ b/src/tqdbusmarshall.cpp @@ -652,7 +652,7 @@ static void tqAppendToMessage(DBusMessageIter *it, const TQString &str) static void tqAppendToMessage(DBusMessageIter *it, const TQT_DBusObjectPath &path) { - const char *cdata = path.data(); + const char *cdata = path.ascii(); dbus_message_iter_append_basic(it, DBUS_TYPE_OBJECT_PATH, &cdata); } diff --git a/src/tqdbusobjectpath.cpp b/src/tqdbusobjectpath.cpp index 0f42860..bdd9634 100644 --- a/src/tqdbusobjectpath.cpp +++ b/src/tqdbusobjectpath.cpp @@ -1,4 +1,4 @@ -/* qdbusobjectpath.cpp DBUS object path data type +/* tqdbusobjectpath.cpp DBUS object path data type * * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> * @@ -23,24 +23,25 @@ #include "tqdbusobjectpath.h" -TQT_DBusObjectPath::TQT_DBusObjectPath() : TQCString() +TQT_DBusObjectPath::TQT_DBusObjectPath() : TQString() { } -TQT_DBusObjectPath::TQT_DBusObjectPath(const TQT_DBusObjectPath& other) : TQCString(static_cast<const TQCString&>(other)) +TQT_DBusObjectPath::TQT_DBusObjectPath(const TQT_DBusObjectPath &other) : TQString(static_cast<const TQString&>(other)) { } -TQT_DBusObjectPath::TQT_DBusObjectPath(const TQCString& other) : TQCString(static_cast<const TQCString&>(other)) +TQT_DBusObjectPath::TQT_DBusObjectPath(const TQString &other) : TQString(static_cast<const TQString&>(other)) { } -TQT_DBusObjectPath::TQT_DBusObjectPath(const TQT_DBusObjectPath& parentNode, - const TQCString& nodeName) - : TQCString(static_cast<const TQCString&>(parentNode)) +TQT_DBusObjectPath::TQT_DBusObjectPath(const TQT_DBusObjectPath &parentNode, const TQString &nodeName) + : TQString(static_cast<const TQString&>(parentNode)) { - if (parentNode.length() != 1) append("/"); - + if (parentNode.length() != 1) + { + append("/"); + } append(nodeName); } @@ -51,29 +52,37 @@ bool TQT_DBusObjectPath::isValid() const TQT_DBusObjectPath TQT_DBusObjectPath::parentNode() const { - if (length() == 1) return TQT_DBusObjectPath(); + if (length() == 1) + { + return TQT_DBusObjectPath(); + } int index = findRev('/'); - - if (index == -1) return TQT_DBusObjectPath(); - - if (index == 0) return left(1); + if (index == -1) + { + return TQT_DBusObjectPath(); + } + else if (index == 0) + { + return left(1); + } return left(index); } -int TQT_DBusObjectPath::validate(const TQCString& path) +int TQT_DBusObjectPath::validate(const TQString &path) { - if (path.isEmpty()) return 0; - - if (path[0] != '/') return 0; - - // TODO add additional checks - - uint len = path.length(); + if (path.isEmpty() || path[0] != '/') + { + return 0; + } // only root node allowed to end in slash - if (path[len - 1] == '/' && len > 1) return (len - 1); + uint len = path.length(); + if (path[len - 1] == '/' && len > 1) + { + return (len - 1); + } return -1; } diff --git a/src/tqdbusobjectpath.h b/src/tqdbusobjectpath.h index 7a166c6..3d184d3 100644 --- a/src/tqdbusobjectpath.h +++ b/src/tqdbusobjectpath.h @@ -1,4 +1,4 @@ -/* qdbusobjectpath.h DBUS object path data type +/* tqdbusobjectpath.h DBUS object path data type * * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at> * @@ -18,13 +18,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. - * */ #ifndef TQDBUSOBJECTPATH_H #define TQDBUSOBJECTPATH_H -#include <tqcstring.h> +#include <tqstring.h> #include "tqdbusmacros.h" /** @@ -36,7 +35,7 @@ * * @see @ref dbusconventions-objectpath */ -class TQDBUS_EXPORT TQT_DBusObjectPath : public TQCString +class TQDBUS_EXPORT TQT_DBusObjectPath : public TQString { public: /** @@ -49,14 +48,14 @@ public: * * @param other the object path to copy */ - TQT_DBusObjectPath(const TQT_DBusObjectPath& other); + TQT_DBusObjectPath(const TQT_DBusObjectPath &other); /** * @brief Creates copy of the given @p other object path * * @param other the object path to copy */ - TQT_DBusObjectPath(const TQCString& other); + TQT_DBusObjectPath(const TQString &other); /** * @brief Creates an object path for an object as a child of the parent node @@ -76,7 +75,7 @@ public: * @param parentNode the object path to create the child on * @param nodeName the name of the child node */ - TQT_DBusObjectPath(const TQT_DBusObjectPath& parentNode, const TQCString& nodeName); + TQT_DBusObjectPath(const TQT_DBusObjectPath &parentNode, const TQString &nodeName); /** * @brief Returns whether the current content is considered a valid object path @@ -113,7 +112,7 @@ public: * * @see isValid() */ - static int validate(const TQCString& path); + static int validate(const TQString &path); }; #endif |