qartar / qflags Goto Github PK
View Code? Open in Web Editor NEWSimple cross-platform C++ command-line parsing library
License: MIT License
Simple cross-platform C++ command-line parsing library
License: MIT License
The C and C++ standards both state that main should have the signature int argc, char* argv[]
. argv
is a non-const array to non-const strings. qflags::command_line
takes in a char const* const*
for argv, which works fine for passing in the command line args, but it means doing argv = parser.remaining_argv();
doesn't work because the original argv
is non-const, but remaining_argv
is returning const.
It looks like the short-argument name ability supports having multi-character values (like -st for example). However, when the parser attempts to add add the short-argument it falsely determines that a multi-character arg equals one of different lengths. For example, if I have two short args with values of:
-s
-st
the parser thinks these are equal. It looks like this is due to the std::equal compare using the min size of the two arguments.
It would be really helpful if string_option
, boolean_option
, etc could take in an option description
parameter that could be used to print out automatic help information (like Python's argparse)
When compiling with VS2017, the compilation fails due to exception handlers used within MSVC's xlocale header:
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\CL.exe /c /I"C:\src\rainier\3rd-party\qflags\include" /Zi /nologo /W4 /WX /diagnostics:classic /sdl /MP /Od /Ob0 /D WIN32 /D _WINDOWS /D QFLAGS_STATIC /D _UNICODE /D UNICODE /D "CMAKE_INTDIR=\"Debug\"" /D _UNICODE /D UNICODE /Gm- /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"qflags-static.dir\Debug\\" /Fd"qflags-static.dir\Debug\qflags-static.pdb" /Gd /TP /errorReport:prompt /GR-- "C:\src\....\3rd-party\qflags\src\qflags-all.cpp"
2>cl : Command line warning D9002: ignoring unknown option '/G-'
2>qflags-all.cpp
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\xlocale(314): error C2220: warning treated as error - no 'object' file generated
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\xlocale(314): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\limits(211): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc
command_line.hpp
uses <codecvt>
facets to convert Windows's native wide-character strings to UTF-8 however these facets are deprecated starting in C++17 and trying to use them generates deprecation warnings. These warnings can be suppressed by defining _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
but on MSVC this must be done before any standard library header includes which means trying to suppress this warning just inside of the command_line.hpp
header is unreliable.
The standard has not implemented anything to replace the functionality so Microsoft recommends using WideCharToMultiByte
but this depends on Windows.h
which I'd like to avoid.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.