TQT_DBusObjectPath Class Reference

Class for representing D-Bus object paths. More...

#include <tqdbusobjectpath.h>

List of all members.

Public Member Functions

 TQT_DBusObjectPath ()
 TQT_DBusObjectPath (const TQT_DBusObjectPath &other)
 TQT_DBusObjectPath (const TQCString &other)
 TQT_DBusObjectPath (const TQT_DBusObjectPath &parentNode, const TQCString &nodeName)
bool isValid () const
TQT_DBusObjectPath parentNode () const

Static Public Member Functions

static int validate (const TQCString &path)

Detailed Description

Class for representing D-Bus object paths.

This data type is necessary to correctly represent object paths in the context of D-Bus messages, since normal strings have a different D-Bus signature than object paths.

See also:
Object paths

Definition at line 39 of file tqdbusobjectpath.h.


Constructor & Destructor Documentation

TQT_DBusObjectPath::TQT_DBusObjectPath (  ) 

Creates an empty and invalid object path.

Definition at line 26 of file tqdbusobjectpath.cpp.

00026                                        : TQCString()
00027 {
00028 }

Here is the caller graph for this function:

TQT_DBusObjectPath::TQT_DBusObjectPath ( const TQT_DBusObjectPath other  ) 

Creates copy of the given other object path.

Parameters:
other the object path to copy

Definition at line 30 of file tqdbusobjectpath.cpp.

00030                                                                       : TQCString(static_cast<const TQCString&>(other))
00031 {
00032 }

TQT_DBusObjectPath::TQT_DBusObjectPath ( const TQCString &  other  ) 

Creates copy of the given other object path.

Parameters:
other the object path to copy

Definition at line 34 of file tqdbusobjectpath.cpp.

00034                                                              : TQCString(static_cast<const TQCString&>(other))
00035 {
00036 }

TQT_DBusObjectPath::TQT_DBusObjectPath ( const TQT_DBusObjectPath parentNode,
const TQCString &  nodeName 
)

Creates an object path for an object as a child of the parent node.

This is basically like specifying a directory and a file name to create the file's full path.

Example:

 TQT_DBusObjectPath rootNode("/"); // => "/"

 TQT_DBusObjectPath childNod(rootNode, "child"); // => "/child"

 TQT_DBusObjectPath grandChildNode(childNode, "grandchild"); // => "/child/grandchild"
Parameters:
parentNode the object path to create the child on
nodeName the name of the child node

Definition at line 38 of file tqdbusobjectpath.cpp.

00040     : TQCString(static_cast<const TQCString&>(parentNode))
00041 {
00042     if (parentNode.length() != 1) append("/");
00043 
00044     append(nodeName);
00045 }


Member Function Documentation

bool TQT_DBusObjectPath::isValid (  )  const

Returns whether the current content is considered a valid object path.

Note:
Calls validate() to perform a check on the current content
Returns:
true if the object's content describe a valid object path, otherwise false
See also:
Object paths

Definition at line 47 of file tqdbusobjectpath.cpp.

References validate().

00048 {
00049     return (validate(*this) == -1);
00050 }

Here is the call graph for this function:

Here is the caller graph for this function:

TQT_DBusObjectPath TQT_DBusObjectPath::parentNode (  )  const

Returns the object path of this path's parent node.

This is basically like getting the directory of an file path

Returns:
the parent node's object path or an empty and invalid object if this is already the root node

Definition at line 52 of file tqdbusobjectpath.cpp.

References TQT_DBusObjectPath().

00053 {
00054     if (length() == 1) return TQT_DBusObjectPath();
00055 
00056     int index = findRev('/');
00057 
00058     if (index == -1) return TQT_DBusObjectPath();
00059 
00060     if (index == 0) return left(1);
00061 
00062     return left(index);
00063 }

Here is the call graph for this function:

int TQT_DBusObjectPath::validate ( const TQCString &  path  )  [static]

Checks the given string for validity as a D-Bus object path.

See section Object paths for information on object path formatting.

Parameters:
path the string to check
Returns:
-1 if the object path is valid, otherwise the index of the first violating character
See also:
isValid()

Definition at line 65 of file tqdbusobjectpath.cpp.

00066 {
00067     if (path.isEmpty()) return 0;
00068 
00069     if (path[0] != '/') return 0;
00070 
00071     // TODO add additional checks
00072 
00073     uint len = path.length();
00074 
00075     // only root node allowed to end in slash
00076     if (path[len - 1] == '/' && len > 1) return (len - 1);
00077 
00078     return -1;
00079 }

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Fri Apr 26 16:30:22 2019 for DBus-1-TQt by  doxygen 1.6.3