edelib 2.1.0
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.

Todo
Make this class implicitly shared

Constructor & Destructor Documentation

◆ EdbusObjectPath() [1/3]

Construct root-ed path(//)

◆ EdbusObjectPath() [2/3]

EdbusObjectPath ( const char * str)

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

Parameters
stris string that should be valid path

◆ EdbusObjectPath() [3/3]

Copy path from other EdbusObjectPath object

◆ ~EdbusObjectPath()

Clears data

Member Function Documentation

◆ append()

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).

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

Referenced by edelib::operator<<().

◆ clear()

void clear ( void )

Clears data and construct root-ed path.

◆ operator!=()

bool operator!= ( const EdbusObjectPath & other)
inline

Validate if two paths are not equal

Returns
true if they are not

◆ operator==()

bool operator== ( const EdbusObjectPath & other)
inline

Validate if two paths are equal

Returns
true if does

◆ path()

const char * path ( void ) const
inline

Returns object path

References String::c_str().

Referenced by EdbusObjectPath::valid_path().

◆ valid_element()

static bool valid_element ( const char * str)
static

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

Returns
true if is valid
Parameters
stris path element

◆ valid_path() [1/2]

static bool valid_path ( const char * str)
static

Check if str is valid path

Returns
true if is valid
Parameters
stris full object path

◆ valid_path() [2/2]

static bool valid_path ( const EdbusObjectPath & path)
inlinestatic

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

Returns
true if is valid
Parameters
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: