edelib: EdbusObjectPath Class Reference

edelib 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | List of all members
EdbusObjectPath Class Reference
D-Bus classes and functions

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

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

Parameters

  str | is string that should be valid path

EdbusObjectPath | ( | const EdbusObjectPath & |  | ) |

Copy path from other EdbusObjectPath object

~EdbusObjectPath | ( |  | ) |

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

Todo:
  this should probably trigger assert if element is not valid

Parameters

  str | is path element

Referenced by edelib::operator<<().

void clear | ( | void |  | ) |

Clears data and construct root-ed path.

bool operator!= | ( | const EdbusObjectPath & | other | ) |
| inline

Validate if two paths are not equal

Returns
  true if they are not

bool operator== | ( | const EdbusObjectPath & | other | ) |
| inline

Validate if two paths are equal

Returns
  true if does

const char* path | ( | void |  | ) | const
| inline

Returns object path

References String::c_str().

Referenced by EdbusObjectPath::valid_path().

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

  str | is path element

static bool valid_path | ( | const char * | str | ) |
| static

Check if str is valid path

Returns
  true if is valid

Parameters

  str | is full object path

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

  path | is 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:

- edelib/EdbusObjectPath.h