Skip to content

Commit b6314c7

Browse files
author
D++ Update Bot
committed
auto update to latest DPP master branch
1 parent 8807513 commit b6314c7

File tree

12 files changed

+53
-52
lines changed

12 files changed

+53
-52
lines changed
1 KB
Binary file not shown.
-176 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
-176 Bytes
Binary file not shown.
1 KB
Binary file not shown.
-184 Bytes
Binary file not shown.
-1 KB
Binary file not shown.
-184 Bytes
Binary file not shown.

MyBot/dependencies/include/dpp-10.0/dpp/coro/awaitable.h

+6-26
Original file line numberDiff line numberDiff line change
@@ -534,31 +534,19 @@ class basic_promise : public detail::promise::promise_base<T> {
534534
}
535535

536536
/**
537-
* @brief Construct the result by copy, and resume any awaiter.
538-
*
539-
* @tparam Notify Whether to resume any awaiter or not.
540-
* @throws dpp::logic_exception if the promise is not empty.
541-
*/
542-
template <bool Notify = true, typename U = T>
543-
requires (std::convertible_to<const U&, T>)
544-
void set_value(const U& v) {
545-
emplace_value<Notify>(v);
546-
}
547-
548-
/**
549-
* @brief Construct the result by move, and resume any awaiter.
537+
* @brief Construct the result by forwarding reference, and resume any awaiter.
550538
*
551539
* @tparam Notify Whether to resume any awaiter or not.
552540
* @throws dpp::logic_exception if the promise is not empty.
553541
*/
554542
template <bool Notify = true, typename U = T>
555543
requires (std::convertible_to<U&&, T>)
556544
void set_value(U&& v) {
557-
emplace_value<Notify>(std::move(v));
545+
emplace_value<Notify>(std::forward<U>(v));
558546
}
559547

560548
/**
561-
* @brief Construct the result by move, and resume any awaiter.
549+
* @brief Construct a void result, and resume any awaiter.
562550
*
563551
* @tparam Notify Whether to resume any awaiter or not.
564552
* @throws dpp::logic_exception if the promise is not empty.
@@ -605,19 +593,11 @@ class moveable_promise {
605593
}
606594

607595
/**
608-
* @copydoc basic_promise<T>::set_value(const T&)
609-
*/
610-
template <bool Notify = true, typename U = T>
611-
void set_value(const U& v) requires (std::convertible_to<const U&, T>) {
612-
shared_state->template set_value<Notify>(v);
613-
}
614-
615-
/**
616-
* @copydoc basic_promise<T>::set_value(T&&)
596+
* @copydoc basic_promise<T>::set_value(U&&)
617597
*/
618598
template <bool Notify = true, typename U = T>
619-
void set_value(U&& v) requires (std::convertible_to<const U&, T>) {
620-
shared_state->template set_value<Notify>(std::move(v));
599+
void set_value(U&& v) requires (std::convertible_to<U&&, T>) {
600+
shared_state->template set_value<Notify>(std::forward<U>(v));
621601
}
622602

623603
/**

MyBot/dependencies/include/dpp-10.0/dpp/snowflake.h

+24
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
#include <cstdint>
2727
#include <type_traits>
2828

29+
#ifdef DPP_FORMATTERS
30+
#include <format>
31+
#endif
32+
2933
/**
3034
* @brief The main namespace for D++ functions. classes and types
3135
*/
@@ -281,3 +285,23 @@ struct std::hash<dpp::snowflake>
281285
return std::hash<uint64_t>{}(s.value);
282286
}
283287
};
288+
289+
#ifdef DPP_FORMATTERS
290+
/*
291+
* @brief implementation of formater for dpp::snowflake for std::format support
292+
* https://en.cppreference.com/w/cpp/utility/format/formatter
293+
*/
294+
template <>
295+
struct std::formatter<dpp::snowflake>
296+
{
297+
template<class TP>
298+
constexpr typename TP::iterator parse(TP& ctx) {
299+
return ctx.begin();
300+
}
301+
302+
template<class TF>
303+
typename TF::iterator format(const dpp::snowflake& snowflake, TF& ctx) const {
304+
return std::format_to(ctx.out(), "{}", snowflake.str());
305+
}
306+
};
307+
#endif //DPP_FORMATTERS

MyBot/dependencies/include/dpp-10.0/dpp/sslclient.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,10 @@ class DPP_EXPORT ssl_client
239239

240240
/**
241241
* @brief Write to the output buffer.
242-
* @param data Data to be written to the buffer
242+
* @param data Data to be written to the buffer.
243243
* @note The data may not be written immediately and may be written at a later time to the socket.
244244
*/
245-
virtual void write(const std::string &data);
245+
virtual void write(const std::string_view data);
246246

