diff --git a/include/conf.h b/include/conf.h index 5c70ebcc..9cf39dc0 100644 --- a/include/conf.h +++ b/include/conf.h @@ -131,6 +131,8 @@ int snd_config_make_real(snd_config_t **config, const char *key); int snd_config_make_string(snd_config_t **config, const char *key); int snd_config_make_pointer(snd_config_t **config, const char *key); int snd_config_make_compound(snd_config_t **config, const char *key, int join); +int snd_config_make_path(snd_config_t **config, snd_config_t *root, const char *key, + int join, int override); int snd_config_imake_integer(snd_config_t **config, const char *key, const long value); int snd_config_imake_integer64(snd_config_t **config, const char *key, const long long value); diff --git a/src/conf.c b/src/conf.c index 7ebf7577..f40fe883 100644 --- a/src/conf.c +++ b/src/conf.c @@ -2547,6 +2547,103 @@ int snd_config_make_compound(snd_config_t **config, const char *id, return 0; } +/** + * \brief Creates an empty compound configuration node in the path. + * \param[out] config The function puts the handle to the new or + * existing compound node at the address specified + * by \a config. + * \param[in] root The id of the new node. + * \param[in] key The id of the new node. + * \param[in] join Join flag. + * \param[in] override Override flag. + * \return Zero if successful, otherwise a negative error code. + * + * This function creates a new empty node of type + * #SND_CONFIG_TYPE_COMPOUND if the path does not exist. Otherwise, + * the node from the current configuration tree is returned without + * any modification. The \a join argument is ignored in this case. + * + * \a join determines how the compound node's id is printed when the + * configuration is saved to a text file. For example, if the join flag + * of compound node \c a is zero, the output will look as follows: + * \code + * a { + * b "hello" + * c 42 + * } + * \endcode + * If, however, the join flag of \c a is nonzero, its id will be joined + * with its children's ids, like this: + * \code + * a.b "hello" + * a.c 42 + * \endcode + * An \e empty compound node with its join flag set would result in no + * output, i.e., after saving and reloading the configuration file, that + * compound node would be lost. + * + * \par Errors: + *