2016-08-07 21:23:23 +01:00
/* LOOT
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
Fallout: New Vegas.
Copyright (C) 2012-2016 WrinklyNinja
This file is part of LOOT.
LOOT is free software: you can redistribute
it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
LOOT is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LOOT. If not, see
<https://www.gnu.org/licenses/>.
*/
#include <loot/api.h>
#include <pybind11/pybind11.h>
2016-08-10 19:03:50 +01:00
#include <pybind11/stl.h>
PYBIND11_DECLARE_HOLDER_TYPE ( T , std :: shared_ptr < T > );
2016-08-07 21:23:23 +01:00
PYBIND11_PLUGIN ( loot_api ) {
2016-08-10 19:03:50 +01:00
using loot :: CreateDatabase ;
using loot :: DatabaseInterface ;
using loot :: IsCompatible ;
using loot :: GameType ;
using loot :: LootVersion ;
using loot :: MessageType ;
using loot :: PluginMessage ;
using loot :: PluginTags ;
2016-08-07 21:23:23 +01:00
2016-08-10 19:03:50 +01:00
using pybind11 :: enum_ ;
using pybind11 :: class_ ;
2016-08-07 21:23:23 +01:00
2016-08-10 19:03:50 +01:00
pybind11 :: module module ( "loot_api" , "A Python module that wraps the LOOT API, generated by pybind11." );
enum_ < GameType > ( module , "GameType" )
. value ( "tes4" , GameType :: tes4 );
class_ < PluginMessage > ( module , "Message" )
. def_readwrite ( "type" , & PluginMessage :: type )
. def_readwrite ( "text" , & PluginMessage :: text );
enum_ < MessageType > ( module , "MessageType" )
. value ( "say" , MessageType :: say )
. value ( "warn" , MessageType :: warn )
. value ( "error" , MessageType :: error );
class_ < LootVersion > ( module , "Version" )
. def_readonly_static ( "major" , & LootVersion :: major )
. def_readonly_static ( "minor" , & LootVersion :: minor )
. def_readonly_static ( "patch" , & LootVersion :: patch )
. def_readonly_static ( "revision" , & LootVersion :: revision );
class_ < PluginTags > ( module , "PluginTags" )
. def_readwrite ( "added" , & PluginTags :: added )
. def_readwrite ( "removed" , & PluginTags :: removed )
. def_readwrite ( "userlist_modified" , & PluginTags :: userlist_modified );
class_ < DatabaseInterface , std :: shared_ptr < DatabaseInterface >> ( module , "DatabaseInterface" )
. def ( "load_lists" , & DatabaseInterface :: LoadLists , "Loads the masterlist and userlist from the paths specified." )
. def ( "get_plugin_tags" , & DatabaseInterface :: GetPluginTags , "Outputs the Bash Tags suggested for addition and removal by the database for the given plugin." )
. def ( "get_plugin_messages" , & DatabaseInterface :: GetPluginMessages , "Outputs the messages associated with the given plugin in the database." );
module . def ( "is_compatible" , & IsCompatible , "Checks for API compatibility." );
module . def ( "create_database" , & CreateDatabase , "Initialise a new database handle." );
return module . ptr ();
2016-08-07 21:23:23 +01:00
}