Using regex can help you, maybe?
----- Reply message -----
Da: "Soumen"
Hi,
What I often do, is keep the string as is, but validate it upon
extraction from the value-map. I understand however that this is not
exactly as desired.
A better way may be to add an additional parser, which checks the
string (e.g. using regex). See the How To: Non-conventional syntax:
http://www.boost.org/doc/libs/1_42_0/doc/html/program_options/howto.html#id1...
Regards,
André
On Wed, Feb 17, 2010 at 11:45 AM, michele.caini@gmail.com
Using regex can help you, maybe?
----- Reply message ----- Da: "Soumen"
Data: mer, feb 17, 2010 11:40 Oggetto: [Boost-users] [program_options][1.35] validating string value A: Hi,
My option (say, "opt1") can take any of only few possible string type values (say, "value1", "value2", "value3" and "value4"). Is there anyway to specify this such that if any other value, say - "valueXX", is passed to "opt1", it throws an error?
If yes, can someone point me to documentation or sample code snippet to show how to do this?
Or, explicitly, checking against these possible values is my only option?
Regards, ~ Soumen -- View this message in context: http://old.nabble.com/-program_options--1.35--validating-string-value-tp2762... Sent from the Boost - Users mailing list archive at Nabble.com.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks Andre and Michele - got the way to accomplish it. -- View this message in context: http://old.nabble.com/-program_options--1.35--validating-string-value-tp2762... Sent from the Boost - Users mailing list archive at Nabble.com.
Using regex can help you, maybe? Say, my switch name is "semantic_check" and possible values are "on" (turns on the checker, issues warning when something fails), "off" and "error" (changes severity of warning to error). Could you cite an example code snippet me how regex may help? Regards, ~ Soumen -- View this message in context: http://old.nabble.com/-program_options--1.35--validating-string-value-tp2762... Sent from the Boost - Users mailing list archive at Nabble.com.
participants (3)
-
André Prins
-
michele.caini@gmail.com
-
Soumen