Commit Graph

166 Commits

Author SHA1 Message Date
Vladimir Prus
bc0c90a70f Merge branch 'develop' 2018-07-06 17:35:40 +03:00
Emre Turkay
64c3ae0fde Specified a default value for the template argument of parse_config_file. 2018-07-06 10:38:43 +03:00
Vladimir Prus
46ad442da1 Merge branch 'develop' 2018-06-27 22:32:29 +03:00
Eyal Rozenberg
589d55837e Fixes #1: Support for multiple long names per option
An unintrusive implementation - no existing interfaces changed, and a single addition for obtaining all of the different long names.

Notes:

* Tests added for the new functionality, and existing tests expanded to take it into account.
* It is now impossible to specify long names with commas in them (but then, that wasn't properly supported before either, more of an oversight).
* The multiple long options are not included in the usage information - just the first one of them is printed
2018-06-27 22:25:43 +03:00
Vladimir Prus
491cb17e3a Fix uninitialized validation_error::m_kind. 2018-03-16 12:35:57 +03:00
Vladimir Prus
46caf622db Merge branch 'develop' 2018-03-15 22:21:23 +03:00
Vladimir Prus
046501c191 Fix member hiding warnings.
Fixes #35.
2017-10-25 16:24:36 +03:00
Tatsuyuki Ishi
110772c0ac Simplify vector initialization 2017-07-24 22:34:59 +03:00
Vladimir Prus
d9ef3853c6 Merge branch 'develop' 2017-07-24 21:48:56 +03:00
Vladimir Prus
3e1d2603e6 Fix out-of-range error
Closes #31.
2017-07-21 18:30:47 +03:00
Vladimir Prus
acaa4c94e1 Merge branch 'develop' 2017-06-25 21:41:31 +03:00
Vladimir Prus
a30cc1082f Feature macro for use-next-token-for-implicit-option behaviour. 2017-06-25 21:39:43 +03:00
Vladimir Prus
0565d1ee16 Merge from develop for 1.65.0
- Make options with implicit value use next token, like it did
  before.
- Support boost::optional option variables.
- Fix syntax error with BOOST_NO_EXCEPTIONS
- Fix uninitlized position_key in some cases.
2017-06-24 20:06:06 +03:00
Vladimir Prus
c83abc21a0 Correct documentation for 'implicit_value'
Now we no longer say it requires value to be in the same
token.
2017-06-10 22:44:09 +03:00
Vladimir Prus
7729850bb7 Make options with implicit value use next token.
This commit reverts:

    - 88dea3c6fd.
    "Stop options with implicit value from consuming separate tokens."

    - 0c01e9aadc.
    "Add testing for implicit_values and non-consuming of separate tokens."

These commits from 2014 made options with implicit_value set only
consult value in the same token. The problem is that now implicit_value,
a sematic properly, forces a particular syntax, which proved to be
confusing.
2017-06-10 22:44:09 +03:00
jzmaddock
5dc325580b Namespace fix for diab (EDG) compiler
Extracted from Boost.Config issue: https://svn.boost.org/trac/boost/ticket/11655.
2017-04-17 00:00:32 +03:00
Edward Catmur
3277249932 Support boost::optional option variables. 2016-12-21 13:18:47 +03:00
Gaurav
5a85b81fcf get_option_name() can throw std::logic_error
get_option_name()  calls get_canonical_option_prefix()  which throws in file value_semantic.cpp line no 296

296             throw std::logic_error("error_with_option_name::m_option_style can only be "
297                               "one of [0, allow_dash_for_short, allow_slash_for_short, "
298                               "allow_long_disguise or allow_long]");
299    }
2015-10-06 09:43:09 +03:00
Vladimir Prus
a495b0210a Initialize position_key in second basic_option constructor. 2015-09-11 22:15:32 +03:00
Vladimir Prus
fae2d4c57b Merge from develop for 1.59
- Fix compilation errors, missing dllexport and warnings on
  Windows and/or MSVC (Daniela Engert, Marcel Raad)

- Fix unintialized fields (Zoey Greer)

- Stop options with implicit value from consuming separate tokens (Michael John Decker)

- Make multitoken limit be max int, not 32K (Hans Hohenfeld)

- Code formatting and documentation fixes (Jurko, Lauri Nurmi)

- Minimal support for no-rtti build (Minmin Gong)

