//======================================================================== // // LocalPDFDocBuilder.cc // // This file is licensed under the GPLv2 or later // // Copyright 2010 Hib Eris // Copyright 2010, 2022 Albert Astals Cid // Copyright 2021 Oliver Sander // //======================================================================== #include #include "LocalPDFDocBuilder.h" //------------------------------------------------------------------------ // LocalPDFDocBuilder //------------------------------------------------------------------------ std::unique_ptr LocalPDFDocBuilder::buildPDFDoc(const GooString &uri, const std::optional &ownerPassword, const std::optional &userPassword, void *guiDataA) { if (uri.cmpN("file://", 7) == 0) { std::unique_ptr fileName(uri.copy()); fileName->del(0, 7); return std::make_unique(std::move(fileName), ownerPassword, userPassword, guiDataA); } else { return std::make_unique(std::unique_ptr(uri.copy()), ownerPassword, userPassword, guiDataA); } } bool LocalPDFDocBuilder::supports(const GooString &uri) { if (uri.cmpN("file://", 7) == 0) { return true; } else if (!strstr(uri.c_str(), "://")) { return true; } else { return false; } }