Go to the source code of this file.
mpd_malloc struct mpd_parser* mpd_parser_new |
( |
void |
| ) |
|
|
read |
Allocates a new mpd_parser object. Returns NULL on error (out of memory).
void mpd_parser_free |
( |
struct mpd_parser * |
parser | ) |
|
Feeds a line (without the trailing newline character) received from MPD / mpd_async_recv_line() into the parser.
Note that the line parameter is writable, because the parser will modify it. The functions mpd_parser_get_name() and mpd_parser_get_value() will return pointers inside this buffer. This means that after passing the line to this function, you must not modify or free it, until the name and value pointers are not used anymore.
- Parameters
-
parser | the mpd_parser object |
line | a line received from the MPD server |
- Returns
- a result code indicating the type of line, or error
mpd_pure bool mpd_parser_is_discrete |
( |
const struct mpd_parser * |
parser | ) |
|
mpd_pure unsigned mpd_parser_get_at |
( |
const struct mpd_parser * |
parser | ) |
|
On MPD_PARSER_ERROR, this returns the number of the list command which failed. Don't call this outside of a command list.
- Parameters
-
mpd_pure const char* mpd_parser_get_message |
( |
const struct mpd_parser * |
parser | ) |
|
On MPD_PARSER_ERROR, this returns the human readable error message returned by MPD (UTF-8).
This returns a pointer into the line buffer passed to mpd_parser_feed(). It is valid as long as the buffer is not freed/modified.
- Parameters
-
mpd_pure const char* mpd_parser_get_name |
( |
const struct mpd_parser * |
parser | ) |
|
On MPD_PARSER_PAIR, this returns the name.
This returns a pointer into the line buffer passed to mpd_parser_feed(). It is valid as long as the buffer is not freed/modified.
- Parameters
-
mpd_pure const char* mpd_parser_get_value |
( |
const struct mpd_parser * |
parser | ) |
|
On MPD_PARSER_PAIR, this returns the value.
This returns a pointer into the line buffer passed to mpd_parser_feed(). It is valid as long as the buffer is not freed/modified.
- Parameters
-