Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/test/example/cla/name.cpp @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

  • Property svn:executable set to *
File size: 980 bytes
Line 
1//  (C) Copyright Gennadiy Rozental 2001-2005.
2//  Distributed under the Boost Software License, Version 1.0.
3//  (See accompanying file LICENSE_1_0.txt or copy at
4//  http://www.boost.org/LICENSE_1_0.txt)
5
6//  See http://www.boost.org/libs/test for the library home page.
7
8// Boost.Runtime.Param
9#include <boost/test/utils/runtime/cla/named_parameter.hpp>
10#include <boost/test/utils/runtime/cla/parser.hpp>
11
12namespace rt  = boost::runtime;
13namespace cla = boost::runtime::cla;
14
15// STL
16#include <iostream>
17
18int main() {
19    char* argv[] = { "basic", "-abcd", "-0.12" };
20    int argc = sizeof(argv)/sizeof(char*);
21
22    try {
23        cla::parser P;
24
25        P << cla::named_parameter<float>() - (cla::name = "abcd");
26
27        P.parse( argc, argv );
28
29        std::cout << "abcd = " << P.get<float>( "abcd" ) << std::endl;
30    }
31    catch( rt::logic_error const& ex ) {
32        std::cout << "Logic error: " << ex.msg() << std::endl;
33        return -1;
34    }
35
36    return 0;
37}
38
39// EOF
Note: See TracBrowser for help on using the repository browser.