Format C++ files using clang-format

This commit is contained in:
Oliver Hamlet
2017-11-13 15:56:54 +00:00
parent 42caccaafb
commit 701e063153
93 changed files with 3538 additions and 2521 deletions
+15
View File
@@ -0,0 +1,15 @@
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -2
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
BinPackArguments: false
BinPackParameters: false
BreakConstructorInitializers: AfterColon
ConstructorInitializerAllOnOneLineOrOnePerLine: true
FixNamespaceComments: false
SpaceAfterTemplateKeyword: false
Standard: Cpp11
...
+3 -12
View File
@@ -21,13 +21,9 @@ When you do make a pull request, please do so from a branch which doesn't have t
## Code Style
LOOT's JavaScript uses a slightly tweaked version of the Airbnb style, and can be automatically linted by ESLint, so isn't covered here.
The LOOT API code style is based on the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). Formatting style is codified in the repository's `.clang-format` file, but is not enforced.
### C++ Code Style
The [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) is used as the base, with deviations as listed below.
#### C++ Features
### C++ Features
* Static variables may contain non-POD types.
* Reference arguments don't need to be `const` (ie. they can be used for output variables).
@@ -36,12 +32,7 @@ The [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
* There's no restriction on which Boost libraries can be used.
* Specialising `std::hash` is allowed.
#### Naming
### Naming
* Constant, enumerator and variable names should use `camelCase` or `underscore_separators`, but they should be consistent within the same scope.
* Function names should use `PascalCase` or `camelCase`, but they should be consistent within the same scope.
#### Formatting
* Line length doesn't matter.
* `public`, `protected` and `private` keywords should not be indented within a class declaration.
+33 -24
View File
@@ -26,41 +26,46 @@
#define LOOT_API_H
#include <functional>
#include <string>
#include <memory>
#include <string>
#include "loot/api_decorator.h"
#include "loot/game_interface.h"
#include "loot/exception/error_categories.h"
#include "loot/exception/condition_syntax_error.h"
#include "loot/exception/cyclic_interaction_error.h"
#include "loot/exception/file_access_error.h"
#include "loot/exception/git_state_error.h"
#include "loot/enum/game_type.h"
#include "loot/enum/log_level.h"
#include "loot/exception/condition_syntax_error.h"
#include "loot/exception/cyclic_interaction_error.h"
#include "loot/exception/error_categories.h"
#include "loot/exception/file_access_error.h"
#include "loot/exception/git_state_error.h"
#include "loot/game_interface.h"
#include "loot/loot_version.h"
namespace loot {
/**@}*/
/**********************************************************************//**
* @name Logging Functions
*************************************************************************/
/**********************************************************************/ /**
* @name
*Logging
*Functions
*************************************************************************/
/**@{*/
/**
* @brief Set the callback function that is called when logging.
* @details If this function is not called, the default behaviour is to
* @details If this function is not called, the default behaviour is to
* print messages to the console.
* @param callback
* The function called when logging. The first parameter is the
* level of the message being logged, and the second is the message.
*/
LOOT_API void SetLoggingCallback(std::function<void(LogLevel, const char*)> callback);
LOOT_API void SetLoggingCallback(
std::function<void(LogLevel, const char*)> callback);
/**@}*/
/**********************************************************************//**
* @name Version Functions
*************************************************************************/
/**********************************************************************/ /**
* @name
*Version
*Functions
*************************************************************************/
/**@{*/
/**
@@ -81,9 +86,12 @@ LOOT_API bool IsCompatible(const unsigned int major,
const unsigned int patch);
/**@}*/
/**********************************************************************//**
* @name Lifecycle Management Functions
*************************************************************************/
/**********************************************************************/ /**
* @name
*Lifecycle
*Management
*Functions
*************************************************************************/
/**@{*/
/**
@@ -108,15 +116,16 @@ LOOT_API void InitialiseLocale(const std::string& id);
* sibling Data folder and by searching for the game's Registry entry.
* @param game_local_path
* The relative or absolute path to the game's folder in
* `%%LOCALAPPDATA%` or an empty string. If an empty string, the API will
* attempt to look up the path that `%%LOCALAPPDATA%` corresponds to.
* This parameter is provided so that systems lacking that environmental
* `%%LOCALAPPDATA%` or an empty string. If an empty string, the API
* will attempt to look up the path that `%%LOCALAPPDATA%` corresponds to. This
* parameter is provided so that systems lacking that environmental
* variable (eg. Linux) can still use the API.
* @returns The new game handle.
*/
LOOT_API std::shared_ptr<GameInterface> CreateGameHandle(const GameType game,
const std::string& game_path = "",
const std::string& game_local_path = "");
LOOT_API std::shared_ptr<GameInterface> CreateGameHandle(
const GameType game,
const std::string& game_path = "",
const std::string& game_local_path = "");
}
#endif
+8 -8
View File
@@ -30,15 +30,15 @@
that use this header do not need to define anything to import the symbols
properly. */
#if defined(_WIN32)
# ifdef LOOT_STATIC
# define LOOT_API
# elif defined LOOT_EXPORT
# define LOOT_API __declspec(dllexport)
# else
# define LOOT_API __declspec(dllimport)
# endif
#ifdef LOOT_STATIC
#define LOOT_API
#elif defined LOOT_EXPORT
#define LOOT_API __declspec(dllexport)
#else
# define LOOT_API
#define LOOT_API __declspec(dllimport)
#endif
#else
#define LOOT_API
#endif
#endif
+31 -27
View File
@@ -136,8 +136,9 @@ public:
* character hash will be outputted.
* @returns The revision data.
*/
virtual MasterlistInfo GetMasterlistRevision(const std::string& masterlist_path,
const bool get_short_id) const = 0;
virtual MasterlistInfo GetMasterlistRevision(
const std::string& masterlist_path,
const bool get_short_id) const = 0;
/**
* Check if the given masterlist is the latest available for a given branch.
@@ -176,7 +177,8 @@ public:
* @returns A vector of messages supplied in the metadata lists but not
* attached to any particular plugin.
*/
virtual std::vector<Message> GetGeneralMessages(bool evaluateConditions = false) const = 0;
virtual std::vector<Message> GetGeneralMessages(
bool evaluateConditions = false) const = 0;
/**
* @}
@@ -200,32 +202,34 @@ public:
* If the plugin has no metadata, PluginMetadata.IsNameOnly()
* will return true.
*/
virtual PluginMetadata GetPluginMetadata(const std::string& plugin,
bool includeUserMetadata = true,
bool evaluateConditions = false) const = 0;
virtual PluginMetadata GetPluginMetadata(
const std::string& plugin,
bool includeUserMetadata = true,
bool evaluateConditions = false) const = 0;
/**
* @brief Get a plugin's metadata loaded from the given userlist.
* @param plugin
* The filename of the plugin to look up user-added metadata for.
* @param evaluateConditions
* If true, any metadata conditions are evaluated before the metadata
* is returned, otherwise unevaluated metadata is returned. Evaluating
* plugin metadata conditions does not clear the condition cache.
* @returns A PluginMetadata object containing the plugin's user-added
* metadata. If the plugin has no metadata,
* PluginMetadata.IsNameOnly() will return true.
*/
virtual PluginMetadata GetPluginUserMetadata(const std::string& plugin,
bool evaluateConditions = false) const = 0;
* @brief Get a plugin's metadata loaded from the given userlist.
* @param plugin
* The filename of the plugin to look up user-added metadata for.
* @param evaluateConditions
* If true, any metadata conditions are evaluated before the metadata
* is returned, otherwise unevaluated metadata is returned. Evaluating
* plugin metadata conditions does not clear the condition cache.
* @returns A PluginMetadata object containing the plugin's user-added
* metadata. If the plugin has no metadata,
* PluginMetadata.IsNameOnly() will return true.
*/
virtual PluginMetadata GetPluginUserMetadata(
const std::string& plugin,
bool evaluateConditions = false) const = 0;
/**
* @brief Sets a plugin's user metadata, overwriting any existing user
* metadata.
* @param pluginMetadata
* The user metadata you want to set, with plugin.Name() being the
* filename of the plugin the metadata is for.
*/
* @brief Sets a plugin's user metadata, overwriting any existing user
* metadata.
* @param pluginMetadata
* The user metadata you want to set, with plugin.Name() being the
* filename of the plugin the metadata is for.
*/
virtual void SetPluginUserMetadata(const PluginMetadata& pluginMetadata) = 0;
/**
@@ -238,8 +242,8 @@ public:
virtual void DiscardPluginUserMetadata(const std::string& plugin) = 0;
/**
* @brief Discards all loaded user metadata for all plugins, and any user-added
* general messages and known bash tags.
* @brief Discards all loaded user metadata for all plugins, and any
* user-added general messages and known bash tags.
*/
virtual void DiscardAllUserMetadata() = 0;
-1
View File
@@ -25,7 +25,6 @@ along with LOOT. If not, see
#ifndef LOOT_GAME_TYPE
#define LOOT_GAME_TYPE
/**
* The namespace used by the LOOT API.
*/
@@ -41,36 +41,34 @@ public:
* @param backCycle A string describing the path from lastPlugin to
* firstPlugin.
*/
CyclicInteractionError(const std::string& firstPlugin, const std::string& lastPlugin, const std::string& backCycle) :
std::runtime_error("Cyclic interaction detected between plugins \"" + firstPlugin + "\" and \"" + lastPlugin + "\". Back cycle: " + backCycle),
firstPlugin_(firstPlugin),
lastPlugin_(lastPlugin),
backCycle_(backCycle) {}
CyclicInteractionError(const std::string& firstPlugin,
const std::string& lastPlugin,
const std::string& backCycle) :
std::runtime_error("Cyclic interaction detected between plugins \"" +
firstPlugin + "\" and \"" + lastPlugin +
"\". Back cycle: " + backCycle),
firstPlugin_(firstPlugin),
lastPlugin_(lastPlugin),
backCycle_(backCycle) {}
/**
* Get the first plugin in the chosen forward path of the cycle.
* @return A plugin filename.
*/
std::string getFirstPlugin() {
return firstPlugin_;
}
std::string getFirstPlugin() { return firstPlugin_; }
/**
* Get the first plugin in the chosen forward path of the cycle.
* @return A plugin filename.
*/
std::string getLastPlugin() {
return lastPlugin_;
}
std::string getLastPlugin() { return lastPlugin_; }
/**
* Get a description of the reverse path from the chosen last plugin to the
* chosen first plugin of the cycle.
* @return A string describing a path between two plugins in the plugin graph.
*/
std::string getBackCycle() {
return backCycle_;
}
std::string getBackCycle() { return backCycle_; }
private:
const std::string firstPlugin_;
+32 -28
View File
@@ -72,7 +72,8 @@ public:
* file if it has been identified by a previous call to
* ``IdentifyMainMasterFile()``.
*/
virtual void LoadPlugins(const std::vector<std::string>& plugins, bool loadHeadersOnly) = 0;
virtual void LoadPlugins(const std::vector<std::string>& plugins,
bool loadHeadersOnly) = 0;
/**
* @brief Get data for a loaded plugin.
@@ -83,7 +84,8 @@ public:
* until the ``LoadPlugins()`` or ``SortPlugins()`` functions are
* next called or this GameInterface is destroyed.
*/
virtual std::shared_ptr<const PluginInterface> GetPlugin(const std::string& pluginName) const = 0;
virtual std::shared_ptr<const PluginInterface> GetPlugin(
const std::string& pluginName) const = 0;
/**
* @brief Get a set of const references to all loaded plugins' PluginInterface
@@ -92,43 +94,45 @@ public:
* valid until the ``LoadPlugins()`` or ``SortPlugins()`` functions
* are next called or this GameInterface is destroyed.
*/
virtual std::set<std::shared_ptr<const PluginInterface>> GetLoadedPlugins() const = 0;
virtual std::set<std::shared_ptr<const PluginInterface>> GetLoadedPlugins()
const = 0;
/**
* @}
* @name Sorting
* @{
*/
* @}
* @name Sorting
* @{
*/
/**
* @brief Identify the game's main master file.
* @details When sorting, LOOT always only loads the headers of the game's
* main master file as a performance optimisation.
*/
* @brief Identify the game's main master file.
* @details When sorting, LOOT always only loads the headers of the game's
* main master file as a performance optimisation.
*/
virtual void IdentifyMainMasterFile(const std::string& masterFile) = 0;
/**
* @brief Calculates a new load order for the game's installed plugins
* (including inactive plugins) and outputs the sorted order.
* @details Pulls metadata from the masterlist and userlist if they are
* loaded, and reads the contents of each plugin. No changes are
* applied to the load order used by the game. This function does
* not load or evaluate the masterlist or userlist.
* @param plugins
* A vector of filenames of the plugins to sort.
* @returns A vector of the given plugin filenames in their sorted load
* order.
*/
virtual std::vector<std::string> SortPlugins(const std::vector<std::string>& plugins) = 0;
* @brief Calculates a new load order for the game's installed plugins
* (including inactive plugins) and outputs the sorted order.
* @details Pulls metadata from the masterlist and userlist if they are
* loaded, and reads the contents of each plugin. No changes are
* applied to the load order used by the game. This function does
* not load or evaluate the masterlist or userlist.
* @param plugins
* A vector of filenames of the plugins to sort.
* @returns A vector of the given plugin filenames in their sorted load
* order.
*/
virtual std::vector<std::string> SortPlugins(
const std::vector<std::string>& plugins) = 0;
/**
* @}
* @name Load Order Interaction
* @{
*/
* @}
* @name Load Order Interaction
* @{
*/
/**
*
*
* @brief Load the current load order state, discarding any previously held
* state.
* @details This function should be called whenever the load order or active
@@ -69,6 +69,7 @@ public:
* @return The object's condition string.
*/
LOOT_API std::string GetCondition() const;
private:
std::string condition_;
};
+5 -3
View File
@@ -51,7 +51,8 @@ public:
* The File's condition string.
* @return A File object.
*/
LOOT_API File(const std::string& name, const std::string& display = "",
LOOT_API File(const std::string& name,
const std::string& display = "",
const std::string& condition = "");
/**
@@ -60,14 +61,14 @@ public:
* @returns True if this File's name is case-insensitively lexicographically
* less than the given File's name, false otherwise.
*/
LOOT_API bool operator < (const File& rhs) const;
LOOT_API bool operator<(const File& rhs) const;
/**
* Check if two File objects are equal by comparing their filenames.
* @returns True if the filenames are case-insensitively equal, false
* otherwise.
*/
LOOT_API bool operator == (const File& rhs) const;
LOOT_API bool operator==(const File& rhs) const;
/**
* Get the filename of the file.
@@ -80,6 +81,7 @@ public:
* @return The file's display name.
*/
LOOT_API std::string GetDisplayName() const;
private:
std::string name_;
std::string display_;
+3 -2
View File
@@ -58,13 +58,13 @@ public:
* lexicographically less than the given Location's URL, false
* otherwise.
*/
LOOT_API bool operator < (const Location& rhs) const;
LOOT_API bool operator<(const Location& rhs) const;
/**
* Check if two Location objects are equal by comparing their URLs.
* @returns True if the URLs are case-insensitively equal, false otherwise.
*/
LOOT_API bool operator == (const Location& rhs) const;
LOOT_API bool operator==(const Location& rhs) const;
/**
* Get the object's URL.
@@ -77,6 +77,7 @@ public:
* @return The name of the location.
*/
LOOT_API std::string GetName() const;
private:
std::string url_;
std::string name_;
+8 -5
View File
@@ -28,9 +28,9 @@
#include <vector>
#include "loot/api_decorator.h"
#include "loot/enum/message_type.h"
#include "loot/metadata/conditional_metadata.h"
#include "loot/metadata/message_content.h"
#include "loot/enum/message_type.h"
#include "loot/struct/simple_message.h"
namespace loot {
@@ -57,7 +57,8 @@ public:
* A condition string.
* @return A Message object.
*/
LOOT_API Message(const MessageType type, const std::string& content,
LOOT_API Message(const MessageType type,
const std::string& content,
const std::string& condition = "");
/**
@@ -71,7 +72,8 @@ public:
* A condition string.
* @return A Message object.
*/
LOOT_API Message(const MessageType type, const std::vector<MessageContent>& content,
LOOT_API Message(const MessageType type,
const std::vector<MessageContent>& content,
const std::string& condition = "");
/**
@@ -83,13 +85,13 @@ public:
* Otherwise returns true if this Message has no content, and false
* otherwise.
*/
LOOT_API bool operator < (const Message& rhs) const;
LOOT_API bool operator<(const Message& rhs) const;
/**
* Check if two Message objects are equal by comparing their content.
* @returns True if the contents are equal, false otherwise.
*/
LOOT_API bool operator == (const Message& rhs) const;
LOOT_API bool operator==(const Message& rhs) const;
/**
* Get the message type.
@@ -120,6 +122,7 @@ public:
* if message text is not available for the given language.
*/
LOOT_API SimpleMessage ToSimpleMessage(const std::string& language) const;
private:
MessageType type_;
std::vector<MessageContent> content_;
+6 -4
View File
@@ -77,13 +77,13 @@ public:
* lexicographically less than the given MessageContent's text, false
* otherwise.
*/
LOOT_API bool operator < (const MessageContent& rhs) const;
LOOT_API bool operator<(const MessageContent& rhs) const;
/**
* Check if two MessageContent objects are equal by comparing their texts.
* @returns True if the texts are case-insensitively equal, false otherwise.
*/
LOOT_API bool operator == (const MessageContent& rhs) const;
LOOT_API bool operator==(const MessageContent& rhs) const;
/**
* Choose a MessageContent object from a vector given a language.
@@ -96,8 +96,10 @@ public:
* @return A MessageContent object. If the given vector is empty, a
* default-constructed MessageContent is returned.
*/
LOOT_API static MessageContent Choose(const std::vector<MessageContent> content,
const std::string& language);
LOOT_API static MessageContent Choose(
const std::vector<MessageContent> content,
const std::string& language);
private:
std::string text_;
std::string language_;
+3 -2
View File
@@ -87,13 +87,13 @@ public:
* @returns True if this PluginCleaningData's CRC is less than the given
* PluginCleaningData's CRC, false otherwise.
*/
LOOT_API bool operator < (const PluginCleaningData& rhs) const;
LOOT_API bool operator<(const PluginCleaningData& rhs) const;
/**
* Check if two PluginCleaningData objects are equal by comparing their CRCs.
* @returns True if the CRCs are equal, false otherwise.
*/
LOOT_API bool operator == (const PluginCleaningData& rhs) const;
LOOT_API bool operator==(const PluginCleaningData& rhs) const;
/**
* Get the CRC that identifies the plugin that the cleaning data is for.
@@ -143,6 +143,7 @@ public:
* does not exist, the English-language MessageContent object.
*/
LOOT_API MessageContent ChooseInfo(const std::string& language) const;
private:
uint32_t crc_;
unsigned int itm_;
+14 -11
View File
@@ -60,8 +60,9 @@ public:
*/
LOOT_API PluginMetadata(const std::string& name);
//Merges from the given plugin into this one, unless there is already equal metadata present.
//For 'enabled' and 'priority' metadata, use the given plugin's values, but if the 'priority' user value is zero, ignore it.
// Merges from the given plugin into this one, unless there is already equal
// metadata present. For 'enabled' and 'priority' metadata, use the given
// plugin's values, but if the 'priority' user value is zero, ignore it.
/**
* Merge metadata from the given PluginMetadata object into this object.
*
@@ -75,8 +76,9 @@ public:
LOOT_API void MergeMetadata(const PluginMetadata& plugin);
// Returns metadata in this plugin not in the given plugin.
//For 'enabled', use this plugin's value.
//For 'priority', use 0 if the two plugin priorities are equal, and make it not explicit. Otherwise use this plugin's value.
// For 'enabled', use this plugin's value.
// For 'priority', use 0 if the two plugin priorities are equal, and make it
// not explicit. Otherwise use this plugin's value.
/**
* Get metadata in this object that isn't present in the given PluginMetadata
@@ -176,7 +178,8 @@ public:
* The language to create the SimpleMessage objects for.
* @return The plugin's messages as SimpleMessage objects.
*/
LOOT_API std::vector<SimpleMessage> GetSimpleMessages(const std::string& language) const;
LOOT_API std::vector<SimpleMessage> GetSimpleMessages(
const std::string& language) const;
/**
* Set whether the plugin metadata is enabled for use during sorting or not.
@@ -275,7 +278,7 @@ public:
* @returns True if the plugin names are case-insensitively equal, false
* otherwise.
*/
LOOT_API bool operator == (const PluginMetadata& rhs) const;
LOOT_API bool operator==(const PluginMetadata& rhs) const;
/**
* Check if two PluginMetadata objects are not equal by comparing their name
@@ -283,22 +286,22 @@ public:
* @returns True if the plugin names are not case-insensitively equal, false
* otherwise.
*/
LOOT_API bool operator != (const PluginMetadata& rhs) const;
LOOT_API bool operator!=(const PluginMetadata& rhs) const;
/**
* Check if object's name value is equal to the given string.
* @returns True if the plugin name is case-insensitively equal to the given
* string, false otherwise.
*/
LOOT_API bool operator == (const std::string& rhs) const;
LOOT_API bool operator==(const std::string& rhs) const;
/**
* Check if object's name value is not equal to the given string.
* @returns True if the plugin name is not case-insensitively equal to the
* given string, false otherwise.
*/
LOOT_API bool operator != (const std::string& rhs) const;
LOOT_API bool operator!=(const std::string& rhs) const;
private:
std::string name_;
bool enabled_;
@@ -326,7 +329,7 @@ struct hash<loot::PluginMetadata> {
* loot::PluginMetadata.
* @return The hash generated from the plugin's lowercased filename.
*/
size_t operator() (const loot::PluginMetadata& plugin) const {
size_t operator()(const loot::PluginMetadata& plugin) const {
return hash<string>()(plugin.GetLowercasedName());
}
};
+5 -6
View File
@@ -79,36 +79,35 @@ public:
* @return True if this Priority object's value is less than the given
* Priority object's value.
*/
LOOT_API bool operator < (const Priority& rhs) const;
LOOT_API bool operator<(const Priority& rhs) const;
/**
* Check if this Priority object is greater than another.
* @return True if this Priority object's value is greater than the given
* Priority object's value, false otherwise.
*/
LOOT_API bool operator > (const Priority& rhs) const;
LOOT_API bool operator>(const Priority& rhs) const;
/**
* Check if this Priority object is greater than or equal to another.
* @return True if this Priority object's value is greater than or equal to
* the given Priority object's value, false otherwise.
*/
LOOT_API bool operator >= (const Priority& rhs) const;
LOOT_API bool operator>=(const Priority& rhs) const;
/**
* Check if this Priority object is equal to another.
* @return True if this Priority object's value is equal to the given
* Priority object's value, false otherwise.
*/
LOOT_API bool operator == (const Priority& rhs) const;
LOOT_API bool operator==(const Priority& rhs) const;
/**
* Check if this Priority object is greater than a given priority value.
* @return True if this Priority object's value is greater than the given
* value, false otherwise.
*/
LOOT_API bool operator > (const uint8_t rhs) const;
LOOT_API bool operator>(const uint8_t rhs) const;
private:
bool isExplicitZeroValue_;
+3 -2
View File
@@ -66,7 +66,7 @@ public:
* lexicographically less than the given Tag's name, false
* otherwise.
*/
LOOT_API bool operator < (const Tag& rhs) const;
LOOT_API bool operator<(const Tag& rhs) const;
/**
* Check if two Tag objects are equal.
@@ -74,7 +74,7 @@ public:
* for removal, and the Tag names are case-insensitively equal, false
* otherwise.
*/
LOOT_API bool operator == (const Tag& rhs) const;
LOOT_API bool operator==(const Tag& rhs) const;
/**
* Check if the tag should be added.
@@ -87,6 +87,7 @@ public:
* @return The tag's name.
*/
LOOT_API std::string GetName() const;
private:
std::string name_;
bool addTag_;
+4 -4
View File
@@ -86,9 +86,9 @@ public:
virtual bool IsMaster() const = 0;
/**
* Check if the plugin is a light master.
* @return True if plugin is a light master, false otherwise.
*/
* Check if the plugin is a light master.
* @return True if plugin is a light master, false otherwise.
*/
virtual bool IsLightMaster() const = 0;
/**
@@ -125,7 +125,7 @@ struct hash<loot::PluginInterface> {
* loot::PluginInterface.
* @return The hash generated from the plugin's lowercased filename.
*/
size_t operator() (const loot::PluginInterface& plugin) const {
size_t operator()(const loot::PluginInterface& plugin) const {
return hash<string>()(plugin.GetLowercasedName());
}
};
+4 -2
View File
@@ -27,7 +27,8 @@
#include "loot/enum/message_type.h"
namespace loot {
/** @brief A structure that holds the type of a message and the message string itself. */
/** @brief A structure that holds the type of a message and the message string
* itself. */
struct SimpleMessage {
/** @brief The type of the message. */
MessageType type;
@@ -37,7 +38,8 @@ struct SimpleMessage {
/**
* @brief The message string, which may be formatted using
* [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown).
* [GitHub Flavored
* Markdown](https://help.github.com/articles/github-flavored-markdown).
*/
std::string text;
+13 -7
View File
@@ -42,7 +42,8 @@ std::string ResolvePath(const std::string& path) {
return fs::read_symlink(path).string();
}
LOOT_API void SetLoggingCallback(std::function<void(LogLevel, const char*)> callback) {
LOOT_API void SetLoggingCallback(
std::function<void(LogLevel, const char*)> callback) {
auto sink = std::make_shared<SpdLoggingSink>(callback);
auto logger = std::make_shared<spdlog::logger>(LOGGER_NAME, sink);
logger->set_level(spdlog::level::level_enum::trace);
@@ -51,7 +52,9 @@ LOOT_API void SetLoggingCallback(std::function<void(LogLevel, const char*)> call
spdlog::register_logger(logger);
}
LOOT_API bool IsCompatible(const unsigned int versionMajor, const unsigned int versionMinor, const unsigned int versionPatch) {
LOOT_API bool IsCompatible(const unsigned int versionMajor,
const unsigned int versionMinor,
const unsigned int versionPatch) {
if (versionMajor > 0)
return versionMajor == loot::LootVersion::major;
else
@@ -63,16 +66,19 @@ LOOT_API void InitialiseLocale(const std::string& id) {
boost::filesystem::path::imbue(std::locale());
}
LOOT_API std::shared_ptr<GameInterface> CreateGameHandle(const GameType game,
const std::string& gamePath,
const std::string& gameLocalPath) {
LOOT_API std::shared_ptr<GameInterface> CreateGameHandle(
const GameType game,
const std::string& gamePath,
const std::string& gameLocalPath) {
const std::string resolvedGamePath = ResolvePath(gamePath);
if (!gamePath.empty() && !fs::is_directory(resolvedGamePath))
throw std::invalid_argument("Given game path \"" + gamePath + "\" does not resolve to a valid directory.");
throw std::invalid_argument("Given game path \"" + gamePath +
"\" does not resolve to a valid directory.");
const std::string resolvedGameLocalPath = ResolvePath(gameLocalPath);
if (!gameLocalPath.empty() && !fs::is_directory(resolvedGameLocalPath))
throw std::invalid_argument("Given game path \"" + gameLocalPath + "\" does not resolve to a valid directory.");
throw std::invalid_argument("Given game path \"" + gameLocalPath +
"\" does not resolve to a valid directory.");
return std::make_shared<Game>(game, resolvedGamePath, resolvedGameLocalPath);
}

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