1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
// SPDX-License-Identifier: BSD-3-Clause
// Copyright The Music Player Daemon Project
#ifndef LIBMPDCLIENT_STRINGNORMALIZATION_H
#define LIBMPDCLIENT_STRINGNORMALIZATION_H
#include "recv.h"
#include "compiler.h"
#include <stdbool.h>
/**
* @since libmpdclient 2.24
*/
enum mpd_stringnormalization_option
{
/**
* Special value returned by mpd_stringnormalization_parse() when an
* unknown name was passed.
*/
MPD_STRINGNORMALIZATION_UNKNOWN = -1,
MPD_STRINGNORMALIZATION_STRIP_DIACRITICS,
/* IMPORTANT: the ordering above must be
retained, or else the libmpdclient ABI breaks */
MPD_STRINGNORMALIZATION_COUNT
};
#ifdef __cplusplus
extern "C" {
#endif
/**
* Looks up the name of the specified stringnormalization option.
*
* @return the name, or NULL if the tag type is not valid
*/
const char *
mpd_stringnormalization_name(enum mpd_stringnormalization_option option);
/**
* Parses a stringnormalization option name, and returns its #mpd_protocol_feature value.
*
* @return a #mpd_protocol_feature value, or MPD_FEATURE_UNKNOWN if the name was
* not recognized
*/
enum mpd_stringnormalization_option
mpd_stringnormalization_name_parse(const char *name);
/**
* Requests a list of enabled stringnormalization options.
* Use mpd_recv_stringnormalization_pair() to obtain the list of
* "option" pairs.
*
* @param connection the connection to MPD
* @return true on success, false on error
*
* @since libmpdclient 2.24, MPD 0.25
*/
bool
mpd_send_list_stringnormalization(struct mpd_connection *connection);
/**
* Requests a list of available protocol features.
* Use mpd_recv_stringnormalization_pair() to obtain the list of
* "stringnormalization option" pairs.
*
* @param connection the connection to MPD
* @return true on success, false on error
*
* @since libmpdclient 2.24, MPD 0.25
*/
bool
mpd_send_list_stringnormalization_available(struct mpd_connection *connection);
/**
* Receives the next stringnormalization option. Call this in a loop after
* mpd_send_list_stringnormalization().
*
* Free the return value with mpd_return_pair().
*
* @param connection a #mpd_connection
* @returns a "stringnormalization option" pair, or NULL on error or if the end of the
* response is reached
*
* @since libmpdclient 2.24, MPD 0.25
*/
mpd_malloc
static inline struct mpd_pair *
mpd_recv_stringnormalization_pair(struct mpd_connection *connection)
{
return mpd_recv_pair_named(connection, "stringnormalization");
}
/**
* Disables one or more stringnormalization option from the list of stringnormalization options.
*
* @param connection the connection to MPD
* @param options an array of stringnormalization options to disable
* @param n the number of protocol features in the array
* @return true on success, false on error
*
* @since libmpdclient 2.24, MPD 0.25
*/
bool
mpd_send_disable_stringnormalization(struct mpd_connection *connection,
const enum mpd_stringnormalization_option *options, unsigned n);
/**
* Shortcut for mpd_send_disable_stringnormalization() and mpd_response_finish().
*
* @since libmpdclient 2.24, MPD 0.25
*/
bool
mpd_run_disable_stringnormalization(struct mpd_connection *connection,
const enum mpd_stringnormalization_option *options, unsigned n);
/**
* Re-enable one or more stringnormalization options from the list of stringnormalization options
* for this client.
*
* @param connection the connection to MPD
* @param options an array of stringnormalization options to enable
* @param n the number of protocol features in the array
* @return true on success, false on error
*
* @since libmpdclient 2.24, MPD 0.25
*/
bool
mpd_send_enable_stringnormalization(struct mpd_connection *connection,
const enum mpd_stringnormalization_option *options, unsigned n);
/**
* Shortcut for mpd_send_enable_stringnormalization() and mpd_response_finish().
*
* @since libmpdclient 2.24, MPD 0.25
*/
bool
mpd_run_enable_stringnormalization(struct mpd_connection *connection,
const enum mpd_stringnormalization_option *options, unsigned n);
/**
* Clear the list of enabled stringnormalization options for this client.
*
* @param connection the connection to MPD
* @return true on success, false on error
*
* @since libmpdclient 2.24, MPD 0.25
*/
bool
mpd_send_clear_stringnormalization(struct mpd_connection *connection);
/**
* Shortcut for mpd_send_clear_stringnormalization() and mpd_response_finish().
*
* @since libmpdclient 2.24, MPD 0.25
*/
bool
mpd_run_clear_stringnormalization(struct mpd_connection *connection);
/**
* Enable all available stringnormalization options for this client.
*
* @param connection the connection to MPD
* @return true on success, false on error
*
* @since libmpdclient 2.24, MPD 0.25
*/
bool
mpd_send_all_stringnormalization(struct mpd_connection *connection);
/**
* Shortcut for mpd_send_all_stringnormalization() and mpd_response_finish().
*
* @since libmpdclient 2.24, MPD 0.25
*/
bool
mpd_run_all_stringnormalization(struct mpd_connection *connection);
#ifdef __cplusplus
}
#endif
#endif
|