247247
/**
248248
* @brief Close socket connection

MyBot/dependencies/include/dpp-10.0/dpp/wsclient.h

+21-24
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include <dpp/export.h>
2424
#include <string>
2525
#include <map>
26-
#include <vector>
27-
#include <variant>
2826
#include <dpp/sslclient.h>
2927

3028
namespace dpp {
@@ -37,7 +35,7 @@ enum websocket_protocol_t : uint8_t {
3735
* @brief JSON data, text, UTF-8 character set
3836
*/
3937
ws_json = 0,
40-
38+
4139
/**
4240
* @brief Erlang Term Format (ETF) binary protocol
4341
*/
@@ -68,32 +66,32 @@ enum ws_opcode : uint8_t {
6866
/**
6967
* @brief Continuation.
7068
*/
71-
OP_CONTINUATION = 0x00,
69+
OP_CONTINUATION = 0x00,
7270

7371
/**
7472
* @brief Text frame.
7573
*/
76-
OP_TEXT = 0x01,
74+
OP_TEXT = 0x01,
7775

7876
/**
7977
* @brief Binary frame.
8078
*/
81-
OP_BINARY = 0x02,
79+
OP_BINARY = 0x02,
8280

8381
/**
8482
* @brief Close notification with close code.
8583
*/
86-
OP_CLOSE = 0x08,
84+
OP_CLOSE = 0x08,
8785

8886
/**
8987
* @brief Low level ping.
9088
*/
91-
OP_PING = 0x09,
89+
OP_PING = 0x09,
9290

9391
/**
9492
* @brief Low level pong.
9593
*/
96-
OP_PONG = 0x0a
94+
OP_PONG = 0x0a
9795
};
9896

9997
/**
@@ -130,7 +128,7 @@ class DPP_EXPORT websocket_client : public ssl_client {
130128
* @param buffer The buffer to operate on. Will modify the string removing completed items from the head of the queue
131129
* @return true if a complete header has been received
132130
*/
133-
bool parseheader(std::string &buffer);
131+
bool parseheader(std::string& buffer);
134132

135133
/**
136134
* @brief Unpack a frame and pass completed frames up the stack.
@@ -139,7 +137,7 @@ class DPP_EXPORT websocket_client : public ssl_client {
139137
* @param first True if is the first element (reserved for future use)
140138
* @return true if a complete frame has been received
141139
*/
142-
bool unpack(std::string &buffer, uint32_t offset, bool first = true);
140+
bool unpack(std::string& buffer, uint32_t offset, bool first = true);
143141

144142
/**
145143
* @brief Fill a header for outbound messages
@@ -151,11 +149,10 @@ class DPP_EXPORT websocket_client : public ssl_client {
151149
size_t fill_header(unsigned char* outbuf, size_t sendlength, ws_opcode opcode);
152150

153151
/**
154-
* @brief Handle ping and pong requests.
155-
* @param ping True if this is a ping, false if it is a pong
156-
* @param payload The ping payload, to be returned as-is for a ping
152+
* @brief Handle ping requests.
153+
* @param payload The ping payload, to be returned as-is for a pong
157154
*/
158-
void handle_ping_pong(bool ping, const std::string &payload);
155+
void handle_ping(const std::string& payload);
159156

160157
protected:
161158

@@ -168,7 +165,7 @@ class DPP_EXPORT websocket_client : public ssl_client {
168165
* @brief Get websocket state
169166
* @return websocket state
170167
*/
171-
ws_state get_state();
168+
[[nodiscard]] ws_state get_state() const;
172169

173170
public:
174171

@@ -181,41 +178,41 @@ class DPP_EXPORT websocket_client : public ssl_client {
181178
* @note Voice websockets only support OP_TEXT, and other websockets must be
182179
* OP_BINARY if you are going to send ETF.
183180
*/
184-
websocket_client(const std::string &hostname, const std::string &port = "443", const std::string &urlpath = "", ws_opcode opcode = OP_BINARY);
181+
websocket_client(const std::string& hostname, const std::string& port = "443", const std::string& urlpath = "", ws_opcode opcode = OP_BINARY);
185182

186183
/**
187184
* @brief Destroy the websocket client object
188185
*/
189-
virtual ~websocket_client() = default;
186+
virtual ~websocket_client() = default;
190187

191188
/**
192189
* @brief Write to websocket. Encapsulates data in frames if the status is CONNECTED.
193190
* @param data The data to send.
194191
*/
195-
virtual void write(const std::string &data);
192+
virtual void write(const std::string_view data);
196193

197194
/**
198195
* @brief Processes incoming frames from the SSL socket input buffer.
199196
* @param buffer The buffer contents. Can modify this value removing the head elements when processed.
200197
*/
201-
virtual bool handle_buffer(std::string &buffer);
198+
virtual bool handle_buffer(std::string& buffer);
202199

203200
/**
204201
* @brief Close websocket
205202
*/
206-
virtual void close();
203+
virtual void close();
207204

208205
/**
209206
* @brief Receives raw frame content only without headers
210-
*
207+
*
211208
* @param buffer The buffer contents
212209
* @return True if the frame was successfully handled. False if no valid frame is in the buffer.
213210
*/
214-
virtual bool handle_frame(const std::string &buffer);
211+
virtual bool handle_frame(const std::string& buffer);
215212

216213
/**
217214
* @brief Called upon error frame.
218-
*
215+
*
219216
* @param errorcode The error code from the websocket server
220217
*/
221218
virtual void error(uint32_t errorcode);

0 commit comments

Comments
 (0)