open.cpp (560B)
1 #include "open.hpp" 2 3 #include <libshit/except.hpp> 4 5 namespace Neptools 6 { 7 8 auto OpenFactory::Open(Source src) -> Libshit::NotNull<Ret> 9 { 10 for (auto& x : GetStore()) 11 { 12 auto ret = x(src); 13 if (ret) return MakeNotNull(ret); 14 } 15 LIBSHIT_THROW(Libshit::DecodeError, "Unknown input file"); 16 } 17 18 auto OpenFactory::Open(const boost::filesystem::path& fname) 19 -> Libshit::NotNull<Ret> 20 { 21 LIBSHIT_ADD_INFOS( 22 return Open(Source::FromFile(fname.native())), 23 "File name", fname.string()); 24 } 25 26 } 27 28 #include "open.binding.hpp"