open.hpp (963B)
1 #ifndef UUID_93BCB6F7_0156_4793_BAD5_76A9E9ABE263 2 #define UUID_93BCB6F7_0156_4793_BAD5_76A9E9ABE263 3 #pragma once 4 5 #include "dumpable.hpp" 6 #include "factory.hpp" 7 #include "source.hpp" 8 9 #include <libshit/lua/static_class.hpp> 10 #include <libshit/options.hpp> 11 #include <libshit/shared_ptr.hpp> 12 13 #include <functional> 14 #include <vector> 15 16 namespace Neptools 17 { 18 19 inline Libshit::OptionGroup& GetFlavorOptions() 20 { 21 static Libshit::OptionGroup grp{ 22 Libshit::OptionParser::GetGlobal(), "Game specific options"}; 23 return grp; 24 } 25 26 class OpenFactory 27 : public BaseFactory<Libshit::SmartPtr<Dumpable> (*)(const Source&)>, 28 public Libshit::Lua::StaticClass 29 { 30 LIBSHIT_LUA_CLASS; 31 public: 32 using Ret = Libshit::SmartPtr<Dumpable>; 33 LIBSHIT_NOLUA OpenFactory(BaseFactory::Fun f) : BaseFactory{f} {} 34 35 static Libshit::NotNull<Ret> Open(Source src); 36 static Libshit::NotNull<Ret> Open(const boost::filesystem::path& fname); 37 }; 38 39 } 40 41 #endif