Add support for C++ API's default parameters

This commit is contained in:
Oliver Hamlet
2016-08-19 18:38:15 +01:00
parent 56746ea91a
commit da7b959fbb
+5 -2
View File
@@ -41,9 +41,12 @@ PYBIND11_PLUGIN(loot_api) {
using loot::PluginMessage;
using loot::PluginTags;
using pybind11::arg;
using pybind11::enum_;
using pybind11::class_;
const std::string emptyString;
pybind11::module module("loot_api", "A Python module that wraps the LOOT API, generated by pybind11.");
enum_<GameType>(module, "GameType", "Wraps :cpp:type:`GameType <loot::GameType>`.")
@@ -99,7 +102,7 @@ PYBIND11_PLUGIN(loot_api) {
.def("string", LootVersion::string);
class_<DatabaseInterface, std::shared_ptr<DatabaseInterface>>(module, "DatabaseInterface", "Wraps :cpp:class:`DatabaseInterface <loot::DatabaseInterface>`.")
.def("load_lists", &DatabaseInterface::LoadLists, "Loads the masterlist and userlist from the paths specified. Wraps :cpp:func:`LoadLists`.")
.def("load_lists", &DatabaseInterface::LoadLists, arg("masterlist_path"), arg("userlist_path") = emptyString, "Loads the masterlist and userlist from the paths specified. Wraps :cpp:func:`LoadLists`.")
.def("eval_lists", &DatabaseInterface::EvalLists, "Evaluates all conditions and regular expression metadata entries in the loaded metadata lists. Wraps :cpp:func:`EvalLists`.")
.def("sort_plugins", &DatabaseInterface::SortPlugins, "Calculates a new load order for all a game's installed plugins and outputs the sorted order. Wraps :cpp:func:`SortPlugins`.")
.def("update_masterlist", &DatabaseInterface::UpdateMasterlist, "Updates the given masterlist using the given Git repository details. Wraps :cpp:func:`UpdateMasterlist`.")
@@ -111,7 +114,7 @@ PYBIND11_PLUGIN(loot_api) {
module.def("is_compatible", &IsCompatible, "Checks for API compatibility. Wraps :cpp:func:`IsCompatible <loot::IsCompatible>`.");
module.def("create_database", &CreateDatabase, "Initialise a new database handle. Wraps :cpp:func:`CreateDatabase <loot::CreateDatabase>`.");
module.def("create_database", &CreateDatabase, arg("game"), arg("game_path") = emptyString, arg("game_local_path") = emptyString, "Initialise a new database handle. Wraps :cpp:func:`CreateDatabase <loot::CreateDatabase>`.");
return module.ptr();
}