Update WIP discord and some vendors.

CPR has features disabled and PCRE is fully disabled until updated to new code.
This commit is contained in:
Sandu Liviu Catalin committed 2023-08-05 21:31:33 +03:00
1 parent e0761bf3b9
commit 9298065cef
1562 files changed
+55070 -76299

No files matched your search

+44 -1
View File
@@ -39,11 +39,54 @@
* @brief The main namespace for D++ functions, classes and types
*/
namespace dpp {
enum sticker_format : uint8_t;
/**
* @brief Utility helper functions, generally for logging, running programs, time/date manipulation, etc
*/
namespace utility {
/**
* For internal use only. Helper function to easily create discord's cdn endpoint urls
* @see https://discord.com/developers/docs/reference#image-formatting-cdn-endpoints
* @param allowed_formats A vector of supported formats for the endpoint from the discord docs
* @param path_without_extension The path for the endpoint (without the extension e.g. `.png`)
* @param format the wished format to return. Must be one of the formats passed in `allowed_formats`, otherwise it returns an empty string
* @param size the image size which will be appended as a querystring to the url.
* It must be any power of two between 16 and 4096, otherwise no querystring will be appended (discord then returns the image as their default size)
* @param prefer_animated Whether the user prefers gif format. If true, it'll return gif format whenever the emoji is available as animated.
* In this case, the `format`-parameter is only used for non-animated images.
* @param is_animated Whether the image is actually animated or not
* @return std::string endpoint url or empty string
*/
std::string cdn_endpoint_url(const std::vector<image_type> &allowed_formats, const std::string &path_without_extension, const dpp::image_type format, uint16_t size, bool prefer_animated = false, bool is_animated = false);
/**
* For internal use only. Helper function to easily create discord's cdn endpoint urls
* @see https://discord.com/developers/docs/reference#image-formatting-cdn-endpoints
* @param allowed_formats A vector of supported formats for the endpoint from the discord docs
* @param path_without_extension The path for the endpoint (without the extension e.g. `.png`)
* @param hash The hash (optional). If passed, it will be prefixed with `a_` for animated images (`is_animated`=true)
* @param format the wished format to return. Must be one of the formats passed in `allowed_formats`, otherwise it returns an empty string
* @param size the image size which will be appended as a querystring to the url.
* It must be any power of two between 16 and 4096, otherwise no querystring will be appended (discord then returns the image as their default size)
* @param prefer_animated Whether the user prefers gif format. If true, it'll return gif format whenever the emoji is available as animated.
* In this case, the `format`-parameter is only used for non-animated images.
* @param is_animated Whether the image is actually animated or not
* @return std::string endpoint url or empty string
*/
std::string cdn_endpoint_url_hash(const std::vector<image_type> &allowed_formats, const std::string &path_without_extension, const std::string &hash, const dpp::image_type format, uint16_t size, bool prefer_animated = false, bool is_animated = false);
/**
* For internal use only. Helper function to easily create discord's cdn endpoint urls (specialised for stickers)
* @see https://discord.com/developers/docs/reference#image-formatting-cdn-endpoints
* @param sticker_id The sticker ID. Returns empty string if 0
* @param format The format type
* @return std::string endpoint url or empty string
*/
std::string cdn_endpoint_url_sticker(snowflake sticker_id, sticker_format format);
/**
* @brief Timestamp formats for dpp::utility::timestamp()
*
@@ -344,7 +387,7 @@ namespace dpp {
* @note Be aware this function can block! If you are regularly reading large files, consider caching them.
* @param filename The path to the file to read
* @return std::string The file contents
* @throw dpp::exception on failure to read the entire file
* @throw dpp::file_exception on failure to read the entire file
*/
std::string DPP_EXPORT read_file(const std::string& filename);