Boost logo

Boost-Commit :

From: doomster_at_[hidden]
Date: 2008-04-30 11:26:58


Author: eckhardt
Date: 2008-04-30 11:26:58 EDT (Wed, 30 Apr 2008)
New Revision: 44932
URL: http://svn.boost.org/trac/boost/changeset/44932

Log:
- Add include files to compile the system and filesystem libs in-place.
- Add test file using the filesystem lib.

Added:
   sandbox/compile-in-place/Boost_1_35_0/boost/filesystem/compile_in_place.cpp (contents, props changed)
   sandbox/compile-in-place/Boost_1_35_0/boost/system/compile_in_place.cpp (contents, props changed)
   sandbox/compile-in-place/test-filesystem.cpp (contents, props changed)

Added: sandbox/compile-in-place/Boost_1_35_0/boost/filesystem/compile_in_place.cpp
==============================================================================
--- (empty file)
+++ sandbox/compile-in-place/Boost_1_35_0/boost/filesystem/compile_in_place.cpp 2008-04-30 11:26:58 EDT (Wed, 30 Apr 2008)
@@ -0,0 +1,21 @@
+/* compile in-place support for Boost.Filesystem
+
+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_FILESYSTEM_COMPILE_IN_PLACE_CPP_INCLUDED
+# error "this file should only be included once per binary"
+#endif
+
+#define BOOST_FILESYSTEM_COMPILE_IN_PLACE_CPP_INCLUDED
+
+#include "../../libs/filesystem/src/operations.cpp"
+#include "../../libs/filesystem/src/path.cpp"
+#include "../../libs/filesystem/src/portability.cpp"
+#include "../../libs/filesystem/src/utf8_codecvt_facet.cpp"

Added: sandbox/compile-in-place/Boost_1_35_0/boost/system/compile_in_place.cpp
==============================================================================
--- (empty file)
+++ sandbox/compile-in-place/Boost_1_35_0/boost/system/compile_in_place.cpp 2008-04-30 11:26:58 EDT (Wed, 30 Apr 2008)
@@ -0,0 +1,18 @@
+/* compile in-place support for Boost.System
+
+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_SYSTEM_COMPILE_IN_PLACE_CPP_INCLUDED
+# error "this file should only be included once per binary"
+#endif
+
+#define BOOST_SYSTEM_COMPILE_IN_PLACE_CPP_INCLUDED
+
+#include "../../libs/system/src/error_code.cpp"

Added: sandbox/compile-in-place/test-filesystem.cpp
==============================================================================
--- (empty file)
+++ sandbox/compile-in-place/test-filesystem.cpp 2008-04-30 11:26:58 EDT (Wed, 30 Apr 2008)
@@ -0,0 +1,48 @@
+/* example to demonstrate compile-in-place for the filesytem lib
+
+Compile with
+ $CXX -I path/to/boost_X_YY_Z test-filesystem.cpp
+
+Notes:
+
+- This needs to be changed to support 1.34, where the filesystem lib didn't
+depend on a separate system lib.
+
+$Id$
+*/
+#define BOOST_FILESYSTEM_SOURCE
+#include <boost/filesystem.hpp>
+#include <iostream>
+#include <ostream>
+#include <boost/filesystem/compile_in_place.cpp>
+// Note: Boost.Filesystem since 1.35 depends on Boost.System
+#include <boost/system/compile_in_place.cpp>
+
+using namespace boost::filesystem;
+
+int
+main( int argc, char* argv[])
+{
+ if(argc!=2)
+ {
+ std::cerr << "need exactly one argument for the dir to list" << std::endl;
+ return EXIT_FAILURE;
+ }
+ path dir_path = argv[1];
+ if ( !exists( dir_path ) )
+ return EXIT_FAILURE;
+
+ for ( directory_iterator it( dir_path ), end;
+ it != end;
+ ++it )
+ {
+ if ( is_directory(it->status()) )
+ {
+ std::cout << "dir: " << *it << std::endl;
+ }
+ else
+ {
+ std::cout << "file: " << *it << std::endl;
+ }
+ }
+}


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