mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-14 16:51:43 +02:00
add specialized request id constructors
This commit is contained in:
parent
0a879301c9
commit
027cb8ed50
2 changed files with 12 additions and 4 deletions
|
@ -36,11 +36,19 @@ struct req_id
|
|||
integer
|
||||
};
|
||||
|
||||
req_id() : type(value_t::null)
|
||||
req_id() : type(value_t::null), int_id(0), string_id("")
|
||||
{
|
||||
}
|
||||
|
||||
req_id(Json json_id) : type(value_t::null)
|
||||
req_id(int id) : type(value_t::integer), int_id(id), string_id("")
|
||||
{
|
||||
}
|
||||
|
||||
req_id(const std::string& id) : type(value_t::string), int_id(0), string_id(id)
|
||||
{
|
||||
}
|
||||
|
||||
explicit req_id(Json json_id) : type(value_t::null)
|
||||
{
|
||||
if (json_id.is_null())
|
||||
{
|
||||
|
@ -77,8 +85,8 @@ struct req_id
|
|||
}
|
||||
|
||||
value_t type;
|
||||
std::string string_id;
|
||||
int int_id;
|
||||
std::string string_id;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ using namespace std;
|
|||
|
||||
|
||||
|
||||
JsonRequest::JsonRequest() : id(-1), method("")
|
||||
JsonRequest::JsonRequest() : id(), method("")
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue