X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Foutput.C;h=ab1177b974e7c1aa790884984713bea7f0d042d3;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=5c9b57f49a6a868d947a7cee87520add361e0916;hpb=cd424d78530c9e38502ee7f989ef5c426c97ad61;p=lyx.git diff --git a/src/output.C b/src/output.C index 5c9b57f49a..ab1177b974 100644 --- a/src/output.C +++ b/src/output.C @@ -18,23 +18,44 @@ #include "support/filetools.h" -#include -using lyx::support::bformat; -using lyx::support::MakeDisplayPath; +namespace lyx { + +using support::bformat; +using support::makeDisplayPath; using std::ofstream; using std::string; -bool openFileWrite(ofstream & ofs, string const & fname) +namespace { + +template +bool doOpenFileWrite(OFStream & ofs, string const & fname) { ofs.open(fname.c_str()); if (!ofs) { - string const file = MakeDisplayPath(fname, 50); - string text = bformat(_("Could not open the specified " - "document\n%1$s."), file); - Alert::error(_("Could not open file"), text); + docstring const file = makeDisplayPath(fname, 50); + docstring text = bformat(_("Could not open the specified " + "document\n%1$s."), file); + frontend::Alert::error(_("Could not open file"), text); return false; } return true; } + +} + + +bool openFileWrite(ofstream & ofs, string const & fname) +{ + return doOpenFileWrite(ofs, fname); +} + + +bool openFileWrite(odocfstream & ofs, string const & fname) +{ + return doOpenFileWrite(ofs, fname); +} + + +} // namespace lyx