Merge loot_common and loot_api build targets

This commit is contained in:
Oliver Hamlet
2017-02-06 18:02:55 +00:00
parent 145549a9e9
commit f79d2d271d
11 changed files with 210 additions and 220 deletions
+84 -106
View File
@@ -162,73 +162,86 @@ set(CEF_PRECOMPILED_BINARIES_DIR "${SOURCE_DIR}/Release")
# General Settings
##############################
set (LOOT_SRC "${CMAKE_BINARY_DIR}/generated/loot_version.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/error_categories.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_evaluator.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/conditional_metadata.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/file.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/location.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/message.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/message_content.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/plugin_cleaning_data.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/plugin_metadata.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/priority.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/tag.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/game/game.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/game/game_cache.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/game/load_order_handler.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata_list.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/masterlist.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/plugin/plugin.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/plugin/plugin_sorter.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/crc.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/git_helper.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/language.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/version.cpp")
set (LOOT_HEADERS "${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_evaluator.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_grammar.h"
"${CMAKE_SOURCE_DIR}/src/backend/game/game.h"
"${CMAKE_SOURCE_DIR}/src/backend/game/game_cache.h"
"${CMAKE_SOURCE_DIR}/src/backend/game/load_order_handler.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata_list.h"
"${CMAKE_SOURCE_DIR}/src/backend/masterlist.h"
"${CMAKE_SOURCE_DIR}/src/backend/plugin/plugin.h"
"${CMAKE_SOURCE_DIR}/src/backend/plugin/plugin_sorter.h"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/git_helper.h"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/crc.h"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/version.h"
"${CMAKE_SOURCE_DIR}/include/loot/api_decorator.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/error_categories.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/condition_syntax_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/cyclic_interaction_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/file_access_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/game_detection_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/git_state_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/game_type.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/language_code.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/message_type.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/conditional_metadata.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/file.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/location.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/message.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/message_content.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/plugin_cleaning_data.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/plugin_metadata.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/priority.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/tag.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/file.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/location.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/message.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/message_content.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/plugin_cleaning_data.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/plugin_metadata.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/set.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/tag.h"
"${CMAKE_SOURCE_DIR}/include/loot/windows_encoding_converters.h"
"${CMAKE_SOURCE_DIR}/include/loot/language.h"
"${CMAKE_SOURCE_DIR}/include/loot/loot_version.h"
"${CMAKE_SOURCE_DIR}/include/loot/plugin_interface.h")
set (LOOT_API_SRC "${CMAKE_BINARY_DIR}/generated/loot_version.cpp"
"${CMAKE_SOURCE_DIR}/src/api/api.cpp"
"${CMAKE_SOURCE_DIR}/src/api/api_database.cpp"
"${CMAKE_SOURCE_DIR}/src/api/game.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/error_categories.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_evaluator.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/conditional_metadata.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/file.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/location.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/message.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/message_content.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/plugin_cleaning_data.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/plugin_metadata.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/priority.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/tag.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/game/game.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/game/game_cache.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/game/load_order_handler.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata_list.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/masterlist.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/plugin/plugin.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/plugin/plugin_sorter.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/crc.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/git_helper.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/language.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/version.cpp")
set (LOOT_API_HEADERS "${CMAKE_SOURCE_DIR}/include/loot/api.h"
"${CMAKE_SOURCE_DIR}/include/loot/api_decorator.h"
"${CMAKE_SOURCE_DIR}/include/loot/database_interface.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/error_categories.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/condition_syntax_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/cyclic_interaction_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/file_access_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/game_detection_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/git_state_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/game_type.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/language_code.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/message_type.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/plugin_cleanliness.h"
"${CMAKE_SOURCE_DIR}/include/loot/game_interface.h"
"${CMAKE_SOURCE_DIR}/include/loot/language.h"
"${CMAKE_SOURCE_DIR}/include/loot/loot_version.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/conditional_metadata.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/file.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/location.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/message.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/message_content.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/plugin_cleaning_data.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/plugin_metadata.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/priority.h"
"${CMAKE_SOURCE_DIR}/include/loot/metadata/tag.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/file.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/location.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/message.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/message_content.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/plugin_cleaning_data.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/plugin_metadata.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/set.h"
"${CMAKE_SOURCE_DIR}/include/loot/yaml/tag.h"
"${CMAKE_SOURCE_DIR}/include/loot/plugin_interface.h"
"${CMAKE_SOURCE_DIR}/include/loot/struct/masterlist_info.h"
"${CMAKE_SOURCE_DIR}/include/loot/struct/plugin_tags.h"
"${CMAKE_SOURCE_DIR}/include/loot/struct/simple_message.h"
"${CMAKE_SOURCE_DIR}/include/loot/windows_encoding_converters.h"
"${CMAKE_SOURCE_DIR}/src/api/api_database.h"
"${CMAKE_SOURCE_DIR}/src/api/game.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_evaluator.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_grammar.h"
"${CMAKE_SOURCE_DIR}/src/backend/game/game.h"
"${CMAKE_SOURCE_DIR}/src/backend/game/game_cache.h"
"${CMAKE_SOURCE_DIR}/src/backend/game/load_order_handler.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata_list.h"
"${CMAKE_SOURCE_DIR}/src/backend/masterlist.h"
"${CMAKE_SOURCE_DIR}/src/backend/plugin/plugin.h"
"${CMAKE_SOURCE_DIR}/src/backend/plugin/plugin_sorter.h"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/git_helper.h"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/crc.h"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/version.h")
set (LOOT_GUI_SRC "${CMAKE_SOURCE_DIR}/src/gui/main.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/helpers.cpp"
@@ -288,33 +301,6 @@ set (LOOT_GUI_HEADERS "${CMAKE_SOURCE_DIR}/src/gui/editor_message.h"
"${CMAKE_SOURCE_DIR}/src/gui/resource.h"
"${CMAKE_SOURCE_DIR}/src/gui/yaml_simple_message_helpers.h")
set (LOOT_API_SRC "${CMAKE_BINARY_DIR}/generated/loot_version.cpp"
"${CMAKE_SOURCE_DIR}/src/api/api.cpp"
"${CMAKE_SOURCE_DIR}/src/api/api_database.cpp"
"${CMAKE_SOURCE_DIR}/src/api/game.cpp")
set (LOOT_API_HEADERS "${CMAKE_SOURCE_DIR}/include/loot/api.h"
"${CMAKE_SOURCE_DIR}/include/loot/api_decorator.h"
"${CMAKE_SOURCE_DIR}/include/loot/database_interface.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/error_categories.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/condition_syntax_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/cyclic_interaction_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/file_access_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/game_detection_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/git_state_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/game_type.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/language_code.h"
"${CMAKE_SOURCE_DIR}/include/loot/game_interface.h"
"${CMAKE_SOURCE_DIR}/include/loot/loot_version.h"
"${CMAKE_SOURCE_DIR}/include/loot/plugin_interface.h"
"${CMAKE_SOURCE_DIR}/include/loot/struct/masterlist_info.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/message_type.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/plugin_cleanliness.h"
"${CMAKE_SOURCE_DIR}/include/loot/struct/plugin_tags.h"
"${CMAKE_SOURCE_DIR}/include/loot/struct/simple_message.h"
"${CMAKE_SOURCE_DIR}/src/api/api_database.h"
"${CMAKE_SOURCE_DIR}/src/api/game.h")
set (LOOT_TESTS_SRC "${CMAKE_SOURCE_DIR}/src/tests/backend/main.cpp")
set (LOOT_TESTS_HEADERS "${CMAKE_SOURCE_DIR}/src/tests/backend/game/game_test.h"
@@ -370,14 +356,12 @@ set (LOOT_GUI_TESTS_HEADERS "${CMAKE_SOURCE_DIR}/src/gui/state/game.h"
"${CMAKE_SOURCE_DIR}/src/tests/gui/state/loot_settings_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/gui/state/loot_state_test.h")
source_group("Header Files\\backend" FILES ${LOOT_HEADERS})
source_group("Header Files\\gui" FILES ${LOOT_GUI_HEADERS})
source_group("Header Files\\api" FILES ${LOOT_API_HEADERS})
source_group("Header Files\\tests" FILES ${LOOT_TESTS_HEADERS})
source_group("Header Files\\tests" FILES ${LOOT_API_TESTS_HEADERS})
source_group("Header Files\\tests" FILES ${LOOT_GUI_TESTS_HEADERS})
source_group("Source Files\\backend" FILES ${LOOT_SRC})
source_group("Source Files\\gui" FILES ${LOOT_GUI_SRC})
source_group("Source Files\\api" FILES ${LOOT_API_SRC})
source_group("Source Files\\tests" FILES ${LOOT_TESTS_SRC})
@@ -451,20 +435,15 @@ ENDIF ()
# Define Targets
##############################
# Common library.
add_library (loot_common STATIC ${LOOT_SRC} ${LOOT_HEADERS})
add_dependencies (loot_common libespm libgit2 libloadorder pseudosem yaml-cpp)
target_link_libraries(loot_common ${Boost_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBLOADORDER_LIBRARIES} ${LOOT_LIBS} ${YAML_CPP_LIBRARIES})
# Build tests.
add_executable (tests ${LOOT_TESTS_SRC} ${LOOT_TESTS_HEADERS})
add_dependencies (tests loot_common GTest testing-metadata testing-plugins)
target_link_libraries(tests loot_common ${GTEST_LIBRARIES} ${LIBLOADORDER_LIBRARIES})
add_executable (tests ${LOOT_API_SRC} ${LOOT_API_HEADERS} ${LOOT_TESTS_SRC} ${LOOT_TESTS_HEADERS})
add_dependencies (tests libespm libgit2 libloadorder pseudosem yaml-cpp GTest testing-metadata testing-plugins)
target_link_libraries(tests ${Boost_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBLOADORDER_LIBRARIES} ${LOOT_LIBS} ${YAML_CPP_LIBRARIES} ${GTEST_LIBRARIES} ${LIBLOADORDER_LIBRARIES})
# Build API.
add_library (loot_api ${LOOT_API_SRC} ${LOOT_API_HEADERS})
add_dependencies (loot_api loot_common)
target_link_libraries(loot_api loot_common)
add_dependencies (loot_api libespm libgit2 libloadorder pseudosem yaml-cpp)
target_link_libraries(loot_api ${Boost_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBLOADORDER_LIBRARIES} ${LOOT_LIBS} ${YAML_CPP_LIBRARIES})
# Build API tests.
add_executable (api-tests ${LOOT_API_TESTS_SRC} ${LOOT_API_TESTS_HEADERS})
@@ -496,7 +475,6 @@ ENDIF ()
IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
set_target_properties (loot_common PROPERTIES COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} LOOT_STATIC")
set_target_properties (tests PROPERTIES COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} LOOT_STATIC")
IF (BUILD_SHARED_LIBS)
set_target_properties (loot_api PROPERTIES COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} LOOT_EXPORT")
+7 -7
View File
@@ -28,20 +28,20 @@
#include <string>
#include <vector>
#include "loot/api_decorator.h"
#include "loot/enum/language_code.h"
namespace loot {
class Language {
public:
LOOT_API static const std::vector<LanguageCode> codes;
static const std::vector<LanguageCode> codes;
LOOT_API Language(const LanguageCode code);
LOOT_API Language(const std::string& locale);
Language(const LanguageCode code);
Language(const std::string& locale);
LanguageCode GetCode() const;
std::string GetName() const;
std::string GetLocale() const;
LOOT_API LanguageCode GetCode() const;
LOOT_API std::string GetName() const;
LOOT_API std::string GetLocale() const;
private:
static LanguageCode GetCode(const std::string& locale);
+7 -5
View File
@@ -26,16 +26,18 @@
#include <string>
#include "loot/api_decorator.h"
namespace loot {
class ConditionalMetadata {
public:
ConditionalMetadata();
ConditionalMetadata(const std::string& condition);
LOOT_API ConditionalMetadata();
LOOT_API ConditionalMetadata(const std::string& condition);
bool IsConditional() const;
void ParseCondition() const;
LOOT_API bool IsConditional() const;
LOOT_API void ParseCondition() const;
std::string Condition() const;
LOOT_API std::string Condition() const;
private:
std::string condition_;
};
+8 -7
View File
@@ -26,20 +26,21 @@
#include <string>
#include "loot/api_decorator.h"
#include "loot/metadata/conditional_metadata.h"
namespace loot {
class File : public ConditionalMetadata {
public:
File();
File(const std::string& name, const std::string& display = "",
const std::string& condition = "");
LOOT_API File();
LOOT_API File(const std::string& name, const std::string& display = "",
const std::string& condition = "");
bool operator < (const File& rhs) const;
bool operator == (const File& rhs) const;
LOOT_API bool operator < (const File& rhs) const;
LOOT_API bool operator == (const File& rhs) const;
std::string Name() const;
std::string DisplayName() const;
LOOT_API std::string Name() const;
LOOT_API std::string DisplayName() const;
private:
std::string name_;
std::string display_;
+8 -6
View File
@@ -27,17 +27,19 @@
#include <string>
#include <vector>
#include "loot/api_decorator.h"
namespace loot {
class Location {
public:
Location();
Location(const std::string& url, const std::string& name = "");
LOOT_API Location();
LOOT_API Location(const std::string& url, const std::string& name = "");
bool operator < (const Location& rhs) const;
bool operator == (const Location& rhs) const;
LOOT_API bool operator < (const Location& rhs) const;
LOOT_API bool operator == (const Location& rhs) const;
std::string URL() const;
std::string Name() const;
LOOT_API std::string URL() const;
LOOT_API std::string Name() const;
private:
std::string url_;
std::string name_;
+12 -11
View File
@@ -27,6 +27,7 @@
#include <string>
#include <vector>
#include "loot/api_decorator.h"
#include "loot/metadata/conditional_metadata.h"
#include "loot/metadata/message_content.h"
#include "loot/enum/language_code.h"
@@ -36,20 +37,20 @@
namespace loot {
class Message : public ConditionalMetadata {
public:
Message();
Message(const MessageType type, const std::string& content,
const std::string& condition = "");
Message(const MessageType type, const std::vector<MessageContent>& content,
const std::string& condition = "");
LOOT_API Message();
LOOT_API Message(const MessageType type, const std::string& content,
const std::string& condition = "");
LOOT_API Message(const MessageType type, const std::vector<MessageContent>& content,
const std::string& condition = "");
bool operator < (const Message& rhs) const;
bool operator == (const Message& rhs) const;
LOOT_API bool operator < (const Message& rhs) const;
LOOT_API bool operator == (const Message& rhs) const;
MessageType GetType() const;
std::vector<MessageContent> GetContent() const;
MessageContent GetContent(const LanguageCode language) const;
LOOT_API MessageType GetType() const;
LOOT_API std::vector<MessageContent> GetContent() const;
LOOT_API MessageContent GetContent(const LanguageCode language) const;
SimpleMessage ToSimpleMessage(const LanguageCode language) const;
LOOT_API SimpleMessage ToSimpleMessage(const LanguageCode language) const;
private:
MessageType type_;
std::vector<MessageContent> content_;
+9 -8
View File
@@ -26,22 +26,23 @@
#include <string>
#include "loot/api_decorator.h"
#include "loot/language.h"
namespace loot {
class MessageContent {
public:
MessageContent();
MessageContent(const std::string& text, const LanguageCode language);
LOOT_API MessageContent();
LOOT_API MessageContent(const std::string& text, const LanguageCode language);
std::string GetText() const;
LanguageCode GetLanguage() const;
LOOT_API std::string GetText() const;
LOOT_API LanguageCode GetLanguage() const;
bool operator < (const MessageContent& rhs) const;
bool operator == (const MessageContent& rhs) const;
LOOT_API bool operator < (const MessageContent& rhs) const;
LOOT_API bool operator == (const MessageContent& rhs) const;
static MessageContent Choose(const std::vector<MessageContent> content,
const LanguageCode language);
LOOT_API static MessageContent Choose(const std::vector<MessageContent> content,
const LanguageCode language);
private:
std::string text_;
LanguageCode language_;
+19 -18
View File
@@ -28,32 +28,33 @@
#include <cstdint>
#include <string>
#include "loot/api_decorator.h"
#include "loot/metadata/message.h"
namespace loot {
class PluginCleaningData {
public:
PluginCleaningData();
PluginCleaningData(uint32_t crc, const std::string& utility);
PluginCleaningData(uint32_t crc,
const std::string& utility,
const std::vector<MessageContent>& info,
unsigned int itm,
unsigned int ref,
unsigned int nav);
LOOT_API PluginCleaningData();
LOOT_API PluginCleaningData(uint32_t crc, const std::string& utility);
LOOT_API PluginCleaningData(uint32_t crc,
const std::string& utility,
const std::vector<MessageContent>& info,
unsigned int itm,
unsigned int ref,
unsigned int nav);
bool operator < (const PluginCleaningData& rhs) const;
bool operator == (const PluginCleaningData& rhs) const;
LOOT_API bool operator < (const PluginCleaningData& rhs) const;
LOOT_API bool operator == (const PluginCleaningData& rhs) const;
uint32_t CRC() const;
unsigned int ITMs() const;
unsigned int DeletedRefs() const;
unsigned int DeletedNavmeshes() const;
std::string CleaningUtility() const;
std::vector<MessageContent> Info() const;
LOOT_API uint32_t CRC() const;
LOOT_API unsigned int ITMs() const;
LOOT_API unsigned int DeletedRefs() const;
LOOT_API unsigned int DeletedNavmeshes() const;
LOOT_API std::string CleaningUtility() const;
LOOT_API std::vector<MessageContent> Info() const;
MessageContent ChooseInfo(const LanguageCode language) const;
Message AsMessage() const;
LOOT_API MessageContent ChooseInfo(const LanguageCode language) const;
LOOT_API Message AsMessage() const;
private:
uint32_t crc_;
unsigned int itm_;
+36 -35
View File
@@ -31,6 +31,7 @@
#include <string>
#include <vector>
#include "loot/api_decorator.h"
#include "loot/yaml/set.h"
#include "loot/metadata/file.h"
#include "loot/metadata/location.h"
@@ -42,56 +43,56 @@
namespace loot {
class PluginMetadata {
public:
PluginMetadata();
PluginMetadata(const std::string& name);
LOOT_API PluginMetadata();
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.
void MergeMetadata(const PluginMetadata& plugin);
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.
PluginMetadata NewMetadata(const PluginMetadata& plugin) const;
LOOT_API PluginMetadata NewMetadata(const PluginMetadata& plugin) const;
std::string Name() const;
std::string LowercasedName() const;
bool Enabled() const;
Priority LocalPriority() const;
Priority GlobalPriority() const;
std::set<File> LoadAfter() const;
std::set<File> Reqs() const;
std::set<File> Incs() const;
std::vector<Message> Messages() const;
std::set<Tag> Tags() const;
std::set<PluginCleaningData> DirtyInfo() const;
std::set<PluginCleaningData> CleanInfo() const;
std::set<Location> Locations() const;
LOOT_API std::string Name() const;
LOOT_API std::string LowercasedName() const;
LOOT_API bool Enabled() const;
LOOT_API Priority LocalPriority() const;
LOOT_API Priority GlobalPriority() const;
LOOT_API std::set<File> LoadAfter() const;
LOOT_API std::set<File> Reqs() const;
LOOT_API std::set<File> Incs() const;
LOOT_API std::vector<Message> Messages() const;
LOOT_API std::set<Tag> Tags() const;
LOOT_API std::set<PluginCleaningData> DirtyInfo() const;
LOOT_API std::set<PluginCleaningData> CleanInfo() const;
LOOT_API std::set<Location> Locations() const;
std::vector<SimpleMessage> SimpleMessages(const LanguageCode language) const;
LOOT_API std::vector<SimpleMessage> SimpleMessages(const LanguageCode language) const;
void Enabled(const bool enabled);
void LocalPriority(const Priority& priority);
void GlobalPriority(const Priority& priority);
void LoadAfter(const std::set<File>& after);
void Reqs(const std::set<File>& reqs);
void Incs(const std::set<File>& incs);
void Messages(const std::vector<Message>& messages);
void Tags(const std::set<Tag>& tags);
void DirtyInfo(const std::set<PluginCleaningData>& info);
void CleanInfo(const std::set<PluginCleaningData>& info);
void Locations(const std::set<Location>& locations);
LOOT_API void Enabled(const bool enabled);
LOOT_API void LocalPriority(const Priority& priority);
LOOT_API void GlobalPriority(const Priority& priority);
LOOT_API void LoadAfter(const std::set<File>& after);
LOOT_API void Reqs(const std::set<File>& reqs);
LOOT_API void Incs(const std::set<File>& incs);
LOOT_API void Messages(const std::vector<Message>& messages);
LOOT_API void Tags(const std::set<Tag>& tags);
LOOT_API void DirtyInfo(const std::set<PluginCleaningData>& info);
LOOT_API void CleanInfo(const std::set<PluginCleaningData>& info);
LOOT_API void Locations(const std::set<Location>& locations);
bool HasNameOnly() const;
bool IsRegexPlugin() const;
LOOT_API bool HasNameOnly() const;
LOOT_API bool IsRegexPlugin() const;
//Compare name strings.
bool operator == (const PluginMetadata& rhs) const;
bool operator != (const PluginMetadata& rhs) const;
LOOT_API bool operator == (const PluginMetadata& rhs) const;
LOOT_API bool operator != (const PluginMetadata& rhs) const;
//Compare name string.
bool operator == (const std::string& rhs) const;
bool operator != (const std::string& rhs) const;
LOOT_API bool operator == (const std::string& rhs) const;
LOOT_API bool operator != (const std::string& rhs) const;
private:
std::string name_;
bool enabled_;
+11 -9
View File
@@ -26,25 +26,27 @@
#include <cstdint>
#include "loot/api_decorator.h"
namespace loot {
class Priority {
public:
Priority();
LOOT_API Priority();
// Take an int to prevent literals that are too large for one byte from
// wrapping around to negative values.
explicit Priority(const int value);
LOOT_API explicit Priority(const int value);
// Doesn't return an int8_t because it is commonly signed char, which
// yaml-cpp interprets as a character rather than an integer.
short getValue() const;
bool isExplicit() const;
LOOT_API short getValue() const;
LOOT_API bool isExplicit() const;
bool operator < (const Priority& rhs) const;
bool operator > (const Priority& rhs) const;
bool operator >= (const Priority& rhs) const;
bool operator == (const Priority& rhs) const;
LOOT_API bool operator < (const Priority& rhs) const;
LOOT_API bool operator > (const Priority& rhs) const;
LOOT_API bool operator >= (const Priority& rhs) const;
LOOT_API bool operator == (const Priority& rhs) const;
bool operator > (const uint8_t rhs) const;
LOOT_API bool operator > (const uint8_t rhs) const;
private:
bool isExplicitZeroValue_;
+9 -8
View File
@@ -26,21 +26,22 @@
#include <string>
#include "loot/api_decorator.h"
#include "loot/metadata/conditional_metadata.h"
namespace loot {
class Tag : public ConditionalMetadata {
public:
Tag();
Tag(const std::string& tag,
const bool isAddition = true,
const std::string& condition = "");
LOOT_API Tag();
LOOT_API Tag(const std::string& tag,
const bool isAddition = true,
const std::string& condition = "");
bool operator < (const Tag& rhs) const;
bool operator == (const Tag& rhs) const;
LOOT_API bool operator < (const Tag& rhs) const;
LOOT_API bool operator == (const Tag& rhs) const;
bool IsAddition() const;
std::string Name() const;
LOOT_API bool IsAddition() const;
LOOT_API std::string Name() const;
private:
std::string name_;
bool addTag_;