libmpdclient
2.7
|
00001 /* libmpdclient 00002 (c) 2003-2010 The Music Player Daemon Project 00003 This project's homepage is: http://www.musicpd.org 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions 00007 are met: 00008 00009 - Redistributions of source code must retain the above copyright 00010 notice, this list of conditions and the following disclaimer. 00011 00012 - Redistributions in binary form must reproduce the above copyright 00013 notice, this list of conditions and the following disclaimer in the 00014 documentation and/or other materials provided with the distribution. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00017 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00018 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00019 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 00020 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00021 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00022 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00023 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00024 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00025 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00026 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 */ 00028 00029 #ifndef LIBMPDCLIENT_PARSER_H 00030 #define LIBMPDCLIENT_PARSER_H 00031 00032 #include <mpd/protocol.h> 00033 #include <mpd/compiler.h> 00034 00035 #include <stdbool.h> 00036 00037 enum mpd_parser_result { 00041 MPD_PARSER_MALFORMED, 00042 00047 MPD_PARSER_SUCCESS, 00048 00053 MPD_PARSER_ERROR, 00054 00059 MPD_PARSER_PAIR, 00060 }; 00061 00068 struct mpd_parser; 00069 00070 #ifdef __cplusplus 00071 extern "C" { 00072 #endif 00073 00078 mpd_malloc 00079 struct mpd_parser * 00080 mpd_parser_new(void); 00081 00085 void 00086 mpd_parser_free(struct mpd_parser *parser); 00087 00103 enum mpd_parser_result 00104 mpd_parser_feed(struct mpd_parser *parser, char *line); 00105 00113 mpd_pure 00114 bool 00115 mpd_parser_is_discrete(const struct mpd_parser *parser); 00116 00123 mpd_pure 00124 enum mpd_server_error 00125 mpd_parser_get_server_error(const struct mpd_parser *parser); 00126 00133 mpd_pure 00134 unsigned 00135 mpd_parser_get_at(const struct mpd_parser *parser); 00136 00147 mpd_pure 00148 const char * 00149 mpd_parser_get_message(const struct mpd_parser *parser); 00150 00160 mpd_pure 00161 const char * 00162 mpd_parser_get_name(const struct mpd_parser *parser); 00163 00173 mpd_pure 00174 const char * 00175 mpd_parser_get_value(const struct mpd_parser *parser); 00176 00177 #ifdef __cplusplus 00178 } 00179 #endif 00180 00181 #endif