~ubuntu-branches/ubuntu/quantal/config-manager/quantal

« back to all changes in this revision

Viewing changes to libgetopt/include/getopt++/Option.h

  • Committer: Bazaar Package Importer
  • Author(s): Anand Kumria
  • Date: 2004-07-19 22:27:50 UTC
  • mto: (3.1.1 dapper)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040719222750-sztqdj1aoj2r6frr
Tags: upstream-0.1p83
ImportĀ upstreamĀ versionĀ 0.1p83

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2002 Robert Collins.
3
 
 *
4
 
 *     This program is free software; you can redistribute it and/or modify
5
 
 *     it under the terms of the GNU General Public License as published by
6
 
 *     the Free Software Foundation; either version 2 of the License, or
7
 
 *     (at your option) any later version.
8
 
 *
9
 
 *     A copy of the GNU General Public License can be found at
10
 
 *     http://www.gnu.org/
11
 
 *
12
 
 * Written by Robert Collins <robertc@hotmail.com>
13
 
 *
14
 
 */
15
 
 
16
 
#ifndef _OPTION_H_
17
 
#define _OPTION_H_
18
 
 
19
 
#if HAVE_CONFIG_H
20
 
#include "autoconf.h"
21
 
#endif
22
 
#if HAVE_STRING_H
23
 
#include <string>
24
 
#else 
25
 
#error "<string> required"
26
 
#endif
27
 
 
28
 
// Each registered option must implement this class.
29
 
class Option
30
 
{
31
 
public:
32
 
  virtual ~ Option ();
33
 
  virtual std::string const shortOption () const = 0;
34
 
  virtual std::string const longOption () const = 0;
35
 
  virtual std::string const shortHelp () const = 0;
36
 
  enum Result {
37
 
      Failed,
38
 
      Ok,
39
 
      Stop
40
 
  };
41
 
  virtual Result Process (char const *) = 0;
42
 
  enum Argument {
43
 
      None,
44
 
      Optional,
45
 
      Required
46
 
  };
47
 
  virtual Argument argument () const = 0;
48
 
 
49
 
protected:
50
 
    Option ();
51
 
};
52
 
 
53
 
#endif // _OPTION_H_