]> git.lyx.org Git - lyx.git/blob - src/output.cpp
Fixed some lines that were too long. It compiled afterwards.
[lyx.git] / src / output.cpp
1 /**
2  * \file output.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "output.h"
14
15 #include "gettext.h"
16
17 #include "frontends/alert.h"
18
19 #include "support/filetools.h"
20
21
22 namespace lyx {
23
24 using support::bformat;
25 using support::FileName;
26 using support::makeDisplayPath;
27
28 using std::ofstream;
29 using std::string;
30
31 namespace {
32
33 template<typename OFStream>
34 bool doOpenFileWrite(OFStream & ofs, FileName const & fname)
35 {
36         ofs.open(fname.toFilesystemEncoding().c_str());
37         if (!ofs) {
38                 docstring const file = makeDisplayPath(fname.absFilename(), 50);
39                 docstring text = bformat(_("Could not open the specified "
40                                                      "document\n%1$s."), file);
41                 frontend::Alert::error(_("Could not open file"), text);
42                 return false;
43         }
44         return true;
45 }
46
47 }
48
49
50 bool openFileWrite(ofstream & ofs, FileName const & fname)
51 {
52         return doOpenFileWrite(ofs, fname);
53 }
54
55
56 bool openFileWrite(odocfstream & ofs, FileName const & fname)
57 {
58         return doOpenFileWrite(ofs, fname);
59 }
60
61
62 } // namespace lyx