| 1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2008 |
| 6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
| 7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
| 8 | 8 |
* |
| 9 | 9 |
* Permission to use, modify and distribute this software is granted |
| 10 | 10 |
* provided that this copyright notice appears in all copies. For |
| 11 | 11 |
* precise terms see the accompanying LICENSE file. |
| 12 | 12 |
* |
| 13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
| 14 | 14 |
* express or implied, and with no claim as to its suitability for any |
| 15 | 15 |
* purpose. |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 |
#ifndef LEMON_ARG_PARSER |
|
| 20 |
#define LEMON_ARG_PARSER |
|
| 19 |
#ifndef LEMON_ARG_PARSER_H |
|
| 20 |
#define LEMON_ARG_PARSER_H |
|
| 21 | 21 |
|
| 22 | 22 |
#include <vector> |
| 23 | 23 |
#include <map> |
| 24 | 24 |
#include <list> |
| 25 | 25 |
#include <string> |
| 26 | 26 |
#include <iostream> |
| 27 | 27 |
#include <sstream> |
| 28 | 28 |
#include <algorithm> |
| 29 | 29 |
#include <lemon/assert.h> |
| 30 | 30 |
|
| 31 | 31 |
///\ingroup misc |
| 32 | 32 |
///\file |
| 33 | 33 |
///\brief A tool to parse command line arguments. |
| 34 | 34 |
|
| 35 | 35 |
namespace lemon {
|
| 36 | 36 |
|
| 37 | 37 |
///Command line arguments parser |
| 38 | 38 |
|
| 39 | 39 |
///\ingroup misc |
| 40 | 40 |
///Command line arguments parser. |
| 41 | 41 |
/// |
| 42 | 42 |
///For a complete example see the \ref arg_parser_demo.cc demo file. |
| 43 | 43 |
class ArgParser {
|
| 44 | 44 |
|
| ... | ... |
@@ -361,25 +361,25 @@ |
| 361 | 361 |
std::string()+"'"+_name+"' is an integer option"); |
| 362 | 362 |
return *(i->second.int_p); |
| 363 | 363 |
} |
| 364 | 364 |
|
| 365 | 365 |
}; |
| 366 | 366 |
|
| 367 | 367 |
///Give back the value of an option |
| 368 | 368 |
|
| 369 | 369 |
///Give back the value of an option. |
| 370 | 370 |
///\sa RefType |
| 371 | 371 |
RefType operator[](const std::string &n) const |
| 372 | 372 |
{
|
| 373 | 373 |
return RefType(*this, n); |
| 374 | 374 |
} |
| 375 | 375 |
|
| 376 | 376 |
///Give back the non-option type arguments. |
| 377 | 377 |
|
| 378 | 378 |
///Give back a reference to a vector consisting of the program arguments |
| 379 | 379 |
///not starting with a '-' character. |
| 380 | 380 |
const std::vector<std::string> &files() const { return _file_args; }
|
| 381 | 381 |
|
| 382 | 382 |
}; |
| 383 | 383 |
} |
| 384 | 384 |
|
| 385 |
#endif // |
|
| 385 |
#endif // LEMON_ARG_PARSER_H |
0 comments (0 inline)