edelib  2.1.0
Public Member Functions | Static Public Member Functions | List of all members
EdbusObjectPath Class Reference

Represents D-Bus object path. More...

#include <edelib/EdbusObjectPath.h>

Public Member Functions

 EdbusObjectPath ()
 EdbusObjectPath (const char *str)
 EdbusObjectPath (const EdbusObjectPath &)
 ~EdbusObjectPath ()
void append (const char *str)
void clear (void)
const char * path (void) const
bool operator== (const EdbusObjectPath &other)
bool operator!= (const EdbusObjectPath &other)

Static Public Member Functions

static bool valid_element (const char *str)
static bool valid_path (const char *str)
static bool valid_path (const EdbusObjectPath &path)

Detailed Description

Represents D-Bus object path.

This data type is necessary to correctly represents D-Bus object path since D-Bus protocol limits character range that should be in object path name. Also, D-Bus have different signature for object paths than for ordinary strings.

Valid path is that string that contains elements with [A-Z][a-z][0-9]_ characters, separated by // character. The path must begin with //, and must not ends with it (except path contains only root). E.g.

* Valid paths:
* /
* /org/foo/baz
* Invalid paths:
* //
* /org/foo/baz/
* /org//foo/baz
* ...

This class will always construct valid path, so if parameter with invalid character range is given, it will ignore it.

Make this class implicitly shared

Constructor & Destructor Documentation

Construct root-ed path(//)

EdbusObjectPath ( const char *  str)

Use str as path. If str is not valid path, EdbusObjectPath will ignore it, constructing only root-ed path

stris string that should be valid path

Copy path from other EdbusObjectPath object

Clears data

Member Function Documentation

void append ( const char *  str)

Appends str to the path. str should be path element (allowed characters without // character. If str is not valid element (you can validate it with valid_element() function, this function will ignore it).

this should probably trigger assert if element is not valid
stris path element

Referenced by edelib::operator<<().

void clear ( void  )

Clears data and construct root-ed path.

bool operator!= ( const EdbusObjectPath other)

Validate if two paths are not equal

true if they are not
bool operator== ( const EdbusObjectPath other)

Validate if two paths are equal

true if does
const char* path ( void  ) const

Returns object path

Referenced by EdbusObjectPath::valid_path().

static bool valid_element ( const char *  str)

Check if element is valid and can be used in path construction

true if is valid
stris path element
static bool valid_path ( const char *  str)

Check if str is valid path

true if is valid
stris full object path
static bool valid_path ( const EdbusObjectPath path)

Check if EdbusObjectPath object contains valid path. This function should always return true on fully constructed object.

true if is valid
pathis EdbusObjectPath object

References EdbusObjectPath::path(), and EdbusObjectPath::valid_path().

Referenced by EdbusObjectPath::valid_path().

The documentation for this class was generated from the following file: