1014 |
01 Feb 08 |
peter |
1 |
#ifndef _theplu_yat_utility_option_ofile_ |
1014 |
01 Feb 08 |
peter |
2 |
#define _theplu_yat_utility_option_ofile_ |
1014 |
01 Feb 08 |
peter |
3 |
|
1014 |
01 Feb 08 |
peter |
// $Id$ |
1014 |
01 Feb 08 |
peter |
5 |
|
1014 |
01 Feb 08 |
peter |
6 |
/* |
2119 |
12 Dec 09 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2009, 2014 Peter Johansson |
1014 |
01 Feb 08 |
peter |
9 |
|
1437 |
25 Aug 08 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
1014 |
01 Feb 08 |
peter |
11 |
|
1014 |
01 Feb 08 |
peter |
The yat library is free software; you can redistribute it and/or |
1014 |
01 Feb 08 |
peter |
modify it under the terms of the GNU General Public License as |
1486 |
09 Sep 08 |
jari |
published by the Free Software Foundation; either version 3 of the |
1014 |
01 Feb 08 |
peter |
License, or (at your option) any later version. |
1014 |
01 Feb 08 |
peter |
16 |
|
1014 |
01 Feb 08 |
peter |
The yat library is distributed in the hope that it will be useful, |
1014 |
01 Feb 08 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1014 |
01 Feb 08 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1014 |
01 Feb 08 |
peter |
General Public License for more details. |
1014 |
01 Feb 08 |
peter |
21 |
|
1014 |
01 Feb 08 |
peter |
You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
1014 |
01 Feb 08 |
peter |
24 |
*/ |
1014 |
01 Feb 08 |
peter |
25 |
|
2057 |
11 Sep 09 |
peter |
26 |
#include "deprecate.h" |
1014 |
01 Feb 08 |
peter |
27 |
#include "OptionFile.h" |
1014 |
01 Feb 08 |
peter |
28 |
|
1805 |
18 Feb 09 |
peter |
29 |
#include <iosfwd> |
1014 |
01 Feb 08 |
peter |
30 |
#include <string> |
1014 |
01 Feb 08 |
peter |
31 |
|
1014 |
01 Feb 08 |
peter |
32 |
namespace theplu { |
1014 |
01 Feb 08 |
peter |
33 |
namespace yat { |
1014 |
01 Feb 08 |
peter |
34 |
namespace utility { |
1014 |
01 Feb 08 |
peter |
35 |
|
1014 |
01 Feb 08 |
peter |
36 |
class CommandLine; |
1014 |
01 Feb 08 |
peter |
37 |
/** |
1014 |
01 Feb 08 |
peter |
\brief Class for file related options |
2057 |
11 Sep 09 |
peter |
39 |
|
2057 |
11 Sep 09 |
peter |
\deprecated Provided for backward compatibility with the 0.5 |
2057 |
11 Sep 09 |
peter |
API. Use OptionFile and StreamRedirect instead (see CommandLine |
2057 |
11 Sep 09 |
peter |
for example code). |
1014 |
01 Feb 08 |
peter |
43 |
*/ |
1014 |
01 Feb 08 |
peter |
44 |
class OptionOutFile : public OptionFile |
1014 |
01 Feb 08 |
peter |
45 |
{ |
1014 |
01 Feb 08 |
peter |
46 |
public: |
1014 |
01 Feb 08 |
peter |
47 |
/** |
4200 |
19 Aug 22 |
peter |
\brief Constructor |
4200 |
19 Aug 22 |
peter |
49 |
|
1014 |
01 Feb 08 |
peter |
\param cmd Commandline Option is associated with |
1014 |
01 Feb 08 |
peter |
\param name string such as "file" for --file, "f" for -f or |
1014 |
01 Feb 08 |
peter |
"f,file" for having both short and long option name |
1014 |
01 Feb 08 |
peter |
\param desc string used in help display |
1014 |
01 Feb 08 |
peter |
\param required If true option must be found in commandline or |
1014 |
01 Feb 08 |
peter |
exception is thrown in validation |
1014 |
01 Feb 08 |
peter |
56 |
*/ |
4200 |
19 Aug 22 |
peter |
57 |
OptionOutFile(CommandLine& cmd, std::string name, std::string desc, |
4200 |
19 Aug 22 |
peter |
58 |
bool required=false) YAT_DEPRECATE_GCC_PRE4_3; |
1014 |
01 Feb 08 |
peter |
59 |
|
1014 |
01 Feb 08 |
peter |
60 |
/** |
1014 |
01 Feb 08 |
peter |
\brief Destructor |
1014 |
01 Feb 08 |
peter |
62 |
*/ |
1014 |
01 Feb 08 |
peter |
63 |
virtual ~OptionOutFile(void); |
1014 |
01 Feb 08 |
peter |
64 |
|
1014 |
01 Feb 08 |
peter |
65 |
/** |
1014 |
01 Feb 08 |
peter |
\brief stream \a ss to underlying file. If no file was given |
1452 |
28 Aug 08 |
peter |
during parsing, reference to std::cout is returned. |
1014 |
01 Feb 08 |
peter |
68 |
*/ |
1014 |
01 Feb 08 |
peter |
69 |
std::ostream& ostream(void); |
1014 |
01 Feb 08 |
peter |
70 |
|
1014 |
01 Feb 08 |
peter |
71 |
private: |
1014 |
01 Feb 08 |
peter |
72 |
std::ofstream* os_; |
4200 |
19 Aug 22 |
peter |
73 |
|
3257 |
09 Jun 14 |
peter |
74 |
} YAT_DEPRECATE; |
1014 |
01 Feb 08 |
peter |
75 |
|
1014 |
01 Feb 08 |
peter |
76 |
}}} // of namespace utility, yat, and theplu |
1014 |
01 Feb 08 |
peter |
77 |
|
1014 |
01 Feb 08 |
peter |
78 |
#endif |