2020-10-17 14:29:32 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
// Small helper class that keeps track of key/value pairs to
|
2024-05-04 15:55:50 +00:00
|
|
|
// pass to the XML-routines as parameters.
|
|
|
|
#ifndef XMLPARAMS_H
|
|
|
|
#define XMLPARAMS_H
|
2020-10-17 14:29:32 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
struct xml_params {
|
|
|
|
std::vector<std::pair<std::string, std::string>> items;
|
|
|
|
mutable std::vector<const char *> data;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Return values marked as "not stable" may be invalidated when calling
|
|
|
|
// an xml_params_*() function that takes a non-const xml_params parameter.
|
|
|
|
extern struct xml_params *alloc_xml_params();
|
|
|
|
extern void free_xml_params(struct xml_params *params);
|
|
|
|
extern void xml_params_resize(struct xml_params *params, int count);
|
|
|
|
extern void xml_params_add(struct xml_params *params, const char *key, const char *value);
|
|
|
|
extern void xml_params_add_int(struct xml_params *params, const char *key, int value);
|
|
|
|
extern int xml_params_count(const struct xml_params *params);
|
|
|
|
extern const char *xml_params_get_key(const struct xml_params *params, int idx); // not stable
|
|
|
|
extern const char *xml_params_get_value(const struct xml_params *params, int idx); // not stable
|
|
|
|
extern void xml_params_set_value(struct xml_params *params, int idx, const char *value);
|
|
|
|
extern const char **xml_params_get(const struct xml_params *params); // not stable
|
|
|
|
|
|
|
|
#endif
|