source: trunk/yat/utility/OptionInFile.h @ 2057

Last change on this file since 2057 was 2057, checked in by Peter, 12 years ago

refs #521. Deprecate class OptionInFile? and OptionOutFile?. Replaced OptinOutFile? with base class OptionFile? in commandline_test

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1#ifndef _theplu_yat_utility_option_in_file_
2#define _theplu_yat_utility_option_in_file_
3
4// $Id: OptionInFile.h 2057 2009-09-11 00:11:19Z peter $
5
6/*
7  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
8
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include "deprecate.h"
26#include "OptionFile.h"
27
28#include <iosfwd>
29#include <string>
30
31namespace theplu {
32namespace yat {
33namespace utility {
34
35  class CommandLine;
36  /**
37     \brief Class for file related options
38
39     \deprecated Provided for backward compatibility with the 0.5
40     API. Use OptionFile and StreamRedirect instead (see CommandLine
41     for example code).
42   */
43  class OptionInFile : public OptionFile
44  {
45  public:
46    /**
47       \brief Constructor
48       
49       \param cmd Commandline Option is associated with
50       \param name string such as "file" for --file, "f" for -f or
51       "f,file" for having both short and long option name
52       \param desc string used in help display
53       \param required If true option must be found in commandline or
54       exception is thrown in validation
55    */
56    OptionInFile(CommandLine& cmd, std::string name, std::string desc, 
57                 bool required=false); 
58
59    /**
60       \brief Destructor
61    */
62    virtual ~OptionInFile(void);
63
64    /**
65       \return ifstream corresponding to value(). If option was not
66       found during parsing, std::cin is returned.
67    */
68    std::istream& istream(void);
69
70  private:
71    std::ifstream* is_;
72   
73  } YAT_DEPRECATE;
74
75}}} // of namespace utility, yat, and theplu
76
77#endif
Note: See TracBrowser for help on using the repository browser.