ut_process.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2021 Freie Universität Berlin
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
26 #include <stddef.h>
27 #include <string.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 typedef struct {
37  const char *name;
38  const char *value;
40 
60 int ut_process_expand(const char *ut, size_t ut_len,
61  const ut_process_var_t *vars, size_t vars_len,
62  char *uri, size_t *uri_len);
63 
85 static inline int ut_process_str_expand(const char *ut,
86  const ut_process_var_t *vars,
87  size_t vars_len,
88  char *uri, size_t *uri_len)
89 {
90  return ut_process_expand(ut, strlen(ut), vars, vars_len, uri, uri_len);
91 }
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
static int ut_process_str_expand(const char *ut, const ut_process_var_t *vars, size_t vars_len, char *uri, size_t *uri_len)
Expands a URI template by a given value set.
Definition: ut_process.h:85
int ut_process_expand(const char *ut, size_t ut_len, const ut_process_var_t *vars, size_t vars_len, char *uri, size_t *uri_len)
Expands a URI template by a given value set.
Name-value-pair of a variable for URI template expansion.
Definition: ut_process.h:36
const char * name
name of the variable
Definition: ut_process.h:37
const char * value
value for the variable
Definition: ut_process.h:38