]> git.lyx.org Git - lyx.git/blob - src/output.cpp
LYX_CXX_GLOBAL_CSTD is not really useful anymore
[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 "support/gettext.h"
16
17 #include "frontends/alert.h"
18
19 #include "support/filetools.h"
20 #include "support/lstrings.h"
21
22 using namespace std;
23 using namespace lyx::support;
24
25 namespace lyx {
26
27 namespace {
28
29 template<typename OFStream>
30 bool doOpenFileWrite(OFStream & ofs, FileName const & fname)
31 {
32         ofs.open(fname.toFilesystemEncoding().c_str());
33         if (ofs)
34                 return true;
35         docstring const file = fname.displayName(50);
36         docstring text = bformat(_("Could not open the specified "
37                                                          "document\n%1$s."), file);
38         frontend::Alert::error(_("Could not open file"), text);
39         return false;
40 }
41
42 }
43
44
45 bool openFileWrite(ofstream & ofs, FileName const & fname)
46 {
47         return doOpenFileWrite(ofs, fname);
48 }
49
50
51 bool openFileWrite(odocfstream & ofs, FileName const & fname)
52 {
53         return doOpenFileWrite(ofs, fname);
54 }
55
56
57 } // namespace lyx