command args processing lib(a la getopt), anyone?

Discussion in 'C++' started by dima, Aug 30, 2003.

  1. dima

    dima Guest

    can anybody recommend a good open-source library for command args processing in C++?
    something like getopt, but in C++.
    thanks.
    d.

    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]
    dima, Aug 30, 2003
    #1
    1. Advertising

  2. news:...
    > can anybody recommend a good open-source library for command args

    processing in C++?
    > something like getopt, but in C++.
    > thanks.


    The ACE library (http://www.cs.wustl.edu/~schmidt/ACE.html) has a
    ACE_Arg_Shifter class for this. But using this huge library just for command
    line processing would be overkill.

    --
    Peter van Merkerk
    peter.van.merkerk(at)dse.nl





    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]
    Peter van Merkerk, Aug 31, 2003
    #2
    1. Advertising

  3. dima wrote:
    > can anybody recommend a good open-source library for command args
    > processing in C++? something like getopt, but in C++.


    I seem to remember one called getpot (no typo!), boost also had something
    cooking in that direction.

    cheers

    Uli

    --
    Questions ?
    see C++-FAQ Lite: http://parashift.com/c -faq-lite/ first !


    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]
    Ulrich Eckhardt, Sep 1, 2003
    #3
  4. dima

    White Wolf Guest

    White Wolf, Sep 1, 2003
    #4
  5. dima

    llewelly Guest

    "White Wolf" <> writes:

    > dima wrote:
    >> can anybody recommend a good open-source library for command args
    >> processing in C++? something like getopt, but in C++.

    >
    > It seems that GNU getopt does have some C++ support:
    >
    > http://www.fnal.gov/docs/products/gcc/libg /libg _39.html


    But libg++ has not been supported for years. I don't think it builds
    with current gcc either.

    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]
    llewelly, Sep 1, 2003
    #5
  6. E. Robert Tisdale, Sep 2, 2003
    #6
  7. dima

    Guest

    (dima) wrote in message
    news:<>...

    > can anybody recommend a good open-source library for command args
    > processing in C++? something like getopt, but in C++.


    Check out the GB_CommandLine class at my site. There are also a certain
    number of predefined options in the Options directory.

    The basic principle is simple: GB_CommandLine is a singleton. The
    options are all static instances of a class derived from GB_Option,
    whose constructor enrols them with GB_CommandLine. After being fed the
    argc, argv parameters, the options in the command line have been set and
    stripped from the list of parameters; what remains looks like an
    std::vector< std::string > with the non-option parameters, and is a good
    candidate for providing the iterators necessary for my
    MultipleFileInputStream.

    --
    James Kanze GABI Software mailto:
    Conseils en informatique orientée objet/ http://www.gabi-soft.fr
    Beratung in objektorientierter Datenverarbeitung
    11 rue de Rambouillet, 78460 Chevreuse, France, +33 (0)1 30 23 45 16

    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]
    , Sep 2, 2003
    #7
  8. In article <>, E. Robert Tisdale wrote:
    > dima wrote:
    >
    >> can anybody recommend a good open-source library for command args
    >> processing in C++? something like getopt, but in C++.

    >
    > GNU Gengetopt 2.0


    That generates C code, though I wonder whether it really matters.
    Note that the licence is GPL rather than LGPL, and given the FSF
    claims the GPL applies to Bison output I expect they would say the
    same about this program's output.

    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]
    Ben Hutchings, Sep 3, 2003
    #8
  9. dima

    apm Guest

    apm, Sep 3, 2003
    #9
  10. dima

    llewelly Guest

    Ben Hutchings <> writes:

    > In article <>, E. Robert Tisdale wrote:
    >> dima wrote:
    >>
    >>> can anybody recommend a good open-source library for command args
    >>> processing in C++? something like getopt, but in C++.

    >>
    >> GNU Gengetopt 2.0

    >
    > That generates C code, though I wonder whether it really matters.
    > Note that the licence is GPL rather than LGPL, and given the FSF
    > claims the GPL applies to Bison output


    They make the opposite claim, unless you have an old version of
    bison. (I do not know when bision 1.24, the last version to which
    your statement applies, was released, but I am fairly sure it was
    before the creation of the current bison cvs tree, which was
    created in 1996 or 1997.)

    http://www.gnu.org/manual/bison/html_node/Conditions.html#Conditions

    > I expect they would say the
    > same about this program's output.


    They make the opposte claim for genegetopt as well, see

    http://www.gnu.org/software/gengetopt/gengetopt.html


    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]
    llewelly, Sep 5, 2003
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken Varn
    Replies:
    2
    Views:
    622
    Ken Varn
    Jun 22, 2005
  2. Replies:
    3
    Views:
    489
    David Eppstein
    Sep 17, 2003
  3. Pierre Fortin

    args v. *args passed to: os.path.join()

    Pierre Fortin, Sep 18, 2004, in forum: Python
    Replies:
    2
    Views:
    681
    Pierre Fortin
    Sep 18, 2004
  4. Yuri Shtil
    Replies:
    2
    Views:
    2,445
    John Bokma
    Jan 11, 2008
  5. er
    Replies:
    2
    Views:
    497
Loading...

Share This Page