From dfb815c36df6e5f2089672b1d986d38b44c7ad17 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Fri, 25 Sep 2015 19:05:23 +0200 Subject: sd-bus: add sd_bus_path_{encode,decode}_many() This introduces two new helpers alongside sd_bus_path_{encode,decode}(), which work similarly to their counterparts, but accept a format-string as input. This allows encoding and decoding multiple labels of a format string at the same time. --- man/sd_bus_path_encode.xml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'man/sd_bus_path_encode.xml') diff --git a/man/sd_bus_path_encode.xml b/man/sd_bus_path_encode.xml index 21c22a8f7c..696dfd00ba 100644 --- a/man/sd_bus_path_encode.xml +++ b/man/sd_bus_path_encode.xml @@ -44,7 +44,9 @@ sd_bus_path_encode + sd_bus_path_encode_many sd_bus_path_decode + sd_bus_path_decode_many Convert an external identifier into an object path and back @@ -60,12 +62,26 @@ char **ret_path + + int sd_bus_path_encode_many + char **out + const char *path_template + ... + + int sd_bus_path_decode const char *path const char *prefix char **ret_external_id + + + int sd_bus_path_decode_many + const char *path + const char *path_template + ... + @@ -109,6 +125,28 @@ invalid in a bus object path by _, followed by a hexadecimal value. As a special case, the empty string will be replaced by a lone _. + + sd_bus_path_encode_many() works like + its counterpart sd_bus_path_encode(), but + takes a path-template as argument and encodes multiple labels + according to its embedded directives. For each + % character found in the template, the caller + must provide a string via var-args, which will be encoded and + embedded at the position of the % character. + Any other character in the template is copied verbatim into the + encoded path. + + sd_bus_path_decode_many() does the + reverse of sd_bus_path_encode_many(). It + decodes the passed object path, according to the given + path-template. For each % character in the + template, the caller must provide an output storage + (char **) via var-args. The decoded label + will be stored there. Each % character will + only match the current label. It will never match across labels. + Furthermore, only a single such directive is allowed per label. + If NULL is passed as output storage, the + label is verified but not returned to the caller. -- cgit v1.2.1