source: trunk/yat/utility/Option.cc @ 687

Last change on this file since 687 was 687, checked in by Jari Häkkinen, 16 years ago

Clean up of namespace comments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1// $Id: Option.cc 687 2006-10-16 23:51:10Z jari $
2
3/*
4  Copyright (C) 2006 Peter Johansson
5
6  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
7
8  The yat library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12
13  The yat library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  02111-1307, USA.
22*/
23
24#include "Option.h"
25
26#include <fstream>
27#include <iostream>
28#include <string>
29
30namespace theplu {
31namespace yat {
32namespace utility {
33
34
35  Option::Option(char short_name, std::string long_name, argument_type arg, 
36                 std::string mess)
37    : arg_type_(arg), long_name_(long_name), mess_(mess), 
38      short_name_(short_name), present_(false)
39  {
40  }
41
42
43  void Option::print(void) const
44  {
45    using std::cerr;
46    if (short_name_!='\0'){
47      cerr << " -" << short_name_;
48      if (!long_name_.empty())
49        cerr << ",";
50      else
51        cerr << " ";
52    }
53    else 
54      cerr << "    ";
55    if (!long_name_.empty()){
56      cerr << " --" << long_name_;
57      if (arg_type_!=no_arg)
58        cerr << "=VALUE";
59    }
60    cerr << "\t" << mess_ << "\n";
61  }
62
63}}} // of namespace utility, yat, and theplu
Note: See TracBrowser for help on using the repository browser.