Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
889 changes: 221 additions & 668 deletions 3rdParty/dpp/appcommand.h

Large diffs are not rendered by default.

483 changes: 61 additions & 422 deletions 3rdParty/dpp/application.h

Large diffs are not rendered by default.

557 changes: 145 additions & 412 deletions 3rdParty/dpp/auditlog.h

Large diffs are not rendered by default.

240 changes: 100 additions & 140 deletions 3rdParty/dpp/automod.h

Large diffs are not rendered by default.

42 changes: 20 additions & 22 deletions 3rdParty/dpp/ban.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
*
* D++, A Lightweight C++ library for Discord
*
* SPDX-License-Identifier: Apache-2.0
* Copyright 2021 Craig Edwards and D++ contributors
* (https://github.com/brainboxdotcc/DPP/graphs/contributors)
*
Expand All @@ -23,7 +22,7 @@
#pragma once
#include <dpp/export.h>
#include <dpp/snowflake.h>
#include <dpp/json_fwd.h>
#include <dpp/nlohmann/json_fwd.hpp>
#include <dpp/json_interface.h>
#include <unordered_map>

Expand All @@ -34,36 +33,35 @@ namespace dpp {
*
*/
class DPP_EXPORT ban : public json_interface<ban> {
protected:
friend struct json_interface<ban>;

/** Read class values from json object
* @param j A json object to read from
* @return A reference to self
*/
ban& fill_from_json_impl(nlohmann::json* j);

public:
/**
* @brief The ban reason.
*/
/** The ban reason */
std::string reason;

/**
* @brief User ID the ban applies to.
*/
/** User ID the ban applies to */
snowflake user_id;

/** Constructor */
ban();

/** Destructor */
virtual ~ban() = default;

/** Read class values from json object
* @param j A json object to read from
* @return A reference to self
*/
ban& fill_from_json(nlohmann::json* j);

/**
* @brief Build json representation of a ban
* @param with_id Include ID in json
*
* @return std::string stringified json
*/
std::string build_json(bool with_id = false) const;
};

/**
* @brief A group of bans. The key is the user ID.
/** A group of bans
*/
typedef std::unordered_map<snowflake, ban> ban_map;

}
};
101 changes: 0 additions & 101 deletions 3rdParty/dpp/bignum.h

This file was deleted.

16 changes: 7 additions & 9 deletions 3rdParty/dpp/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
*
* D++, A Lightweight C++ library for Discord
*
* SPDX-License-Identifier: Apache-2.0
* Copyright 2021 Craig Edwards and D++ contributors
* (https://github.com/brainboxdotcc/DPP/graphs/contributors)
*
Expand Down Expand Up @@ -65,7 +64,7 @@ template<class T> class cache {
/**
* @brief Construct a new cache object.
*
* @note Caches must contain classes derived from dpp::managed.
* Caches must contain classes derived from dpp::managed.
*/
cache() {
cache_map = new std::unordered_map<snowflake, T*>;
Expand Down Expand Up @@ -109,7 +108,7 @@ template<class T> class cache {
} else if (object != existing->second) {
/* Flag old pointer for deletion and replace */
std::lock_guard<std::mutex> delete_lock(deletion_mutex);
deletion_queue[existing->second] = time(nullptr);
deletion_queue[existing->second] = time(NULL);
(*cache_map)[object->id] = object;
}
}
Expand All @@ -134,7 +133,7 @@ template<class T> class cache {
auto existing = cache_map->find(object->id);
if (existing != cache_map->end()) {
cache_map->erase(existing);
deletion_queue[object] = time(nullptr);
deletion_queue[object] = time(NULL);
}
}

Expand Down Expand Up @@ -250,18 +249,17 @@ template<class T> class cache {
*/
size_t bytes() {
std::shared_lock l(cache_mutex);
return sizeof(*this) + (cache_map->bucket_count() * sizeof(size_t));
return sizeof(this) + (cache_map->bucket_count() * sizeof(size_t));
}

};

/**
* Run garbage collection across all caches removing deleted items
/** Run garbage collection across all caches removing deleted items
* that have been deleted over 60 seconds ago.
*/
void DPP_EXPORT garbage_collection();

#define cache_decl(type, setter, getter, counter) /** Find an object in the cache by id. @return type* Pointer to the object or nullptr when it's not found */ DPP_EXPORT class type * setter (snowflake id); DPP_EXPORT cache<class type> * getter (); /** Get the amount of cached type objects. */ DPP_EXPORT uint64_t counter ();
#define cache_decl(type, setter, getter, counter) DPP_EXPORT class type * setter (snowflake id); DPP_EXPORT cache<class type> * getter (); DPP_EXPORT uint64_t counter ();

/* Declare major caches */
cache_decl(user, find_user, get_user_cache, get_user_count);
Expand All @@ -270,5 +268,5 @@ cache_decl(role, find_role, get_role_cache, get_role_count);
cache_decl(channel, find_channel, get_channel_cache, get_channel_count);
cache_decl(emoji, find_emoji, get_emoji_cache, get_emoji_count);

}
};

Loading