262 Commits
Author SHA1 Message Date
Oliver Hamlet bc76e83357 Add GameInterface::IsLoadOrderAmbiguous()
It exposes libloadorder's lo_is_ambiguous() function.
2022-02-23 16:45:26 +00:00
Oliver Hamlet 14479b2289 Make const data members non-const
As recommended by C++ Core Guidelines C.12.

Plugin and Game are still non-copy-constructable or assignable due to
having members that are non-copy-constructable/assignable, but
consistency is still good.
2022-02-19 13:55:03 +00:00
Oliver Hamlet 0907f91b6f Move overloaded symmetric operators out of File class 2022-02-19 13:45:53 +00:00
Oliver Hamlet d4de531de5 Make File::GetDisplayName() a trivial accessor
Don't escape any markdown characters or return the name field if the
display name is empty. They're really presentation issues so are left to
the UI.
2022-02-19 13:45:53 +00:00
Oliver Hamlet 77decb26c4 Move PluginMetadata::GetSimpleMessages() to ToSimpleMessages()
It's more versatile and would avoid duplication in LOOT's code.
2022-02-19 13:45:52 +00:00
Oliver Hamlet 5bce0b9e06 Move ToSimpleMessage out of Message
It doesn't need access to any private members.
2022-02-19 13:45:52 +00:00
Oliver Hamlet a239aae888 Move overloaded symmetric operators out of classes
This follows the advice of C++ Core Guidelines C.161 and C.168.

The File equality and less than comparison operators have not been
moved because File::GetDisplayName() is not a trivial accessor.
2022-02-19 13:45:51 +00:00
Oliver Hamlet fb147ec787 Move and rename MessageContent::Choose()
Also remove the File::ChooseDetail(), Message::GetContent() and
PluginCleaningData::ChooseDetail() functions that just call it.
2022-02-19 13:45:51 +00:00
Oliver Hamlet ad197d89ff Replace MessageContent::defaultLanguage
With a static constexpr C string.
2022-02-19 12:13:56 +00:00
Oliver Hamlet 855eed4731 Remove ConditionalMetadata::ParseCondition()
It's not used by LOOT.
2022-02-19 12:11:56 +00:00
Oliver Hamlet c7aafbe487 Remove unnecessary explicit default constructor definitions
This follows the advice of C++ Core Guidelines C.45 and C.80.
2022-02-19 11:59:20 +00:00
Oliver Hamlet 8e859f7408 Remove obsolete FileRevision class 2022-02-19 11:42:56 +00:00
Oliver Hamlet 44c6746a44 Add a couple of missing default virtual destructors 2022-02-19 11:31:39 +00:00
Oliver Hamlet b97424435f Add Group::DEFAULT_NAME
So that the constant is accessible to LOOT at compile time.
2022-02-18 23:01:42 +00:00
Oliver Hamlet bfb168907c Replace unnecessary usage of std::shared_ptr
- CreateGameHandle() should return a unique_ptr because it transfers
  ownership.
- GameInterface::GetDatabase() should return a reference because it
  returns an existing object that will always be valid at call time.
- GameInterface::GetPlugin() and GameInterface::GetLoadedPlugins()
  return raw pointers because they do not transfer or share ownership.
  It's unfortunately that references can't be used instead (ignoring
  std::reference_wrapper), as std::optional<const Plugin&> and
  std::vector<const Plugin&> would be more meaningful return types.

Internally, there were a few uses of shared_ptr that could be unique_ptr
and a few that could be non-pointer types.

A few uses of shared_ptr remain:

- Game and ApiDatabase share a ConditionEvaluator, so it's kept inside a
  shared_ptr. Technically ApiDatabase is used such that the
  ConditionEvaluator it uses will always outlive it, but that's not
  guaranteed, so shared_ptr is used for safety.
- Plugin objects are cached inside shared_ptr so that the map of
  them can be iterated over. Ideally they'd be stored in unique_ptr,
  but unique_ptr not being copyable means the map entries can't be
  iterated over.
2022-02-18 22:29:08 +00:00
Oliver Hamlet 4393dd0e66 Add cppcoreguidelines-pro-type-member-init clang-tidy check
Fix the warnings it emits.
2022-02-07 20:25:13 +00:00
Oliver Hamlet 7204e37721 Fix PluginMetadata::NameMatches() performance
This reverts 15781c9b6b in favour of a
more complete fix that breaks ABI stability.
2022-02-06 19:06:17 +00:00
Oliver Hamlet 9443135dbe Fix malformatted API documentation 2022-02-06 18:31:42 +00:00
Oliver Hamlet 0a27fe4844 Fix missing API documentation 2022-02-06 18:31:42 +00:00
Oliver Hamlet c64039e7e2 Fix doc comment formatting inconsistencies 2022-02-06 18:31:42 +00:00
Oliver Hamlet d595bcf56e Run clang-format on whole repository
Using:

shopt -s globstar
/mnt/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2019/Community/VC/Tools/Llvm/bin/clang-format.exe -i include/**/*.h  src/**/*.h src/**/*.cpp
2022-02-06 18:31:41 +00:00
Oliver Hamlet 5589dfbf4c Replace references to GitHub Flavored Markdown with CommonMark
LOOT now uses Qt's support for Markdown, but its support for GFM is
bugged so LOOT uses CommonMark instead. The practical impact is very
minor, but reflect the difference in libloot's docs.
2022-02-06 17:45:08 +00:00
Oliver Hamlet 95980860e5 Remove all Git-related functionality
LOOT no longer uses Git to keep its copies of the masterlists up to
date, so this functionality is no longer needed. The removed API items
are:

- UpdateFile()
- GetFileRevision()
- IsLatestFile()
- libgit2_category()
- GitStateError
2022-01-23 20:41:54 +00:00
Oliver Hamlet 6693c5a3e5 Add PluginMetadata::AsYaml()
For use in LOOT's "Copy Metadata" feature.
2022-01-01 21:21:55 +00:00
Oliver Hamlet f387dfdfc8 Add missing <string> include 2021-12-08 19:57:00 +00:00