Make all constructors explicit

This commit is contained in:
Oliver Hamlet
2019-11-05 20:46:38 +00:00
parent 8b0c057ca3
commit 8f690e8579
22 changed files with 46 additions and 44 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ public:
* Construct a ConditionalMetadata object with an empty condition string.
* @return A ConditionalMetadata object.
*/
LOOT_API ConditionalMetadata();
LOOT_API explicit ConditionalMetadata();
/**
* Construct a ConditionalMetadata object with a given condition string.
@@ -48,7 +48,7 @@ public:
* documentation.
* @return A ConditionalMetadata object.
*/
LOOT_API ConditionalMetadata(const std::string& condition);
LOOT_API explicit ConditionalMetadata(const std::string& condition);
/**
* Check if the condition string is non-empty.
+2 -2
View File
@@ -39,7 +39,7 @@ public:
* Construct a File with blank name, display and condition strings.
* @return A File object.
*/
LOOT_API File();
LOOT_API explicit File();
/**
* Construct a File with the given name, display name and condition strings.
@@ -51,7 +51,7 @@ public:
* The File's condition string.
* @return A File object.
*/
LOOT_API File(const std::string& name,
LOOT_API explicit File(const std::string& name,
const std::string& display = "",
const std::string& condition = "");
+2 -2
View File
@@ -40,7 +40,7 @@ public:
* load after.
* @return A Group object.
*/
LOOT_API Group();
LOOT_API explicit Group();
/**
* Construct a Group with the given name, description and set of groups to
@@ -53,7 +53,7 @@ public:
* A description of the group.
* @return A Group object.
*/
LOOT_API Group(const std::string& name,
LOOT_API explicit Group(const std::string& name,
const std::unordered_set<std::string>& afterGroups = {},
const std::string& description = "");
+2 -2
View File
@@ -39,7 +39,7 @@ public:
* Construct a Location with empty URL and name strings.
* @return A Location object.
*/
LOOT_API Location();
LOOT_API explicit Location();
/**
* Construct a Location with the given URL and name.
@@ -49,7 +49,7 @@ public:
* A name for the URL, eg. the page or site name.
* @return A Location object.
*/
LOOT_API Location(const std::string& url, const std::string& name = "");
LOOT_API explicit Location(const std::string& url, const std::string& name = "");
/**
* A less-than operator implemented with no semantics so that Location objects
+3 -3
View File
@@ -44,7 +44,7 @@ public:
* strings.
* @return A Message object.
*/
LOOT_API Message();
LOOT_API explicit Message();
/**
* Construct a Message object with the given type, English content and
@@ -57,7 +57,7 @@ public:
* A condition string.
* @return A Message object.
*/
LOOT_API Message(const MessageType type,
LOOT_API explicit Message(const MessageType type,
const std::string& content,
const std::string& condition = "");
@@ -72,7 +72,7 @@ public:
* A condition string.
* @return A Message object.
*/
LOOT_API Message(const MessageType type,
LOOT_API explicit Message(const MessageType type,
const std::vector<MessageContent>& content,
const std::string& condition = "");
+2 -2
View File
@@ -45,7 +45,7 @@ public:
* Construct a MessageContent object with an empty English message string.
* @return A MessageContent object.
*/
LOOT_API MessageContent();
LOOT_API explicit MessageContent();
/**
* Construct a Message object with the given text in the given language.
@@ -55,7 +55,7 @@ public:
* The language that the message is written in.
* @return A MessageContent object.
*/
LOOT_API MessageContent(const std::string& text,
LOOT_API explicit MessageContent(const std::string& text,
const std::string& language = defaultLanguage);
/**
+3 -3
View File
@@ -44,7 +44,7 @@ public:
* and no info.
* @return A PluginCleaningData object.
*/
LOOT_API PluginCleaningData();
LOOT_API explicit PluginCleaningData();
/**
* Construct a PluginCleaningData object with the given CRC and utility,
@@ -56,7 +56,7 @@ public:
* The utility that the plugin cleanliness was checked with.
* @return A PluginCleaningData object.
*/
LOOT_API PluginCleaningData(uint32_t crc, const std::string& utility);
LOOT_API explicit PluginCleaningData(uint32_t crc, const std::string& utility);
/**
* Construct a PluginCleaningData object with the given values.
@@ -75,7 +75,7 @@ public:
* The number of deleted navmeshes found in the plugin.
* @return A PluginCleaningData object.
*/
LOOT_API PluginCleaningData(uint32_t crc,
LOOT_API explicit PluginCleaningData(uint32_t crc,
const std::string& utility,
const std::vector<MessageContent>& info,
unsigned int itm,
+2 -2
View File
@@ -49,7 +49,7 @@ public:
* Construct a PluginMetadata object with a blank plugin name and no metadata.
* @return A PluginMetadata object.
*/
LOOT_API PluginMetadata();
LOOT_API explicit PluginMetadata();
/**
* Construct a PluginMetadata object with no metadata for a plugin with the
@@ -58,7 +58,7 @@ public:
* The filename of the plugin that the object is constructed for.
* @return A PluginMetadata object.
*/
LOOT_API PluginMetadata(const std::string& name);
LOOT_API explicit PluginMetadata(const std::string& name);
/**
* Merge metadata from the given PluginMetadata object into this object.
+2 -2
View File
@@ -40,7 +40,7 @@ public:
* an empty condition string.
* @return A Tag object.
*/
LOOT_API Tag();
LOOT_API explicit Tag();
/**
* Construct a Tag object with the given name, for addition or removal, with
@@ -53,7 +53,7 @@ public:
* A condition string.
* @return A Tag object.
*/
LOOT_API Tag(const std::string& tag,
LOOT_API explicit Tag(const std::string& tag,
const bool isAddition = true,
const std::string& condition = "");
+1 -1
View File
@@ -32,7 +32,7 @@ namespace loot {
* revision.
*/
struct MasterlistInfo {
inline MasterlistInfo() : is_modified(false) {}
inline explicit MasterlistInfo() : is_modified(false) {}
/**
* @brief The revision hash for the masterlist. If the masterlist doesn't
+2 -2
View File
@@ -42,14 +42,14 @@ public:
* @brief Construct a Vertex with the given name and no out edge.
* @param name The name of the plugin or group that this vertex represents.
*/
LOOT_API Vertex(std::string name);
LOOT_API explicit Vertex(std::string name);
/**
* @brief Construct a Vertex with the given name and out edge type.
* @param name The name of the plugin or group that this vertex represents.
* @param outEdgeType The type of the edge going out from this vertex.
*/
LOOT_API Vertex(std::string name, EdgeType outEdgeType);
LOOT_API explicit Vertex(std::string name, EdgeType outEdgeType);
/**
* @brief Get the name of the plugin or group.
+1 -1
View File
@@ -169,7 +169,7 @@ std::unordered_set<Group> ApiDatabase::GetGroups(bool includeUserMetadata) const
auto userlistGroups = userlist_.Groups();
for (const auto& group : masterlist_.Groups()) {
auto userlistGroup = userlistGroups.find(group.GetName());
auto userlistGroup = userlistGroups.find(group);
if (userlistGroup != userlistGroups.end()) {
auto afterGroups = group.GetAfterGroups();
auto userlistAfterGroups = userlistGroup->GetAfterGroups();
+1 -1
View File
@@ -40,7 +40,7 @@
namespace loot {
struct ApiDatabase : public DatabaseInterface {
ApiDatabase(std::shared_ptr<ConditionEvaluator> conditionEvaluator);
explicit ApiDatabase(std::shared_ptr<ConditionEvaluator> conditionEvaluator);
void LoadLists(const std::filesystem::path& masterlist_path,
const std::filesystem::path& userlist_path = "");
+1 -1
View File
@@ -36,7 +36,7 @@
namespace loot {
class Game : public GameInterface {
public:
Game(const GameType gameType,
explicit Game(const GameType gameType,
const std::filesystem::path& gamePath,
const std::filesystem::path& gameLocalDataPath = "");
+2 -2
View File
@@ -34,8 +34,8 @@
namespace loot {
class GameCache {
public:
GameCache();
GameCache(const GameCache& cache);
explicit GameCache();
explicit GameCache(const GameCache& cache);
GameCache& operator=(const GameCache& cache);
+1 -1
View File
@@ -38,7 +38,7 @@
namespace loot {
class LoadOrderHandler {
public:
LoadOrderHandler();
explicit LoadOrderHandler();
~LoadOrderHandler();
void Init(const GameType& game,
+1 -1
View File
@@ -34,7 +34,7 @@
namespace loot {
class GitHelper {
public:
GitHelper();
explicit GitHelper();
void InitialiseOptions(const std::string& branch,
const std::string& filenameToCheckout);
+1 -1
View File
@@ -40,7 +40,7 @@ inline std::shared_ptr<spdlog::logger> getLogger() {
class SpdLoggingSink : public spdlog::sinks::base_sink<std::mutex> {
public:
SpdLoggingSink(std::function<void(LogLevel, const char*)> callback) {
explicit SpdLoggingSink(std::function<void(LogLevel, const char*)> callback) {
this->callback = callback;
}
+1 -1
View File
@@ -38,7 +38,7 @@
namespace loot {
class ConditionEvaluator {
public:
ConditionEvaluator(const GameType gameType,
explicit ConditionEvaluator(const GameType gameType,
const std::filesystem::path& dataPath);
bool Evaluate(const std::string& condition);
+1 -1
View File
@@ -43,7 +43,7 @@ class GameCache;
class Plugin : public PluginInterface {
public:
Plugin(const GameType gameType,
explicit Plugin(const GameType gameType,
std::shared_ptr<GameCache> gameCache,
std::filesystem::path pluginPath,
const bool headerOnly);

Some files were not shown because too many files have changed in this diff Show More