Skip to content

Commit

Permalink
auto update to latest DPP master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
D++ Update Bot committed Aug 18, 2024
1 parent 8807513 commit b6314c7
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 52 deletions.
Binary file modified MyBot/dependencies/32/debug/bin/dpp.dll
Binary file not shown.
Binary file modified MyBot/dependencies/32/debug/lib/dpp-10.0/dpp.lib
Binary file not shown.
Binary file modified MyBot/dependencies/32/release/bin/dpp.dll
Binary file not shown.
Binary file modified MyBot/dependencies/32/release/lib/dpp-10.0/dpp.lib
Binary file not shown.
Binary file modified MyBot/dependencies/64/debug/bin/dpp.dll
Binary file not shown.
Binary file modified MyBot/dependencies/64/debug/lib/dpp-10.0/dpp.lib
Binary file not shown.
Binary file modified MyBot/dependencies/64/release/bin/dpp.dll
Binary file not shown.
Binary file modified MyBot/dependencies/64/release/lib/dpp-10.0/dpp.lib
Binary file not shown.
32 changes: 6 additions & 26 deletions MyBot/dependencies/include/dpp-10.0/dpp/coro/awaitable.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,31 +534,19 @@ class basic_promise : public detail::promise::promise_base<T> {
}

/**
* @brief Construct the result by copy, and resume any awaiter.
*
* @tparam Notify Whether to resume any awaiter or not.
* @throws dpp::logic_exception if the promise is not empty.
*/
template <bool Notify = true, typename U = T>
requires (std::convertible_to<const U&, T>)
void set_value(const U& v) {
emplace_value<Notify>(v);
}

/**
* @brief Construct the result by move, and resume any awaiter.
* @brief Construct the result by forwarding reference, and resume any awaiter.
*
* @tparam Notify Whether to resume any awaiter or not.
* @throws dpp::logic_exception if the promise is not empty.
*/
template <bool Notify = true, typename U = T>
requires (std::convertible_to<U&&, T>)
void set_value(U&& v) {
emplace_value<Notify>(std::move(v));
emplace_value<Notify>(std::forward<U>(v));
}

/**
* @brief Construct the result by move, and resume any awaiter.
* @brief Construct a void result, and resume any awaiter.
*
* @tparam Notify Whether to resume any awaiter or not.
* @throws dpp::logic_exception if the promise is not empty.
Expand Down Expand Up @@ -605,19 +593,11 @@ class moveable_promise {
}

/**
* @copydoc basic_promise<T>::set_value(const T&)
*/
template <bool Notify = true, typename U = T>
void set_value(const U& v) requires (std::convertible_to<const U&, T>) {
shared_state->template set_value<Notify>(v);
}

/**
* @copydoc basic_promise<T>::set_value(T&&)
* @copydoc basic_promise<T>::set_value(U&&)
*/
template <bool Notify = true, typename U = T>
void set_value(U&& v) requires (std::convertible_to<const U&, T>) {
shared_state->template set_value<Notify>(std::move(v));
void set_value(U&& v) requires (std::convertible_to<U&&, T>) {
shared_state->template set_value<Notify>(std::forward<U>(v));
}

/**
Expand Down
24 changes: 24 additions & 0 deletions MyBot/dependencies/include/dpp-10.0/dpp/snowflake.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
#include <cstdint>
#include <type_traits>

#ifdef DPP_FORMATTERS
#include <format>
#endif

/**
* @brief The main namespace for D++ functions. classes and types
*/
Expand Down Expand Up @@ -281,3 +285,23 @@ struct std::hash<dpp::snowflake>
return std::hash<uint64_t>{}(s.value);
}
};

#ifdef DPP_FORMATTERS
/*
* @brief implementation of formater for dpp::snowflake for std::format support
* https://en.cppreference.com/w/cpp/utility/format/formatter
*/
template <>
struct std::formatter<dpp::snowflake>
{
template<class TP>
constexpr typename TP::iterator parse(TP& ctx) {
return ctx.begin();
}

template<class TF>
typename TF::iterator format(const dpp::snowflake& snowflake, TF& ctx) const {
return std::format_to(ctx.out(), "{}", snowflake.str());
}
};
#endif //DPP_FORMATTERS
4 changes: 2 additions & 2 deletions MyBot/dependencies/include/dpp-10.0/dpp/sslclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ class DPP_EXPORT ssl_client

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

/**
* @brief Close socket connection
Expand Down
45 changes: 21 additions & 24 deletions MyBot/dependencies/include/dpp-10.0/dpp/wsclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <dpp/export.h>
#include <string>
#include <map>
#include <vector>
#include <variant>
#include <dpp/sslclient.h>

namespace dpp {
Expand All @@ -37,7 +35,7 @@ enum websocket_protocol_t : uint8_t {
* @brief JSON data, text, UTF-8 character set
*/
ws_json = 0,

/**
* @brief Erlang Term Format (ETF) binary protocol
*/
Expand Down Expand Up @@ -68,32 +66,32 @@ enum ws_opcode : uint8_t {
/**
* @brief Continuation.
*/
OP_CONTINUATION = 0x00,
OP_CONTINUATION = 0x00,

/**
* @brief Text frame.
*/
OP_TEXT = 0x01,
OP_TEXT = 0x01,

/**
* @brief Binary frame.
*/
OP_BINARY = 0x02,
OP_BINARY = 0x02,

/**
* @brief Close notification with close code.
*/
OP_CLOSE = 0x08,
OP_CLOSE = 0x08,

/**
* @brief Low level ping.
*/
OP_PING = 0x09,
OP_PING = 0x09,

/**
* @brief Low level pong.
*/
OP_PONG = 0x0a
OP_PONG = 0x0a
};

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

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

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

/**
* @brief Handle ping and pong requests.
* @param ping True if this is a ping, false if it is a pong
* @param payload The ping payload, to be returned as-is for a ping
* @brief Handle ping requests.
* @param payload The ping payload, to be returned as-is for a pong
*/
void handle_ping_pong(bool ping, const std::string &payload);
void handle_ping(const std::string& payload);

protected:

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

public:

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

/**
* @brief Destroy the websocket client object
*/
virtual ~websocket_client() = default;
virtual ~websocket_client() = default;

/**
* @brief Write to websocket. Encapsulates data in frames if the status is CONNECTED.
* @param data The data to send.
*/
virtual void write(const std::string &data);
virtual void write(const std::string_view data);

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

/**
* @brief Close websocket
*/
virtual void close();
virtual void close();

/**
* @brief Receives raw frame content only without headers
*
*
* @param buffer The buffer contents
* @return True if the frame was successfully handled. False if no valid frame is in the buffer.
*/
virtual bool handle_frame(const std::string &buffer);
virtual bool handle_frame(const std::string& buffer);

/**
* @brief Called upon error frame.
*
*
* @param errorcode The error code from the websocket server
*/
virtual void error(uint32_t errorcode);
Expand Down

0 comments on commit b6314c7

Please sign in to comment.