edelib 2.0.0
Public Member Functions | Static Public Member Functions

EdbusObjectPath Class Reference

Represents D-Bus object path. More...

#include </usr/src/RPM/BUILD/edelib-2.0/edelib/EdbusObjectPath.h>

List of all members.

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

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

Todo:
this should probably trigger assert if element is not valid
Parameters:
stris 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

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:
stris path element
static bool valid_path ( const EdbusObjectPath path) [inline, static]

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

static bool valid_path ( const char *  str) [static]

Check if str is valid path

Returns:
true if is valid
Parameters:
stris full object path

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