Boost logo

Boost Users :

Subject: [Boost-users] [program option] accepting list of enumerated values ?
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2010-07-22 18:00:42


I want a program to take an option that is one or more values from a short list; i.e. an enumeration. For sake of a simple example, let's use color names: "red", "yellow", "blue", "green", etc.

I'd like to validate that only legal strings are passed, and convert them to an enumerated type or integer. Certainly I can write po::value<std::vector<color_t> >, but what's the best way to process the input? The docs shows a brief example of overloading 'validate' but it's not clear.

I'd also like a short way to specify multiple colors without repeating the option. Something like --color=red,blue but whatever the natural syntax is. Is a multi-value on one instance of a switch something that's built in?

Thanks,

--John



TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net