pianod2
multisource multiuser scriptable networked music player
Public Member Functions | Public Attributes | List of all members
DataResponse Class Reference

This class is derived from ResponseCollector, and adds no member variables but adds data adder functions. More...

#include <response.h>

Inheritance diagram for DataResponse:
Inheritance graph
[legend]
Collaboration diagram for DataResponse:
Collaboration graph
[legend]

Public Member Functions

void data (Response &&r)
 Add more data to the response. More...
 
template<typename ParamOne , typename ParamTwo , typename... Additional>
void data (ParamOne &&first, ParamTwo &&second, Additional &&...more)
 Add data to the data response list, after constructing it. More...
 
template<typename T >
void data (const Retainer< T > &from)
 Add a music item to the data response list. More...
 
 DataResponse ()
 Construct a new DataResponse (i.e., a ResponseCollector that's been earmarked for returning data. More...
 
void data (ResponseGroup &&group)
 Add a record for transmission as response data. More...
 
void data (const ThingieList &item_list)
 Add a list of music items for transmission as response data. More...
 
void data (const SongList &songs)
 Add a list of songs for transmission as response data. More...
 
void data (const PlaylistList &playlists)
 Add a list of playlists for transmission as response data. More...
 
- Public Member Functions inherited from ResponseCollector
void setNoResponse ()
 
bool allSuccess () const
 ResponseCollector contains successes but no failures. More...
 
bool allFailure () const
 ResponseCollector contains failures but no successes. More...
 
bool anySuccess () const
 ResponseCollector contains at least one success, regardless of failures. More...
 
bool anyFailure () const
 ResponseCollector contains at least one failure, regardless of successes. More...
 
bool partial () const
 ResponseCollector contains a mix of successes and failures. More...
 
bool noop () const
 ResponseCollector contains neither successes nor failures. More...
 
bool dataResponse () const
 ResponseCollector is transporting data for transmission. More...
 
bool isNoResponse () const
 ResponseCollector should not send a reply to a command. More...
 
void close ()
 Causes the connection to be closed after the response is sent. More...
 
void transmit (PianodConnection &, const bool json)
 Transmit a reply. More...
 
 ResponseCollector ()=default
 
 ResponseCollector (ResponseCollector &&from)=default
 
ResponseCollectoroperator= (ResponseCollector &&from)=default
 
 ResponseCollector (Response &&initial)
 Initialize a response collection, and add the initial response to the appropriate collection if applicable. More...
 
 ResponseCollector (const RESPONSE_CODE response)
 
 ResponseCollector (MusicThingie *item)
 Implicitly wrap a music item into a data response. More...
 
 ResponseCollector (const ThingieList &things)
 Implicitly wrap a list of music items into a data response. More...
 
 ResponseCollector (const SongList &songs)
 Implicitly wrap a list of songs into a data response. More...
 
 ResponseCollector (ResponseGroup &&group)
 Implicitly wrap a response group into a data response. More...
 

Public Attributes

ResponseGroup information
 Session notices going back to user. More...
 
- Public Attributes inherited from ResponseCollector
ResponseGroup information
 Session notices going back to user. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ResponseCollector
void data (ResponseGroup &&group)
 Add a record for transmission as response data. More...
 
void data (const ThingieList &item_list)
 Add a list of music items for transmission as response data. More...
 
void data (const SongList &songs)
 Add a list of songs for transmission as response data. More...
 
void data (const PlaylistList &playlists)
 Add a list of playlists for transmission as response data. More...
 
- Protected Attributes inherited from ResponseCollector
RESPONSE_CODE reason { S_NOOP }
 The final response that will be sent. More...
 
ResponseGroup successes
 Success messages. More...
 
ResponseGroup diagnostics
 Details of errors encountered. More...
 
std::vector< ResponseGroupdata_groups
 Complete data records destined for the client. More...
 
ResponseGroup data_reply
 Discrete data responses destined for the client. More...
 
ResponseGroup user_events
 Broadcast to other same-user sessions. More...
 
ResponseGroup room_events
 Broadcast to all same-room sessions. More...
 
ResponseGroup broadcast_events
 Broadcast to all users, all rooms. More...
 

Detailed Description

This class is derived from ResponseCollector, and adds no member variables but adds data adder functions.

The name makes what we're returning more explicit, and the interface makes it more difficult to mix data with successes/failures, which is invalid. The cost is needing std::move() whereever we return as a ResponseCollector.

Constructor & Destructor Documentation

◆ DataResponse()

DataResponse::DataResponse ( )
inline

Construct a new DataResponse (i.e., a ResponseCollector that's been earmarked for returning data.

Member Function Documentation

◆ data() [1/7]

void ResponseCollector::data

Add a list of playlists for transmission as response data.

◆ data() [2/7]

template<typename T >
void DataResponse::data ( const Retainer< T > &  from)
inline

Add a music item to the data response list.

◆ data() [3/7]

void ResponseCollector::data

Add a list of songs for transmission as response data.

◆ data() [4/7]

void ResponseCollector::data

Add a list of music items for transmission as response data.

◆ data() [5/7]

template<typename ParamOne , typename ParamTwo , typename... Additional>
void DataResponse::data ( ParamOne &&  first,
ParamTwo &&  second,
Additional &&...  more 
)
inline

Add data to the data response list, after constructing it.

Here is the call graph for this function:

◆ data() [6/7]

void DataResponse::data ( Response &&  data)

Add more data to the response.

Parameters
dataThe data to add.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ data() [7/7]

void ResponseCollector::data

Add a record for transmission as response data.

Here is the caller graph for this function:

Member Data Documentation

◆ information

ResponseGroup ResponseCollector::information

Session notices going back to user.


The documentation for this class was generated from the following files: