source: trunk/yat/utility/OptionFile.h @ 1707

Last change on this file since 1707 was 1487, checked in by Jari Häkkinen, 13 years ago

Addresses #436. GPL license copy reference should also be updated.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1#ifndef _theplu_yat_utility_option_file_
2#define _theplu_yat_utility_option_file_
3
4// $Id: OptionFile.h 1487 2008-09-10 08:41:36Z jari $
5
6/*
7  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2008 Peter Johansson
9
10  This file is part of the yat library, http://dev.thep.lu.se/yat
11
12  The yat library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU General Public License as
14  published by the Free Software Foundation; either version 3 of the
15  License, or (at your option) any later version.
16
17  The yat library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21
22  You should have received a copy of the GNU General Public License
23  along with yat. If not, see <http://www.gnu.org/licenses/>.
24*/
25
26#include "OptionArg.h"
27
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 OptionFile : public OptionArg<std::string>
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       \param exist if true File must exist
51       \param bits used to check permission on file, see
52       FileUtil
53    */
54    OptionFile(CommandLine& cmd, std::string name, std::string desc, 
55               bool required=false, bool exist=false, std::string bits=""); 
56
57    /**
58       \brief Destructor
59    */
60    virtual ~OptionFile(void);
61
62  private:
63    void do_validate2() const;
64
65    bool exist_;
66    std::string bits_;
67   
68  };
69
70}}} // of namespace utility, yat, and theplu
71
72#endif
Note: See TracBrowser for help on using the repository browser.