MPD: client/Response.hxx Source File

MPD 0.20.15

Response.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MPD_RESPONSE_HXX
21 #define MPD_RESPONSE_HXX
22
23 #include "check.h"
24 #include "protocol/Ack.hxx"
25
26 #include <stddef.h>
27 #include <stdarg.h>
28
29 class Client;
30
31 class Response {
32 Client &client;
33
38 const unsigned list_index;
39
43 const char *command;
44
45 public:
46 Response(Client &_client, unsigned _list_index)
47 :client(_client), list_index(_list_index), command("") {}
48
49 Response(const Response &) = delete;
50 Response &operator=(const Response &) = delete;
51
52 void SetCommand(const char *_command) {
53 command = _command;
54 }
55
56 bool Write(const void *data, size_t length);
57 bool Write(const char *data);
58 bool FormatV(const char *fmt, va_list args);
59 bool Format(const char *fmt, ...);
60
61 void Error(enum ack code, const char *msg);
62 void FormatError(enum ack code, const char *fmt, ...);
63 };
64
65 #endif
check.h
Response::FormatError
void FormatError(enum ack code, const char *fmt,...)
Response
Definition: Response.hxx:31
ack
ack
Definition: Ack.hxx:29
Ack.hxx
Response::FormatV
bool FormatV(const char *fmt, va_list args)
Response::Write
bool Write(const void *data, size_t length)
Response::operator=
Response & operator=(const Response &)=delete
Response::Format
bool Format(const char *fmt,...)
Client
Definition: Client.hxx:47
Response::Response
Response(Client &_client, unsigned _list_index)
Definition: Response.hxx:46
Response::SetCommand
void SetCommand(const char *_command)
Definition: Response.hxx:52
fmt
const char * fmt
Definition: Client.hxx:231
Response::Error
void Error(enum ack code, const char *msg)