- Don't increment environment pointer past the end (Vladimir Prus)
2015-06-09 09:54:19 +03:00
Vladimir Prus
c0cee7f6da Go back to std::type_info in one more place. 2015-05-03 21:55:08 +03:00
Vladimir Prus
0756d35f8b Remove more unnecessary use of boost::type_index. 2015-05-01 19:15:36 +03:00
Vladimir Prus
bd1d0bd861 Put back std::type_info.
Since typed_value_base is only used with RTTI on, there's
no need to avoid std::type_info there.
2015-04-30 22:15:31 +03:00
Minmin Gong
6feeeb3b92 Using type_index to avoid RTTIs in program_options. (fixes #10347) 2015-04-30 22:10:44 +03:00
Marcel Raad
0efb385e99 Protect against max macro
This fixes compilation for MSVC in the case when NOMINMAX is not defined and the program_options include appears after the windows.h include.
2015-04-13 12:27:53 +03:00
Zoey Greer
2c4d25a04b Value-initialize m_desc
Value-initialize m_desc (to NULL) in this constructor to avoid uninitialized memory situations. This issue is related to Coverity CID12523 and was uncovered by Coverity.
2015-04-13 12:26:37 +03:00
Zoey Greer
bae408095f Explicitly initialize m_implicit
m_implicit was previously uninitialized in this constructor, leading to possibly inconsistent functionality. Instead, we now initialize it to false. This issue is related to Coverity CID10559 and was uncovered by Coverity.
2015-04-13 12:24:31 +03:00
Michael John Decker
88dea3c6fd Stop options with implicit value from consuming separate tokens.
The current documentation states that if an option has implicit
value, it will only consume adjacent token.
2014-12-30 10:15:10 +03:00
Jurko
a9ea9bb453 escape first dash ('-') in double-dashes ('--') found in doxygen comments
This should prevent doxygen from generating bad documentation HTML pages
containing '<ndash></ndash>' where those double-dashes should be.
2014-11-27 10:21:48 +01:00
Jurko
3cec23f2ba fix documentation typos & style
typo corrections:
 - otherwisee --> otherwise
 - it's is --> it is
 - nuber --> number
 - will likely to use --> is likely to use
 - varaible --> variable
 - defauled --> defaulted

stylistic changes:
 - which would make --> making
2014-11-27 10:21:48 +01:00
Jurko
fcc4e6ef1a trim trailing spaces 2014-11-27 09:45:10 +01:00
Marcel Raad
1a17f20532 Compile fix for MSVC 14
Also fixes some new variable shadowing warnings
in cmdline_test with Visual C++ 14.
2014-11-24 17:16:21 +03:00
Hans Hohenfeld
6e846597d5 Use maximum unsigned as default multitoken limit.
Fixes #10718.
2014-11-24 17:09:58 +03:00
Vladimir Prus
f50b02750a Don't increment environment pointer past the end.
This should not effect correct programs, since once the
iterator itself is past-the-end, it should not matter what
the underlying state of that iterator is. But, the new behaviour
is more obvious.
2014-01-20 09:28:12 +04:00
Daniela Engert
3ce1c74a0f Suppress msvc level-4 warnings.
Even when compiled at warning level 4 (i.e. all), project
policies may require compilations without warnings issued.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2014-01-09 08:47:21 +04:00
Daniela Engert
2acfab15a3 Fix config_file compilation errors with MSVC
Previous fix 4ae33c for ticket #6797 introduced a new problem with
Visual Studio compilers about two missing methods in
'common_config_file_iterator'. Adding those seemingly not required
methods as empty methods fixes the issue. As an added bonus, the
bogus warnings about DLL-interfaces get a silencing treatment, too.

Tests were run with vc10, vc11, and vc12. Without this fix, the
affected test cases fail on all 3 compilers. With the fix in place,
all tests pass.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2014-01-09 01:19:15 +04:00
Vladimir Prus
4ae33ce15e Add dllexport to common_config_file_iterator.
As reported in #6797, there are linker errors otherwise. I
do not know why regression tests, which test dll linking
explicitly, do not catch this.
2013-12-19 08:16:19 +04:00
Vladimir Prus
9d7c987526 Remove tabs. 2013-12-04 09:17:17 +04:00
Vladimir Prus
6bf4607eac Align columns across groups in --help output.
Patch from Leo Goodstadt.
Fixes #6114.


[SVN r86571]
2013-11-06 09:23:14 +00:00
Michel Morin
81844db902 Correct broken links to C++ standard papers. Refs #9212.
[SVN r86524]
2013-10-30 12:51:24 +00:00
Stephen Kelly
d3f32ca813 ProgramOptions: Remove obsolete GCC version check.
[SVN r86115]
2013-10-01 08:47:31 +00:00
Stephen Kelly
da03a78b66 Remove obsolete MSVC check from pragma guard
git grep -h -B1 "^#\s*pragma once" | grep -v pragma | sort | uniq

is now clean.

[SVN r85952]
2013-09-26 13:02:51 +00:00
Vladimir Prus
5059a8f393 Silence gcc warning. Thanks to Chris Stylianou.
Closes #8725.


[SVN r84903]
2013-06-24 19:37:37 +00:00
Vladimir Prus
b430a83dfb Fix report of error for options with dashes.
Fixes #8009.
Patch from Markus Roth.


[SVN r82805]
2013-02-10 12:07:05 +00:00
Vladimir Prus
f11104084b Really fixes #7049.
[SVN r79477]
2012-07-13 19:06:30 +00:00
Vladimir Prus
3360ad0ea2 Fix compilation error.
Fixes #7049. Patch from Deniz Bahadir.


[SVN r79164]
2012-06-29 09:04:09 +00:00
Vladimir Prus
5a470bcc41 Adjust spelling.
[SVN r78359]
2012-05-06 17:32:47 +00:00
Vladimir Prus
2eda0313c7 Include necessary header, don't rely on two-phase lookup not being there.
Fixes #6790.


[SVN r78331]
2012-05-05 07:17:28 +00:00
Vladimir Prus
5cbfa80841 Allow to specify how option's value is named in help message.
Fixes #4781.


[SVN r77931]
2012-04-12 08:37:34 +00:00
Vladimir Prus
fd7b310993 Improve error reporting.
The name of option is now shown in most cases when it's feasible, and
clarify of the error messages has been improved throughout.

Patch from Leo Goodstadt.


[SVN r77827]
2012-04-08 08:42:39 +00:00