|
Boost-Commit : |
From: doomster_at_[hidden]
Date: 2008-05-03 16:27:44
Author: eckhardt
Date: 2008-05-03 16:27:43 EDT (Sat, 03 May 2008)
New Revision: 45090
URL: http://svn.boost.org/trac/boost/changeset/45090
Log:
- Add include file to compile the program options library in-place.
- Add example file for in-place compiled program options library.
Added:
sandbox/compile-in-place/Boost_1_35_0/boost/program_options/compile_in_place.cpp (contents, props changed)
sandbox/compile-in-place/test-program-options.cpp (contents, props changed)
Added: sandbox/compile-in-place/Boost_1_35_0/boost/program_options/compile_in_place.cpp
==============================================================================
--- (empty file)
+++ sandbox/compile-in-place/Boost_1_35_0/boost/program_options/compile_in_place.cpp 2008-05-03 16:27:43 EDT (Sat, 03 May 2008)
@@ -0,0 +1,27 @@
+/* compile in-place support for Boost.Program_options
+
+Copyright 2008 Ulrich Eckhardt
+
+Distributed under the Boost Software License, Version 1.0. (See accompanying
+file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+*/
+// $Id$
+
+// This file must not be included more than once. Note that this 'once' is
+// not per translation unit but per binary! Never include this in a header!
+#ifdef BOOST_PROGRAM_OPTIONS_COMPILE_IN_PLACE_CPP_INCLUDED
+# error "this file should only be included once per binary"
+#endif
+
+#define BOOST_PROGRAM_OPTIONS_COMPILE_IN_PLACE_CPP_INCLUDED
+
+#include "../../libs/program_options/src/cmdline.cpp"
+#include "../../libs/program_options/src/config_file.cpp"
+#include "../../libs/program_options/src/convert.cpp"
+#include "../../libs/program_options/src/options_description.cpp"
+#include "../../libs/program_options/src/parsers.cpp"
+#include "../../libs/program_options/src/positional_options.cpp"
+#include "../../libs/program_options/src/utf8_codecvt_facet.cpp"
+#include "../../libs/program_options/src/value_semantic.cpp"
+#include "../../libs/program_options/src/variables_map.cpp"
+#include "../../libs/program_options/src/winmain.cpp"
Added: sandbox/compile-in-place/test-program-options.cpp
==============================================================================
--- (empty file)
+++ sandbox/compile-in-place/test-program-options.cpp 2008-05-03 16:27:43 EDT (Sat, 03 May 2008)
@@ -0,0 +1,44 @@
+/* example to demonstrate compile-in-place for Boost.Program_options
+
+Compile with
+ $CXX -I path/to/boost_X_YY_Z test-program-options.cpp
+
+Notes:
+
+$Id$
+*/
+
+#include <iostream>
+#include <ostream>
+#include <boost/program_options.hpp>
+#include <boost/program_options/compile_in_place.cpp>
+
+namespace po = boost::program_options;
+
+
+int main(int argc, char** argv)
+{
+ // Declare the supported options.
+ po::options_description desc("Allowed options");
+ desc.add_options()
+ ("help", "show usage info")
+ ("name", po::value<std::string>(), "set the one to greet")
+ ;
+
+ po::variables_map vars;
+ po::store(po::parse_command_line(argc, argv, desc), vars);
+ po::notify(vars);
+
+ if (vars.count("help")) {
+ std::cout << desc << "\n";
+ return 1;
+ }
+
+ std::string name = "world";
+ if(vars.count("name"))
+ name = vars["name"].as<std::string>();
+
+ std::cout << "hello " << name << "!" << std::endl;
+
+ return 0;
+}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk