ut_process.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
26 #ifndef UT_PROCESS_H
27 #define UT_PROCESS_H
28 
29 #include <stddef.h>
30 #include <string.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
39 typedef struct {
40  const char *name;
41  const char *value;
43 
63 int ut_process_expand(const char *ut, size_t ut_len,
64  const ut_process_var_t *vars, size_t vars_len,
65  char *uri, size_t *uri_len);
66 
88 static inline int ut_process_str_expand(const char *ut,
89  const ut_process_var_t *vars,
90  size_t vars_len,
91  char *uri, size_t *uri_len)
92 {
93  return ut_process_expand(ut, strlen(ut), vars, vars_len, uri, uri_len);
94 }
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif /* UT_PROCESS_H */
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:88
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:39
const char * name
name of the variable
Definition: ut_process.h:40
const char * value
value for the variable
Definition: ut_process.h:41