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

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

updating copyright statements

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1#ifndef _theplu_yat_utility_option_in_file_
2#define _theplu_yat_utility_option_in_file_
3
4// $Id: OptionInFile.h 1797 2009-02-12 18:07:10Z 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 "OptionFile.h"
26
27#include <iosfwd>
28#include <string>
29
30namespace theplu {
31namespace yat {
32namespace utility {
33
34  class CommandLine;
35  /**
36     \brief Class for file related options
37   */
38  class OptionInFile : public OptionFile
39  {
40  public:
41    /**
42       \brief Constructor
43       
44       \param cmd Commandline Option is associated with
45       \param name string such as "file" for --file, "f" for -f or
46       "f,file" for having both short and long option name
47       \param desc string used in help display
48       \param required If true option must be found in commandline or
49       exception is thrown in validation
50    */
51    OptionInFile(CommandLine& cmd, std::string name, std::string desc, 
52                 bool required=false); 
53
54    /**
55       \brief Destructor
56    */
57    virtual ~OptionInFile(void);
58
59    /**
60       \return ifstream corresponding to value(). If option was not
61       found during parsing, std::cin is returned.
62    */
63    std::istream& istream(void);
64
65  private:
66    std::ifstream* is_;
67   
68  };
69
70}}} // of namespace utility, yat, and theplu
71
72#endif
Note: See TracBrowser for help on using the repository browser.