|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57181 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/doc libs/filesystem/src libs/filesystem/test libs/filesystem/test/msvc libs/filesystem/test/msvc/path_test
From: bdawes_at_[hidden]
Date: 2009-10-27 16:06:43
Author: bemandawes
Date: 2009-10-27 16:06:40 EDT (Tue, 27 Oct 2009)
New Revision: 57181
URL: http://svn.boost.org/trac/boost/changeset/57181
Log:
filesystem-v3: major change; eliminate default error_code arguments, replacing single signatures with two overloads
Text files modified:
sandbox/filesystem-v3/boost/filesystem/operations.hpp | 609 +++++++++++---------
sandbox/filesystem-v3/boost/filesystem/path.hpp | 216 +++---
sandbox/filesystem-v3/libs/filesystem/doc/reference.html | 674 +++++++--------------
sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 1207 +++++++++++++++++++--------------------
sandbox/filesystem-v3/libs/filesystem/test/msvc/common.vsprops | 2
sandbox/filesystem-v3/libs/filesystem/test/msvc/path_test/path_test.vcproj | 2
sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp | 70 ++
7 files changed, 1341 insertions(+), 1439 deletions(-)
Modified: sandbox/filesystem-v3/boost/filesystem/operations.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/operations.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/operations.hpp 2009-10-27 16:06:40 EDT (Tue, 27 Oct 2009)
@@ -1,6 +1,6 @@
// boost/filesystem/operations.hpp ---------------------------------------------------//
-// Copyright Beman Dawes 2002-2008
+// Copyright Beman Dawes 2002-2009
// Copyright Jan Langer 2002
// Copyright Dietmar Kuehl 2001
// Copyright Vladimir Prus 2002
@@ -91,13 +91,13 @@
class BOOST_FILESYSTEM_DECL file_status
{
public:
- explicit file_status( file_type v = status_unknown ) : m_value(v) {}
+ explicit file_status(file_type v = status_unknown) : m_value(v) {}
- void type( file_type v ) { m_value = v; }
+ void type(file_type v) { m_value = v; }
file_type type() const { return m_value; }
- bool operator==( const file_status & rhs ) const { return type() == rhs.type(); }
- bool operator!=( const file_status & rhs ) const { return !(*this == rhs); }
+ bool operator==(const file_status& rhs) const { return type() == rhs.type(); }
+ bool operator!=(const file_status& rhs) const { return !(*this == rhs); }
private:
// the internal representation is unspecified so that additional state
@@ -107,17 +107,17 @@
file_type m_value;
};
- inline bool status_known( file_status f ) { return f.type() != status_unknown; }
- inline bool exists( file_status f ) { return f.type() != status_unknown
+ inline bool status_known(file_status f) { return f.type() != status_unknown; }
+ inline bool exists(file_status f) { return f.type() != status_unknown
&& f.type() != file_not_found; }
inline bool is_regular_file(file_status f){ return f.type() == regular_file; }
- inline bool is_directory( file_status f ) { return f.type() == directory_file; }
- inline bool is_symlink( file_status f ) { return f.type() == symlink_file; }
- inline bool is_other( file_status f ) { return exists(f) && !is_regular_file(f)
+ inline bool is_directory(file_status f) { return f.type() == directory_file; }
+ inline bool is_symlink(file_status f) { return f.type() == symlink_file; }
+ inline bool is_other(file_status f) { return exists(f) && !is_regular_file(f)
&& !is_directory(f) && !is_symlink(f); }
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
- inline bool is_regular( file_status f ) { return f.type() == regular_file; }
+ inline bool is_regular(file_status f) { return f.type() == regular_file; }
# endif
struct space_info
@@ -128,38 +128,133 @@
boost::uintmax_t available; // <= free
};
+ BOOST_SCOPED_ENUM_START(copy_option)
+ {fail_if_exists, overwrite_if_exists};
+ BOOST_SCOPED_ENUM_END
+
+//--------------------------------------------------------------------------------------//
+// implementation details //
+//--------------------------------------------------------------------------------------//
+
+ namespace detail
+ {
+ BOOST_FILESYSTEM_DECL
+ file_status status(const path&p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ file_status symlink_status(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ path complete(const path& p, const path& base);
+ BOOST_FILESYSTEM_DECL
+ bool is_empty(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ path initial_path(system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void copy(const path& from, const path& to, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void copy_directory(const path& from, const path& to, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void copy_file(const path& from, const path& to,
+ BOOST_SCOPED_ENUM(copy_option) option, // See ticket #2925
+ system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void copy_symlink(const path& from, const path& to, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ bool create_directories(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ bool create_directory(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void create_directory_symlink(const path& to, const path& from,
+ system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void create_hard_link(const path& to, const path& from, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void create_symlink(const path& to, const path& from, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ path current_path(system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void current_path(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ bool equivalent(const path& p1, const path& p2, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ boost::uintmax_t file_size(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ std::time_t last_write_time(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void last_write_time(const path& p, const std::time_t new_time,
+ system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ path read_symlink(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ // For standardization, if the committee doesn't like "remove", consider "eliminate"
+ bool remove(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ boost::uintmax_t remove_all(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void rename(const path& from, const path& to, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ void resize_file(const path& p, uintmax_t size, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ space_info space(const path& p, system::error_code* ec=0);
+ BOOST_FILESYSTEM_DECL
+ path system_complete(const path& p, system::error_code* ec=0);
+ } // namespace detail
+
//--------------------------------------------------------------------------------------//
// //
// status query functions //
// //
//--------------------------------------------------------------------------------------//
- BOOST_FILESYSTEM_DECL
- file_status status( const path & p,
- system::error_code & ec = throws() );
-
- BOOST_FILESYSTEM_DECL
- file_status symlink_status( const path & p,
- system::error_code & ec = throws() );
-
- inline bool exists( const path & p, system::error_code & ec = throws() )
- { return exists( status( p, ec ) ); }
- inline bool is_directory( const path & p, system::error_code & ec = throws() )
- { return is_directory( status( p, ec ) ); }
- inline bool is_regular_file( const path & p, system::error_code & ec = throws() )
- { return is_regular_file( status( p, ec ) ); }
- inline bool is_other( const path & p, system::error_code & ec = throws() )
- { return is_other( status( p, ec ) ); }
- inline bool is_symlink( const path & p, system::error_code & ec = throws() )
- { return is_symlink( symlink_status( p, ec ) ); }
-
+ inline
+ file_status status(const path& p) {return detail::status(p);}
+ inline
+ file_status status(const path& p, system::error_code& ec)
+ {return detail::status(p, &ec);}
+ inline
+ file_status symlink_status(const path& p) {return detail::symlink_status(p);}
+ inline
+ file_status symlink_status(const path& p, system::error_code& ec)
+ {return detail::symlink_status(p, &ec);}
+ inline
+ bool exists(const path& p) {return exists(detail::status(p));}
+ inline
+ bool exists(const path& p, system::error_code& ec)
+ {return exists(detail::status(p, &ec));}
+ inline
+ bool is_directory(const path& p) {return is_directory(detail::status(p));}
+ inline
+ bool is_directory(const path& p, system::error_code& ec)
+ {return is_directory(detail::status(p, &ec));}
+ inline
+ bool is_regular_file(const path& p) {return is_regular_file(detail::status(p));}
+ inline
+ bool is_regular_file(const path& p, system::error_code& ec)
+ {return is_regular_file(detail::status(p, &ec));}
+ inline
+ bool is_other(const path& p) {return is_other(detail::status(p));}
+ inline
+ bool is_other(const path& p, system::error_code& ec)
+ {return is_other(detail::status(p, &ec));}
+ inline
+ bool is_symlink(const path& p) {return is_symlink(detail::symlink_status(p));}
+ inline
+ bool is_symlink(const path& p, system::error_code& ec)
+ {return is_symlink(detail::symlink_status(p, &ec));}
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
- inline bool is_regular( const path & p, system::error_code & ec = throws() )
- { return is_regular( status( p, ec ) ); }
+ inline
+ bool is_regular(const path& p) {return is_regular(detail::status(p));}
+ inline
+ bool is_regular(const path& p, system::error_code& ec)
+ {return is_regular(detail::status(p, &ec));}
# endif
- BOOST_FILESYSTEM_DECL
- bool is_empty( const path & p, system::error_code & ec = throws() );
+ inline
+ bool is_empty(const path& p) {return detail::is_empty(p);}
+ inline
+ bool is_empty(const path& p, system::error_code& ec)
+ {return detail::is_empty(p, &ec);}
//--------------------------------------------------------------------------------------//
// //
@@ -168,111 +263,190 @@
// //
//--------------------------------------------------------------------------------------//
- BOOST_FILESYSTEM_DECL // declaration must precede complete()
- path initial_path( system::error_code & ec = throws() );
-
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
- // support legacy initial_path<...>()
- template <class Path>
- path initial_path( system::error_code & ec = throws() )
- { return initial_path( ec ); }
-# endif
-
- BOOST_FILESYSTEM_DECL
- path complete( const path & p, const path & base = initial_path() );
+ inline
+ path complete(const path& p)
+ {
+ path base (detail::initial_path(0));
+ return detail::complete(p, base);
+ }
- BOOST_FILESYSTEM_DECL
- void copy( const path & from, const path & to, system::error_code & ec = throws() );
+ inline
+ path complete(const path& p, system::error_code& ec)
+ {
+ path base (detail::initial_path(&ec));
+ if (ec) return path();
+ return detail::complete(p, base);
+ }
- BOOST_FILESYSTEM_DECL
- void copy_directory( const path & from, const path & to,
- system::error_code & ec = throws() );
+ inline
+ path complete(const path& p, const path& base) {return detail::complete(p, base);}
- BOOST_SCOPED_ENUM_START(copy_option)
- { fail_if_exists, overwrite_if_exists };
- BOOST_SCOPED_ENUM_END
+ inline
+ void copy(const path& from, const path& to) {detail::copy(from, to);}
- BOOST_FILESYSTEM_DECL
- void copy_file( const path & from, const path & to,
- BOOST_SCOPED_ENUM(copy_option) option, // See ticket #2925
- system::error_code & ec = throws() );
+ inline
+ void copy(const path& from, const path& to, system::error_code& ec)
+ {detail::copy(from, to, &ec);}
+ inline
+ void copy_directory(const path& from, const path& to)
+ {detail::copy_directory(from, to);}
+ inline
+ void copy_directory(const path& from, const path& to, system::error_code& ec)
+ {detail::copy_directory(from, to, &ec);}
+ inline
+ void copy_file(const path& from, const path& to, // See ticket #2925
+ BOOST_SCOPED_ENUM(copy_option) option)
+ {detail::copy_file(from, to, option);}
+ inline
+ void copy_file(const path& from, const path& to)
+ {detail::copy_file(from, to, copy_option::fail_if_exists);}
+ inline
+ void copy_file(const path& from, const path& to, // See ticket #2925
+ BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec)
+ {detail::copy_file(from, to, option, &ec);}
+ inline
+ void copy_file(const path& from, const path& to, system::error_code& ec)
+ {detail::copy_file(from, to, copy_option::fail_if_exists, &ec);}
+ inline
+ void copy_symlink(const path& from, const path& to) {detail::copy_symlink(from, to);}
inline
- void copy_file( const path & from, const path & to, system::error_code & ec = throws() )
- { copy_file( from, to, copy_option::fail_if_exists, ec ); }
+ void copy_symlink(const path& from, const path& to, system::error_code& ec)
+ {detail::copy_symlink(from, to, &ec);}
+ inline
+ bool create_directories(const path& p) {return detail::create_directories(p);}
- BOOST_FILESYSTEM_DECL
- void copy_symlink( const path & from, const path & to,
- system::error_code & ec = throws() );
+ inline
+ bool create_directories(const path& p, system::error_code& ec)
+ {return detail::create_directories(p, &ec);}
+ inline
+ bool create_directory(const path& p) {return detail::create_directory(p);}
- BOOST_FILESYSTEM_DECL
- bool create_directories( const path & p );
+ inline
+ bool create_directory(const path& p, system::error_code& ec)
+ {return detail::create_directory(p, &ec);}
+ inline
+ void create_directory_symlink(const path& to, const path& from)
+ {detail::create_directory_symlink(to, from);}
+ inline
+ void create_directory_symlink(const path& to, const path& from, system::error_code& ec)
+ {detail::create_directory_symlink(to, from, &ec);}
+ inline
+ void create_hard_link(const path& to, const path& from) {detail::create_hard_link(to, from);}
- BOOST_FILESYSTEM_DECL
- bool create_directory( const path & p, system::error_code & ec = throws() );
+ inline
+ void create_hard_link(const path& to, const path& from, system::error_code& ec)
+ {detail::create_hard_link(to, from, &ec);}
+ inline
+ void create_symlink(const path& to, const path& from) {detail::create_symlink(to, from);}
- BOOST_FILESYSTEM_DECL
- void create_directory_symlink( const path & to, const path & from,
- system::error_code & ec = throws() );
+ inline
+ void create_symlink(const path& to, const path& from, system::error_code& ec)
+ {detail::create_symlink(to, from, &ec);}
+ inline
+ path current_path() {return detail::current_path();}
- BOOST_FILESYSTEM_DECL
- void create_hard_link( const path & to, const path & from,
- system::error_code & ec = throws() );
+ inline
+ path current_path(system::error_code& ec) {return detail::current_path(&ec);}
- BOOST_FILESYSTEM_DECL
- void create_symlink( const path & to, const path & from,
- system::error_code & ec = throws() );
+ inline
+ void current_path(const path& p) {detail::current_path(p);}
- BOOST_FILESYSTEM_DECL
- path current_path( system::error_code & ec = throws() );
+ inline
+ void current_path(const path& p, system::error_code& ec) {detail::current_path(p, &ec);}
- BOOST_FILESYSTEM_DECL
- void current_path( const path & p, system::error_code & ec = throws() );
+ inline
+ bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);}
- BOOST_FILESYSTEM_DECL
- bool equivalent( const path & p1, const path & p2, system::error_code & ec = throws() );
+ inline
+ bool equivalent(const path& p1, const path& p2, system::error_code& ec)
+ {return detail::equivalent(p1, p2, &ec);}
+ inline
+ boost::uintmax_t file_size(const path& p) {return detail::file_size(p);}
- BOOST_FILESYSTEM_DECL
- boost::uintmax_t file_size( const path & p, system::error_code & ec = throws() );
+ inline
+ boost::uintmax_t file_size(const path& p, system::error_code& ec)
+ {return detail::file_size(p, &ec);}
+ inline
+ boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);}
- BOOST_FILESYSTEM_DECL
- boost::uintmax_t hard_link_count( const path & p, system::error_code & ec = throws() );
+ inline
+ boost::uintmax_t hard_link_count(const path& p, system::error_code& ec)
+ {return detail::hard_link_count(p, &ec);}
+ inline
+ path initial_path() {return detail::initial_path();}
- // initial_path() declaration precedes complete()
+ inline
+ path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
- BOOST_FILESYSTEM_DECL
- std::time_t last_write_time( const path & p, system::error_code & ec = throws() );
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+ // support legacy initial_path<...>()
+ template <class Path>
+ path initial_path() {return initial_path();}
+ template <class Path>
+ path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
+# endif
- BOOST_FILESYSTEM_DECL
- void last_write_time( const path & p, const std::time_t new_time,
- system::error_code & ec = throws() );
+ inline
+ std::time_t last_write_time(const path& p) {return detail::last_write_time(p);}
- BOOST_FILESYSTEM_DECL
- path read_symlink( const path & p, system::error_code & ec = throws() );
+ inline
+ std::time_t last_write_time(const path& p, system::error_code& ec)
+ {return detail::last_write_time(p, &ec);}
+ inline
+ void last_write_time(const path& p, const std::time_t new_time)
+ {detail::last_write_time(p, new_time);}
+ inline
+ void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec)
+ {detail::last_write_time(p, new_time, &ec);}
+ inline
+ path read_symlink(const path& p) {return detail::read_symlink(p);}
- BOOST_FILESYSTEM_DECL
+ inline
+ path read_symlink(const path& p, system::error_code& ec)
+ {return detail::read_symlink(p, &ec);}
+ inline
// For standardization, if the committee doesn't like "remove", consider "eliminate"
- bool remove( const path & p, system::error_code & ec = throws() );
+ bool remove(const path& p) {return detail::remove(p);}
- BOOST_FILESYSTEM_DECL
- boost::uintmax_t remove_all( const path & p, system::error_code & ec = throws() );
+ inline
+ bool remove(const path& p, system::error_code& ec) {return detail::remove(p, &ec);}
+
+ inline
+ boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);}
- BOOST_FILESYSTEM_DECL
- void rename( const path & from, const path & to, system::error_code & ec = throws() );
+ inline
+ boost::uintmax_t remove_all(const path& p, system::error_code& ec)
+ {return detail::remove_all(p, &ec);}
+ inline
+ void rename(const path& from, const path& to) {detail::rename(from, to);}
- BOOST_FILESYSTEM_DECL // name suggested by Scott McMurray
- void resize_file( const path & p, uintmax_t size, system::error_code & ec = throws() );
+ inline
+ void rename(const path& from, const path& to, system::error_code& ec)
+ {detail::rename(from, to, &ec);}
+ inline // name suggested by Scott McMurray
+ void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);}
- BOOST_FILESYSTEM_DECL
- space_info space( const path & p, system::error_code & ec = throws() );
+ inline
+ void resize_file(const path& p, uintmax_t size, system::error_code& ec)
+ {detail::resize_file(p, size, &ec);}
+ inline
+ space_info space(const path& p) {return detail::space(p);}
+
+ inline
+ space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);}
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
- inline bool symbolic_link_exists( const path & ph )
- { return is_symlink( symlink_status(ph) ); }
+ inline bool symbolic_link_exists(const path& p)
+ { return is_symlink(symlink_status(p)); }
# endif
- BOOST_FILESYSTEM_DECL
- path system_complete( const path & p, system::error_code & ec = throws() );
+ inline
+ path system_complete(const path& p) {return detail::system_complete(p);}
+
+ inline
+ path system_complete(const path& p, system::error_code& ec)
+ {return detail::system_complete(p, &ec);}
//--------------------------------------------------------------------------------------//
// //
@@ -291,17 +465,17 @@
// compiler generated copy-ctor, copy assignment, and destructor apply
directory_entry() {}
- explicit directory_entry( const boost::filesystem::path & p,
- file_status st = file_status(), file_status symlink_st=file_status() )
+ explicit directory_entry(const boost::filesystem::path& p,
+ file_status st = file_status(), file_status symlink_st=file_status())
: m_path(p), m_status(st), m_symlink_status(symlink_st)
{}
- void assign( const boost::filesystem::path & p,
- file_status st, file_status symlink_st )
+ void assign(const boost::filesystem::path& p,
+ file_status st = file_status(), file_status symlink_st = file_status())
{ m_path = p; m_status = st; m_symlink_status = symlink_st; }
- void replace_filename( const boost::filesystem::path & p,
- file_status st, file_status symlink_st )
+ void replace_filename(const boost::filesystem::path& p,
+ file_status st = file_status(), file_status symlink_st = file_status())
{
m_path.remove_filename();
m_path /= p;
@@ -310,18 +484,20 @@
}
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
- void replace_leaf( const boost::filesystem::path & p,
- file_status st, file_status symlink_st )
- { replace_filename( p, st, symlink_st ); }
+ void replace_leaf(const boost::filesystem::path& p,
+ file_status st, file_status symlink_st)
+ { replace_filename(p, st, symlink_st); }
# endif
- const boost::filesystem::path & path() const { return m_path; }
- file_status status( system::error_code & ec = throws() ) const;
- file_status symlink_status( system::error_code & ec = throws() ) const;
+ const boost::filesystem::path& path() const {return m_path;}
+ file_status status() const {return m_get_status();}
+ file_status status(system::error_code& ec) const {return m_get_status(&ec);}
+ file_status symlink_status() const {return m_get_symlink_status();}
+ file_status symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);}
//// conversion simplifies the most common use of directory_entry
// Removed; poor design and too likely to conflict with path v3 constructor templates
- //operator const boost::filesystem::path &() const { return m_path; }
+ //operator const boost::filesystem::path&() const { return m_path; }
//# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
// // deprecated functions preserve common use cases in legacy code
@@ -344,6 +520,8 @@
mutable file_status m_status; // stat()-like
mutable file_status m_symlink_status; // lstat()-like
+ file_status m_get_status(system::error_code* ec=0) const;
+ file_status m_get_symlink_status(system::error_code* ec=0) const;
}; // directory_entry
//--------------------------------------------------------------------------------------//
@@ -357,12 +535,12 @@
namespace detail
{
BOOST_FILESYSTEM_DECL
- system::error_code dir_itr_close( // never throws()
+ system::error_code dir_itr_close( // never throws()
void *& handle
# if defined(BOOST_POSIX_API)
, void *& buffer
# endif
- );
+ );
struct BOOST_FILESYSTEM_DECL dir_itr_imp
{
@@ -381,18 +559,18 @@
~dir_itr_imp() // never throws
{
- dir_itr_close( handle
+ dir_itr_close(handle
# if defined(BOOST_POSIX_API)
, buffer
# endif
- );
+ );
}
};
// see path::iterator: comment below
- BOOST_FILESYSTEM_DECL void directory_iterator_construct( directory_iterator & it,
- const path & p, system::error_code & ec );
- BOOST_FILESYSTEM_DECL void directory_iterator_increment( directory_iterator & it );
+ BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator & it,
+ const path& p, system::error_code * ec);
+ BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator & it);
} // namespace detail
@@ -414,18 +592,21 @@
// iterator_facade derived classes don't seem to like implementations in
// separate translation unit dll's, so forward to detail functions
- directory_iterator( const path & p,
- system::error_code & ec = throws() )
- : m_imp( new detail::dir_itr_imp )
- { detail::directory_iterator_construct( *this, p, ec ); }
+ explicit directory_iterator(const path& p)
+ : m_imp(new detail::dir_itr_imp)
+ { detail::directory_iterator_construct(*this, p, 0); }
+
+ directory_iterator(const path& p, system::error_code& ec)
+ : m_imp(new detail::dir_itr_imp)
+ { detail::directory_iterator_construct(*this, p, &ec); }
~directory_iterator() {} // never throws
private:
friend struct detail::dir_itr_imp;
- friend void detail::directory_iterator_construct( directory_iterator & it,
- const path & p, system::error_code & ec);
- friend void detail::directory_iterator_increment( directory_iterator & it );
+ friend void detail::directory_iterator_construct(directory_iterator & it,
+ const path& p, system::error_code * ec);
+ friend void detail::directory_iterator_increment(directory_iterator & it);
// shared_ptr provides shallow-copy semantics required for InputIterators.
// m_imp.get()==0 indicates the end iterator.
@@ -438,13 +619,13 @@
directory_entry,
boost::single_pass_traversal_tag >::reference dereference() const
{
- BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" );
+ BOOST_ASSERT(m_imp.get() && "attempt to dereference end iterator");
return m_imp->dir_entry;
}
- void increment() { detail::directory_iterator_increment( *this ); }
+ void increment() { detail::directory_iterator_increment(*this); }
- bool equal( const directory_iterator & rhs ) const
+ bool equal(const directory_iterator & rhs) const
{ return m_imp == rhs.m_imp; }
};
@@ -463,158 +644,38 @@
public:
// compiler generates copy constructor and copy assignment
- // constructors without path arguments
-
filesystem_error(
- const std::string & what_arg, system::error_code ec )
+ const std::string & what_arg, system::error_code ec)
: system::system_error(ec, what_arg)
{
try
{
- m_imp_ptr.reset( new m_imp );
+ m_imp_ptr.reset(new m_imp);
}
catch (...) { m_imp_ptr.reset(); }
}
filesystem_error(
- const char * what_arg, system::error_code ec )
+ const std::string & what_arg, const path& path1_arg,
+ system::error_code ec)
: system::system_error(ec, what_arg)
{
try
{
- m_imp_ptr.reset( new m_imp );
- }
- catch (...) { m_imp_ptr.reset(); }
- }
-
- filesystem_error(
- const std::string & what_arg, int ev, const system::error_category & ecat )
- : system::system_error(ev, ecat, what_arg)
- {
- try
- {
- m_imp_ptr.reset( new m_imp );
- }
- catch (...) { m_imp_ptr.reset(); }
- }
-
- filesystem_error(
- const char * what_arg, int ev, const system::error_category & ecat )
- : system::system_error(ev, ecat, what_arg)
- {
- try
- {
- m_imp_ptr.reset( new m_imp );
- }
- catch (...) { m_imp_ptr.reset(); }
- }
-
- // constructors with one path argument
-
- filesystem_error(
- const std::string & what_arg, const path & path1_arg,
- system::error_code ec )
- : system::system_error(ec, what_arg)
- {
- try
- {
- m_imp_ptr.reset( new m_imp );
+ m_imp_ptr.reset(new m_imp);
m_imp_ptr->m_path1 = path1_arg;
}
catch (...) { m_imp_ptr.reset(); }
}
-
- filesystem_error(
- const char * what_arg, const path & path1_arg,
- system::error_code ec )
- : system::system_error(ec, what_arg)
- {
- try
- {
- m_imp_ptr.reset( new m_imp );
- m_imp_ptr->m_path1 = path1_arg;
- }
- catch (...) { m_imp_ptr.reset(); }
- }
-
- filesystem_error(
- const std::string & what_arg, const path & path1_arg,
- int ev, const system::error_category & ecat )
- : system::system_error(ev, ecat, what_arg)
- {
- try
- {
- m_imp_ptr.reset( new m_imp );
- m_imp_ptr->m_path1 = path1_arg;
- }
- catch (...) { m_imp_ptr.reset(); }
- }
-
- filesystem_error(
- const char * what_arg, const path & path1_arg,
- int ev, const system::error_category & ecat )
- : system::system_error(ev, ecat, what_arg)
- {
- try
- {
- m_imp_ptr.reset( new m_imp );
- m_imp_ptr->m_path1 = path1_arg;
- }
- catch (...) { m_imp_ptr.reset(); }
- }
-
- // constructors with two path arguments
filesystem_error(
- const std::string & what_arg, const path & path1_arg,
- const path & path2_arg, system::error_code ec )
- : system::system_error(ec, what_arg)
- {
- try
- {
- m_imp_ptr.reset( new m_imp );
- m_imp_ptr->m_path1 = path1_arg;
- m_imp_ptr->m_path2 = path2_arg;
- }
- catch (...) { m_imp_ptr.reset(); }
- }
-
- filesystem_error(
- const char * what_arg, const path & path1_arg,
- const path & path2_arg, system::error_code ec )
+ const std::string & what_arg, const path& path1_arg,
+ const path& path2_arg, system::error_code ec)
: system::system_error(ec, what_arg)
{
try
{
- m_imp_ptr.reset( new m_imp );
- m_imp_ptr->m_path1 = path1_arg;
- m_imp_ptr->m_path2 = path2_arg;
- }
- catch (...) { m_imp_ptr.reset(); }
- }
-
- filesystem_error(
- const std::string & what_arg, const path & path1_arg,
- const path & path2_arg, int ev, const system::error_category & ecat )
- : system::system_error(ev, ecat, what_arg)
- {
- try
- {
- m_imp_ptr.reset( new m_imp );
- m_imp_ptr->m_path1 = path1_arg;
- m_imp_ptr->m_path2 = path2_arg;
- }
- catch (...) { m_imp_ptr.reset(); }
- }
-
- filesystem_error(
- const char * what_arg, const path & path1_arg,
- const path & path2_arg, int ev, const system::error_category & ecat )
- : system::system_error(ev, ecat, what_arg)
- {
- try
- {
- m_imp_ptr.reset( new m_imp );
+ m_imp_ptr.reset(new m_imp);
m_imp_ptr->m_path1 = path1_arg;
m_imp_ptr->m_path2 = path2_arg;
}
@@ -623,12 +684,12 @@
~filesystem_error() throw() {}
- const path & path1() const
+ const path& path1() const
{
static const path empty_path;
return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ;
}
- const path & path2() const
+ const path& path2() const
{
static const path empty_path;
return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ;
@@ -636,24 +697,24 @@
const char * what() const throw()
{
- if ( !m_imp_ptr.get() )
+ if (!m_imp_ptr.get())
return system::system_error::what();
try
{
- if ( m_imp_ptr->m_what.empty() )
+ if (m_imp_ptr->m_what.empty())
{
m_imp_ptr->m_what = system::system_error::what();
- if ( !m_imp_ptr->m_path1.empty() )
+ if (!m_imp_ptr->m_path1.empty())
{
m_imp_ptr->m_what += ": \"";
- m_imp_ptr->m_what += m_imp_ptr->m_path1.string();
+ m_imp_ptr->m_what += m_imp_ptr->m_path1.native_string();
m_imp_ptr->m_what += "\"";
}
- if ( !m_imp_ptr->m_path2.empty() )
+ if (!m_imp_ptr->m_path2.empty())
{
m_imp_ptr->m_what += ", \"";
- m_imp_ptr->m_what += m_imp_ptr->m_path2.string();
+ m_imp_ptr->m_what += m_imp_ptr->m_path2.native_string();
m_imp_ptr->m_what += "\"";
}
}
Modified: sandbox/filesystem-v3/boost/filesystem/path.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path.hpp 2009-10-27 16:06:40 EDT (Tue, 27 Oct 2009)
@@ -40,7 +40,7 @@
notational convenience.
* Are generic versions of string(), native_string() needed? IE:
template< class T >
- T string( const error_code ec = throws() );
+ T string(const error_code ec = throws());
TODO: Yes; all member functions need to be usable in generic code.
* Assuming generic versions of string(), native_string(), are the w flavors needed?
No. KISS. basic_string<char> is special because it is the predominent
@@ -83,6 +83,9 @@
{
namespace filesystem
{
+# ifdef BOOST_FILESYSTEM_PATH_CTOR_COUNT
+ extern long path_constructor_count;
+# endif
//------------------------------------------------------------------------------------//
// //
@@ -172,9 +175,9 @@
// supplies a conversion locale. For example:
//
// template< class ForwardIterator, class WStringConvert >
- // path( ForwardIterator begin, ForwardIterator end,
+ // path(ForwardIterator begin, ForwardIterator end,
// const std::locale & loc,
- // system::error_code & ec = boost::throws() );
+ // system::error_code & ec = boost::throws());
//
// This alternative was rejected as too complex for the limited benefits;
// it nearly doubles the size of the interface, and adds a lot of
@@ -210,45 +213,48 @@
path(){}
- path( const path & p ) : m_path(p.m_path) {}
+ path(const path& p) : m_path(p.m_path) {}
template <class ContiguousIterator>
- path( ContiguousIterator begin, ContiguousIterator end )
+ path(ContiguousIterator begin, ContiguousIterator end)
{
- if ( begin != end )
- path_traits::convert( &*begin, &*begin+std::distance(begin, end),
- m_path, codecvt() );
+ if (begin != end)
+ path_traits::convert(&*begin, &*begin+std::distance(begin, end),
+ m_path, codecvt());
}
template <class Source>
- path( Source const & pathable )
+ path(Source const & pathable)
{
- path_traits::dispatch( pathable, m_path, codecvt() );
+# ifdef BOOST_FILESYSTEM_PATH_CTOR_COUNT
+ ++path_constructor_count;
+# endif
+ path_traits::dispatch(pathable, m_path, codecvt());
}
// ----- assignments -----
- path & operator=( const path & p )
+ path& operator=(const path& p)
{
m_path = p.m_path;
return *this;
}
template <class ContiguousIterator>
- path & assign( ContiguousIterator begin, ContiguousIterator end )
+ path& assign(ContiguousIterator begin, ContiguousIterator end)
{
m_path.clear();
- if ( begin != end )
- path_traits::convert( &*begin, &*begin+std::distance(begin, end),
- m_path, codecvt() );
+ if (begin != end)
+ path_traits::convert(&*begin, &*begin+std::distance(begin, end),
+ m_path, codecvt());
return *this;
}
template <class Source>
- path & operator=( Source const & source )
+ path& operator=(Source const & source)
{
m_path.clear();
- path_traits::dispatch( source, m_path, codecvt() );
+ path_traits::dispatch(source, m_path, codecvt());
return *this;
}
@@ -257,28 +263,28 @@
// if a separator is added, it is the preferred separator for the platform;
// slash for POSIX, backslash for Windows
- path & operator/=( const path & p );
+ path& operator/=(const path& p);
template <class ContiguousIterator>
- path & append( ContiguousIterator begin, ContiguousIterator end );
+ path& append(ContiguousIterator begin, ContiguousIterator end);
template <class Source>
- path & operator/=( Source const & source );
+ path& operator/=(Source const & source);
// ----- modifiers -----
void clear() { m_path.clear(); }
- void swap( path & rhs ) { m_path.swap( rhs.m_path ); }
- path & remove_filename();
- path & replace_extension( const path & new_extension = path() );
+ void swap(path& rhs) { m_path.swap(rhs.m_path); }
+ path& remove_filename();
+ path& replace_extension(const path& new_extension = path());
# ifdef BOOST_WINDOWS_API
- path & localize(); // change slash to backslash
+ path& localize(); // change slash to backslash
# else // BOOST_POSIX_API
- path & localize() { return *this; } // POSIX m_path already localized
+ path& localize() { return *this; } // POSIX m_path already localized
# endif
@@ -302,9 +308,9 @@
// portable: backslashes are converted to slashes
// template< class T >
-// T string( system::error_code & ec = boost::throws() ) const // internal (i.e. original) format
+// T string(system::error_code & ec = boost::throws()) const // internal (i.e. original) format
// {
-// return path_traits::convert<T>( m_path, ec );
+// return path_traits::convert<T>(m_path, ec);
// }
// ----- native format observers -----
@@ -312,8 +318,8 @@
// access to the internal representation string is efficient and often convenient,
// but may result in less than fully portable code.
- const string_type & native() const { return m_path; } // Throws: nothing
- const value_type * c_str() const { return m_path.c_str(); } // Throws: nothing
+ const string_type& native() const { return m_path; } // Throws: nothing
+ const value_type* c_str() const { return m_path.c_str(); } // Throws: nothing
# ifdef BOOST_WINDOWS_API
@@ -326,9 +332,9 @@
const std::wstring native_wstring() const
{
std::wstring tmp;
- if ( !m_path.empty() )
- path_traits::convert( &*m_path.begin(), &*m_path.begin()+m_path.size(),
- tmp, codecvt() );
+ if (!m_path.empty())
+ path_traits::convert(&*m_path.begin(), &*m_path.begin()+m_path.size(),
+ tmp, codecvt());
return tmp;
}
@@ -380,7 +386,7 @@
// ----- imbue -----
- static std::locale imbue( const std::locale & loc );
+ static std::locale imbue(const std::locale & loc);
// ----- codecvt -----
@@ -405,7 +411,7 @@
# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
// recently deprecated functions supplied by default
- path & remove_leaf() { return remove_filename(); }
+ path& remove_leaf() { return remove_filename(); }
path leaf() const { return filename(); }
path branch_path() const { return parent_path(); }
bool has_leaf() const { return !m_path.empty(); }
@@ -423,15 +429,15 @@
const string_type external_directory_string() const { return native(); }
// older functions no longer supported
- //typedef bool (*name_check)( const std::string & name );
- //basic_path( const string_type & str, name_check ) { operator/=( str ); }
- //basic_path( const typename string_type::value_type * s, name_check )
- // { operator/=( s );}
+ //typedef bool (*name_check)(const std::string & name);
+ //basic_path(const string_type& str, name_check) { operator/=(str); }
+ //basic_path(const typename string_type::value_type* s, name_check)
+ // { operator/=(s);}
//static bool default_name_check_writable() { return false; }
- //static void default_name_check( name_check ) {}
+ //static void default_name_check(name_check) {}
//static name_check default_name_check() { return 0; }
- //basic_path & canonize();
- //basic_path & normalize();
+ //basic_path& canonize();
+ //basic_path& normalize();
# endif
//--------------------------------------------------------------------------------------//
@@ -454,23 +460,23 @@
// Returns: If separator is to be appended, m_path.size() before append. Otherwise 0.
// Note: An append is never performed if size()==0, so a returned 0 is unambiguous.
- void m_erase_redundant_separator( string_type::size_type sep_pos );
+ void m_erase_redundant_separator(string_type::size_type sep_pos);
void m_portable();
- //path & m_normalize();
+ //path& m_normalize();
// Was qualified; como433beta8 reports:
// warning #427-D: qualified name is not allowed in member declaration
friend class iterator;
- friend bool operator<( const path & lhs, const path & rhs );
+ friend bool operator<(const path& lhs, const path& rhs);
- static bool m_path_lex_compare( iterator first1, iterator last1,
- iterator first2, iterator last2 );
+ static bool m_path_lex_compare(iterator first1, iterator last1,
+ iterator first2, iterator last2);
// see path::iterator::increment/decrement comment below
- static void m_path_iterator_increment( path::iterator & it );
- static void m_path_iterator_decrement( path::iterator & it );
+ static void m_path_iterator_increment(path::iterator & it);
+ static void m_path_iterator_decrement(path::iterator & it);
static const codecvt_type *& wchar_t_codecvt_facet();
@@ -493,20 +499,20 @@
private:
friend class boost::iterator_core_access;
friend class boost::filesystem::path;
- friend void m_path_iterator_increment( path::iterator & it );
- friend void m_path_iterator_decrement( path::iterator & it );
+ friend void m_path_iterator_increment(path::iterator & it);
+ friend void m_path_iterator_decrement(path::iterator & it);
- const path & dereference() const { return m_element; }
+ const path& dereference() const { return m_element; }
- bool equal( const iterator & rhs ) const
+ bool equal(const iterator & rhs) const
{
return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos;
}
// iterator_facade derived classes don't seem to like implementations in
// separate translation unit dll's, so forward to class path static members
- void increment() { m_path_iterator_increment( *this ); }
- void decrement() { m_path_iterator_decrement( *this ); }
+ void increment() { m_path_iterator_increment(*this); }
+ void decrement() { m_path_iterator_decrement(*this); }
path m_element; // current element
const path * m_path_ptr; // path being iterated over
@@ -525,16 +531,16 @@
class scoped_path_locale
{
public:
- scoped_path_locale( const std::locale & loc )
+ scoped_path_locale(const std::locale & loc)
: m_saved_locale(loc)
{
- path::imbue( loc );
+ path::imbue(loc);
}
~scoped_path_locale() // never throws()
{
- try { path::imbue( m_saved_locale ); }
- catch ( ... ) {}
+ try { path::imbue(m_saved_locale); }
+ catch (...) {}
};
private:
@@ -549,63 +555,67 @@
// relational operators act as if comparing native format strings
- inline bool operator<( const path & lhs, const path & rhs )
+ inline bool operator<(const path& lhs, const path& rhs)
{
// because path iterators yield paths, std::lexicographical_compare
// infinately recurses, so use a path aware version
return path::m_path_lex_compare(
- lhs.begin(), lhs.end(), rhs.begin(), rhs.end() );
+ lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
- inline bool operator<=( const path & lhs, const path & rhs ) { return !(rhs < lhs); }
- inline bool operator> ( const path & lhs, const path & rhs ) { return rhs < lhs; }
- inline bool operator>=( const path & lhs, const path & rhs ) { return !(lhs < rhs); }
+ inline bool operator<=(const path& lhs, const path& rhs) { return !(rhs < lhs); }
+ inline bool operator> (const path& lhs, const path& rhs) { return rhs < lhs; }
+ inline bool operator>=(const path& lhs, const path& rhs) { return !(lhs < rhs); }
// operator==() efficiency is a concern; a user reported the original version 2
// !(lhs < rhs) && !(rhs < lhs) implementation caused a serious performance problem
// for a map of 10,000 paths.
# ifdef BOOST_WINDOWS_API
- inline bool operator==( const path & lhs, const path::value_type * rhs )
+ inline bool operator==(const path& lhs, const path::value_type* rhs)
{
- const path::value_type * l(lhs.c_str());
- while ( (*l == *rhs || (*l == L'\\' && *rhs == L'/') || (*l == L'/' && *rhs == L'\\'))
- && *l ) { ++l; ++rhs; }
+ const path::value_type* l(lhs.c_str());
+ while ((*l == *rhs || (*l == L'\\' && *rhs == L'/') || (*l == L'/' && *rhs == L'\\'))
+ && *l) { ++l; ++rhs; }
return *l == *rhs || (*l == L'\\' && *rhs == L'/') || (*l == L'/' && *rhs == L'\\');
}
- inline bool operator==( const path & lhs, const path & rhs ) { return lhs == rhs.c_str(); }
- inline bool operator==( const path & lhs, const path::string_type & rhs ) { return lhs == rhs.c_str(); }
- inline bool operator==( const path::string_type & lhs, const path & rhs ) { return rhs == lhs.c_str(); }
- inline bool operator==( const path::value_type * lhs, const path & rhs ) { return rhs == lhs; }
+ inline bool operator==(const path& lhs, const path& rhs) { return lhs == rhs.c_str(); }
+ inline bool operator==(const path& lhs, const path::string_type& rhs) { return lhs == rhs.c_str(); }
+ inline bool operator==(const path::string_type& lhs, const path& rhs) { return rhs == lhs.c_str(); }
+ inline bool operator==(const path::value_type* lhs, const path& rhs) { return rhs == lhs; }
# else // BOOST_POSIX_API
- inline bool operator==( const path & lhs, const path & rhs ) { return lhs.native() == rhs.native(); }
- inline bool operator==( const path & lhs, const path::string_type & rhs ) { return lhs.native() == rhs; }
- inline bool operator==( const path & lhs, const path::value_type * rhs ) { return lhs.native() == rhs; }
- inline bool operator==( const path::string_type & lhs, const path & rhs ) { return lhs == rhs.native(); }
- inline bool operator==( const path::value_type * lhs, const path & rhs ) { return lhs == rhs.native(); }
+ inline bool operator==(const path& lhs, const path& rhs) { return lhs.native() == rhs.native(); }
+ inline bool operator==(const path& lhs, const path::string_type& rhs) { return lhs.native() == rhs; }
+ inline bool operator==(const path& lhs, const path::value_type* rhs) { return lhs.native() == rhs; }
+ inline bool operator==(const path::string_type& lhs, const path& rhs) { return lhs == rhs.native(); }
+ inline bool operator==(const path::value_type* lhs, const path& rhs) { return lhs == rhs.native(); }
# endif
- inline bool operator!=( const path & lhs, const path & rhs ) { return !(lhs == rhs); }
+ inline bool operator!=(const path& lhs, const path& rhs) { return !(lhs == rhs); }
+ inline bool operator!=(const path& lhs, const path::string_type& rhs) { return !(lhs == rhs); }
+ inline bool operator!=(const path& lhs, const path::value_type* rhs) { return !(lhs == rhs); }
+ inline bool operator!=(const path::string_type& lhs, const path& rhs) { return !(lhs == rhs); }
+ inline bool operator!=(const path::value_type* lhs, const path& rhs) { return !(lhs == rhs); }
- inline void swap( path & lhs, path & rhs ) { lhs.swap( rhs ); }
+ inline void swap(path& lhs, path& rhs) { lhs.swap(rhs); }
- inline path operator/( const path & lhs, const path & rhs ) { return path( lhs ) /= rhs; }
+ inline path operator/(const path& lhs, const path& rhs) { return path(lhs) /= rhs; }
// inserters and extractors
- inline std::ostream & operator<<( std::ostream & os, const path & p )
+ inline std::ostream & operator<<(std::ostream & os, const path& p)
{
os << p.native_string();
return os;
}
- inline std::wostream & operator<<( std::wostream & os, const path & p )
+ inline std::wostream & operator<<(std::wostream & os, const path& p)
{
os << p.native_wstring();
return os;
}
- inline std::istream & operator>>( std::istream & is, path & p )
+ inline std::istream & operator>>(std::istream & is, path& p)
{
std::string str;
is >> str;
@@ -613,7 +623,7 @@
return is;
}
- inline std::wistream & operator>>( std::wistream & is, path & p )
+ inline std::wistream & operator>>(std::wistream & is, path& p)
{
std::wstring str;
is >> str;
@@ -623,40 +633,40 @@
// name_checks
- BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name );
- BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name );
- BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name );
- BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name );
- BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name );
- BOOST_FILESYSTEM_DECL bool native( const std::string & name );
+ BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name);
+ BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name);
+ BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name);
+ BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name);
+ BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name);
+ BOOST_FILESYSTEM_DECL bool native(const std::string & name);
//--------------------------------------------------------------------------------------//
// class path member template implementation //
//--------------------------------------------------------------------------------------//
template <class ContiguousIterator>
- path & path::append( ContiguousIterator begin, ContiguousIterator end )
+ path& path::append(ContiguousIterator begin, ContiguousIterator end)
{
- if ( begin == end )
+ if (begin == end)
return *this;
- string_type::size_type sep_pos( m_append_separator_if_needed() );
- if ( begin != end )
- path_traits::convert( &*begin, &*begin+std::distance(begin, end),
- m_path, codecvt() );
- if ( sep_pos )
- m_erase_redundant_separator( sep_pos );
+ string_type::size_type sep_pos(m_append_separator_if_needed());
+ if (begin != end)
+ path_traits::convert(&*begin, &*begin+std::distance(begin, end),
+ m_path, codecvt());
+ if (sep_pos)
+ m_erase_redundant_separator(sep_pos);
return *this;
}
template <class Source>
- path & path::operator/=( Source const & source )
+ path& path::operator/=(Source const & source)
{
- if ( path_traits::empty( source ) )
+ if (path_traits::empty(source))
return *this;
- string_type::size_type sep_pos( m_append_separator_if_needed() );
- path_traits::dispatch( source, m_path, codecvt() );
- if ( sep_pos )
- m_erase_redundant_separator( sep_pos );
+ string_type::size_type sep_pos(m_append_separator_if_needed());
+ path_traits::dispatch(source, m_path, codecvt());
+ if (sep_pos)
+ m_erase_redundant_separator(sep_pos);
return *this;
}
Modified: sandbox/filesystem-v3/libs/filesystem/doc/reference.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/reference.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/reference.html 2009-10-27 16:06:40 EDT (Tue, 27 Oct 2009)
@@ -12,14 +12,15 @@
<body>
-<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="710">
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="933">
<tr>
<td width="277">
<a href="../../../index.htm">
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="277" height="86" border="0"></a></td>
- <td width="410" align="middle">
- <font size="7">Filesystem Library</font>
- </td>
+ <td width="633" align="middle">
+ <font size="7">Filesystem Library<br>
+ Version 3<br>
+ </font></td>
</tr>
</table>
@@ -38,15 +39,11 @@
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
- <td width="26%" valign="top">Introduction<br>
+ <td width="33%" valign="top">Introduction<br>
<a href="#Definitions">Definitions</a><br>
- Requirements<br>
-
-Requirements on programs<br>
- Requirementson implementations<br>
<a href="#Header-filesystem-synopsis">
Header <filesystem> synopsis</a><br>
- Path traits<br>
+ Error reporting<br>
<a href="#Class-template-path">
Class path</a><br>
@@ -64,38 +61,27 @@
path deprecated functions<br>
path non-member functions<br>
path inserter and extractor<span style="background-color: #FFFFFF"><br>
-</span> <a href="#Class-template-basic_filesystem_error">Class template
- basic_filesystem_error</a><br>
-
-<a href="#basic_filesystem_error-constructors">basic_filesystem_error
+</span> Class filesystem_error<br>
+ <a href="#filesystem_error-members">filesystem_error
constructors</a><br>
-
-basic_filesystem_error observers<br>
-
-<a href="#Class-template-directory_entry">Class template
- directory_entry</a><br>
-
+ filesystem_error path1<br>
+ filesystem_error path2<br>
+ filesystem_error what<br>
+Class directory_entry<br>
+
<a href="#directory_entry-constructors">directory_entry constructors</a><br>
-
-directory_entry modifiers<br>
-
-directory_entry observers<br>
-
-directory_entry comparisons<br>
-
-<a href="#Class-template-directory_iterator">Class template
- directory_iterator</a><br>
-
+ directory_entry modifiers<br>
+ directory_entry observers<br>
+ directory_entry comparisons<br>
+Class directory_iterator<br>
+
<a href="#directory_iterator-constructors">directory_iterator
constructors</a><br>
-
-<a href="#Class-template-recursive_directory_iterator">Class template
- recursive_directory_iterator</a><br>
- <a href="#file_status">Class
+Class recursive_directory_iterator<br>
+ <a href="#file_status">Class
file_status</a><br>
</td>
- <td width="35%" valign="top"> </td>
- <td width="89%" valign="top">
+ <td width="33%" valign="top">
<a href="#Operational-functions">
Operational functions</a><br>
  complete<br>
@@ -123,7 +109,8 @@
  status<br>
  status_known<br>
  symlink_status<br>
-   system_complete<br>
+   system_complete</td>
+ <td width="34%" valign="top">
<a href="#header-fstream">Additions
to header <fstream></a><br>
<a href="#Suggestions-for-fstream">Suggestions for <code><fstream></code></a><code><br>
@@ -137,7 +124,7 @@
</table>
<h2><a name="Introduction">Introduction</a></h2>
-<p>Some library behavior is specified by reference to ISO/IEC 9945:2003, <i>
+<p>Some behavior is specified by reference to ISO/IEC 9945:2003, <i>
<a href="http://www.unix.org/single_unix_specification/">POSIX</a></i>. How such behavior is actually implemented is unspecified.</p>
<blockquote>
<p>[<i>Note:</i> This constitutes an "as if" rule for implementation of
@@ -154,12 +141,12 @@
implementation-defined manner.</p>
<blockquote>
<p>[<i>Note:</i> Such errors might be reported by an #error directive, a <code>
-static_assert</code>, a <code>basic_filesystem_error</code> exception, a special
+static_assert</code>, a <code>filesystem_error</code> exception, a special
return value, or some other manner. <i>--end note</i>]</p>
</blockquote>
<p>Specific operating systems such as <i>OpenMVS</i>,
<i>UNIX</i>, and <i>Windows</i> are mentioned only for purposes of illustration or to
-give guidance to implementors. No slight to other operating systems is implied
+give guidance to implementers. No slight to other operating systems is implied
or intended.</p>
<p>The <i>Effects</i> and <i>Postconditions</i> of functions described in this
reference
@@ -216,82 +203,6 @@
when multiple threads, processes, or computers interleave access and
modification of
the same object within a file system.</p>
-<h3><a name="Requirements">Requirements</a></h3>
-<h4><a name="Requirements-on-programs">Requirements on programs</a></h4>
-<p>The arguments for template parameters named <code>Path</code>, <code>path</code>,
-or <code>path</code> described in this clause shall be of type <code>path</code>,
-or a class derived from <code>path</code>, unless otherwise
-specified.</p>
-<h4><a name="Requirements-on-implementations">Requirements on implementations</a></h4>
-<p>Some function templates described in this clause have a template parameter
-named <code>Path</code>, <code>path</code>, or <code>path</code>. When called
-with a function argument <code>s</code> of type <code>char*</code> or <code>
-std::string</code>, the implementation shall treat the argument as if it were
-coded <code>path(s)</code>. When called with a function argument <code>s</code>
-of type <code>wchar_t*</code> or <code>std::wstring</code>, the implementation
-shall treat the argument as if it were coded <code>wpath(s)</code>. For
-functions with two arguments, implementations shall not supply this treatment
-when <code>path</code> and <code>path</code> are different types.</p>
-<blockquote>
-<p>[<i>Note:</i> This "do-the-right-thing" rule allows users to write <code>exists("foo")</code>,
-taking advantage of class <code>path</code>'s string conversion
-constructor, rather
-than the lengthier and more error prone <code>exists(path("foo"))</code>. This
-is particularly important for the simple, script-like, programs which are an
-important use case for the library. Calling two argument functions with
-different types is a very rare usage, and may well be a coding error, so
-automatic conversion is not supported for such cases.</p>
-<p>The implementation technique is unspecified. One possible implementation
-technique, using
-<code>exists()</code> as an example, is:</p>
- <blockquote>
- <pre>template <class Path>
- typename boost::enable_if<is_path<Path>,bool>::type exists(const path& p);
-inline bool exists(const path& p) { return exists<path>(p); }
-inline bool exists(const wpath& p) { return exists<wpath>(p); }</pre>
- </blockquote>
- <p> The <code>enable_if</code> will fail for a C string or <code>
- std::basic_string</code> argument, which will then be automatically converted
- to a <code>path</code> object via the appropriate <code>path</code> conversion
- constructor. <i>-- end note</i>]</p>
- <p><span style="background-color: #E0E0E0"><i>The two overloads are not given
- in the normative text because:</i></span></p>
- <ul>
- <li><span style="background-color: #E0E0E0"><i>Better techniques for
- achieving the desired affect may be developed, perhaps enabled by core
- language changes like Concepts.</i></span></li>
- <li><span style="background-color: #E0E0E0"><i>Implementations may prefer
- techniques that work with legacy compilers that do not support enable_if.</i></span></li>
- <li><span style="background-color: #E0E0E0"><i>Spelling out the overloads
- makes the text longer and harder to read without adding much benefit.</i></span></li>
- <li><span style="background-color: #E0E0E0"><i>More overloads will probably
- be needed for char16_t and char32_t (or whatever they end up being called),
- making it even less attractive to actually spell out each one. </i></span>
- </li>
- </ul>
-</blockquote>
-<p>Implementations of functions described in this clause are permitted to call the applications
-program interface (API) provided by the operating system. If such an operating
-system API call results in an error, implementations
-shall report the error by throwing exception <code>basic_filesystem_error</code>,
-unless otherwise specified.</p>
-<blockquote>
-<p>[<i>Note: </i>Such exceptions and the conditions that cause them to be thrown
-are not explicitly described in each <i>Throws</i> element within this clause.
-Because hardware failures, network failures, race conditions, and a plethora of
-other errors occur frequently in file system operations, users should be aware
-that <span style="background-color: #FFFFFF">unless otherwise specified</span> any file system operation, not matter how apparently innocuous, may throw
-an exception. <i>-- end note</i>]</p>
-</blockquote>
-<p><span style="background-color: #FFFFFF">Functions commonly used in contexts
-where errors are not exceptional have overloads taking an additional argument of
-type </span><code><span style="background-color: #FFFFFF">error_code& ec</span></code><span style="background-color: #FFFFFF">. Such overloaded functions shall not throw exceptions. If an error occurs,
-<code>ec</code> shall be set to the
-error code reported by the operating system, otherwise <code>ec</code> shall be set to 0. If
-an overload without an argument of type </span><code>
-<span style="background-color: #FFFFFF">error_code& ec</span></code><span style="background-color: #FFFFFF"> returns void, the other overload (with an argument of type </span><code>
-<span style="background-color: #FFFFFF">error_code& ec</span></code><span style="background-color: #FFFFFF">) returns an <code>
-error_code</code> with the value of ec.</span></p>
<h3><a name="Header-filesystem-synopsis">Header <code><boost/filesystem></code> synopsis</a></h3>
<pre> namespace boost
{
@@ -299,36 +210,31 @@
{
class path;
- void swap(path & lhs, path & rhs);
+ void swap(path& lhs, path& rhs);
- bool operator==(const path & lhs, const path & rhs);
- bool operator!=(const path & lhs, const path & rhs);
- bool operator< (const path & lhs, const path & rhs);
- bool operator<=(const path & lhs, const path & rhs);
- bool operator> (const path & lhs, const path & rhs);
- bool operator>=(const path & lhs, const path & rhs);
-
- bool operator/ (const path & lhs, const path & rhs);
-
- std::ostream & operator<<( std::ostream & os, const path & p );
- std::wostream & operator<<( std::wostream & os, const path & p );
- std::istream & operator>>( std::istream & is, path & p );
- std::wistream & operator>>( std::wistream & is, path & p )
+ bool operator==(const path& lhs, const path& rhs);
+ bool operator!=(const path& lhs, const path& rhs);
+ bool operator< (const path& lhs, const path& rhs);
+ bool operator<=(const path& lhs, const path& rhs);
+ bool operator> (const path& lhs, const path& rhs);
+ bool operator>=(const path& lhs, const path& rhs);
+
+ path operator/ (const path& lhs, const path& rhs);
+
+ std::ostream& operator<<( std::ostream& os, const path& p );
+ std::wostream& operator<<( std::wostream& os, const path& p );
+ std::istream& operator>>( std::istream& is, path& p );
+ std::wistream& operator>>( std::wistream& is, path& p )
- <span style="background-color: #FFFFFF">class filesystem_error;</span><span style="background-color: #FFFF00">
+ <span style="background-color: #FFFFFF">class filesystem_error;</span><span style="background-color: #FFFF00">
</span>
- class basic_filesystem_error;
-
- typedef filesystem_error filesystem_error;
- typedef basic_filesystem_error<wpath> wfilesystem_error;
+ <span style="background-color: #FFFFFF">class directory_entry;
- <span style="background-color: #FFFFFF">class directory_entry;
-
-</span> class directory_iterator;
+</span> class directory_iterator;
class recursive_directory_iterator;
- enum file_type { status_unknown, file_not_found, regular_file, directory_file,
+ enum <a name="file_type">file_type</a> { status_unknown, file_not_found, regular_file, directory_file,
symlink_file, block_file, character_file, fifo_file, socket_file,
type_unknown
};
@@ -338,8 +244,8 @@
<span style="background-color: #FFFFFF">struct <a name="space_info">space_info</a> // returned by </span>space<span style="background-color: #FFFFFF"> function
{
uintmax_t capacity;
- uintmax_t free;
- uintmax_t available;
+ uintmax_t free;
+ uintmax_t available; // free space available to a non-privileged process
};
BOOST_SCOPED_ENUM_START(<a name="copy_option">copy_option</a>)
@@ -351,119 +257,73 @@
// operational functions
-</span> path complete(const path& p, const path& base, system::error_code& ec=throws());
- path complete(const path& p, system::error_code& ec=throws());
- void copy_file(const path & from, const path & to,
- BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec=throws());
- void copy_file(const path & from, const path & to, system::error_code& ec=throws());
- bool create_directories(const path& p, system::error_code& ec=throws());
- bool create_directory(const path& p, system::error_code& ec=throws());
- void create_hard_link(const path& p, const path& new_link, system::error_code& ec=throws());
-<span style="background-color: #FFFFFF"> void create_symlink(const path& </span><span style="background-color: #FFFFFF">p, const path& new_link</span>, system::error_code& ec=throws()<span style="background-color: #FFFFFF">);
-</span> path current_path(system::error_code& ec=throws());
- void current_path(const path& p, system::error_code& ec=throws());
- bool exists(file_status s);
- bool exists(const path& p, system::error_code& ec=throws());
- bool equivalent(const path& p1, const path& p2, system::error_code& ec=throws());
- <span style="background-color: #FFFFFF; ">uintmax_t</span> file_size(const path& p, system::error_code& ec=throws());
- const path& initial_path(system::error_code& ec=throws());
- bool is_directory(file_status s);
- bool is_directory(const path& p, system::error_code& ec=throws());
- bool is_empty(const path& p, system::error_code& ec=throws());
- bool is_other(file_status s);
- bool is_other(const path& p, system::error_code& ec=throws());
- bool is_regular_file(file_status s);
- bool is_regular_file(const path& p, system::error_code& ec=throws());
- bool is_symlink(file_status s);
- bool is_symlink(const path& p, system::error_code& ec=throws());
- std::time_t last_write_time(const path& p, system::error_code& ec=throws());
- void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec=throws());
- bool remove(const path& p, system::error_code& ec=throws());
- uintmax_t remove_all(const path& p, system::error_code& ec=throws());
- void rename(const path& from, const path& to, system::error_code& ec=throws());
-<span style="background-color: #FFFFFF"> space_info space(const path& p</span>, system::error_code& ec=throws()<span style="background-color: #FFFFFF">);</span><span style="background-color: #FFFF00">
-</span> file_status status(const path& p, system::error_code& ec=throws());
- bool status_known(file_status s);
- file_status symlink_status(const path& p, system::error_code& ec=throws());
- path system_complete(const path& p, system::error_code& ec=throws());
+</span> path complete(const path& p, const path& base, system::error_code& ec=throws());
+ path complete(const path& p, system::error_code& ec=throws());
+ void copy_file(const path& from, const path& to,
+ BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec=throws());
+ void copy_file(const path& from, const path& to, system::error_code& ec=throws());
+ bool create_directories(const path& p, system::error_code& ec=throws());
+ bool create_directory(const path& p, system::error_code& ec=throws());
+ void create_hard_link(const path& p, const path& new_link, system::error_code& ec=throws());
+<span style="background-color: #FFFFFF"> void create_symlink(const path& </span><span style="background-color: #FFFFFF">p, const path& new_link</span>, system::error_code& ec=throws()<span style="background-color: #FFFFFF">);
+</span> path current_path(system::error_code& ec=throws());
+ void current_path(const path& p, system::error_code& ec=throws());
+ bool exists(file_status s);
+ bool exists(const path& p, system::error_code& ec=throws());
+ bool equivalent(const path& p1, const path& p2, system::error_code& ec=throws());
+ <span style="background-color: #FFFFFF; ">uintmax_t</span> file_size(const path& p, system::error_code& ec=throws());
+ const path& initial_path(system::error_code& ec=throws());
+ bool is_directory(file_status s);
+ bool is_directory(const path& p, system::error_code& ec=throws());
+ bool is_empty(const path& p, system::error_code& ec=throws());
+ bool is_other(file_status s);
+ bool is_other(const path& p, system::error_code& ec=throws());
+ bool is_regular_file(file_status s);
+ bool is_regular_file(const path& p, system::error_code& ec=throws());
+ bool is_symlink(file_status s);
+ bool is_symlink(const path& p, system::error_code& ec=throws());
+ std::time_t last_write_time(const path& p, system::error_code& ec=throws());
+ void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec=throws());
+ bool remove(const path& p, system::error_code& ec=throws());
+ uintmax_t remove_all(const path& p, system::error_code& ec=throws());
+ void rename(const path& from, const path& to, system::error_code& ec=throws());
+<span style="background-color: #FFFFFF"> space_info space(const path& p</span>, system::error_code& ec=throws()<span style="background-color: #FFFFFF">);</span><span style="background-color: #FFFF00">
+</span> file_status status(const path& p, system::error_code& ec=throws());
+ bool status_known(file_status s);
+ file_status symlink_status(const path& p, system::error_code& ec=throws());
+ path system_complete(const path& p, system::error_code& ec=throws());
} // namespace filesystem
} // namespace boost</pre>
-<h3><a name="Error-handling">Error handling</a></h3>
-<p><span style="background-color: #FFFF00">To be supplied. See links from
-Operational functions.</span></p>
-<h3><a name="Path-traits">Path traits</a></h3>
-<p>This subclause defines requirements on classes representing path behavior
-traits, and defines two classes that satisfy those requirements for paths based
-on <code>string</code> and <code>wstring</code>.. It also defines several path
-additional path traits structure templates, and defines several specializations
-of them.</p>
-<p>Class template <code>path</code> defined in this clause requires additional
-types, values, and behavior to complete the definition of its semantics.</p>
-<p>For purposes of exposition, Traits behaves as if it is a class with private
-members bool m_locked, initialized false, and std::locale m_locale, initialized </p>
-<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
- <tr>
- <td width="50%" align="center" colspan="2"><b><i>
- <a name="Path-Behavior-Traits-Requirements">Path Behavior Traits
- Requirements</a></i></b></td>
- </tr>
- <tr>
- <td width="38%" align="center"><b><i>Expression</i></b></td>
- <td width="62%" align="center"><b><i>Requirements</i></b></td>
- </tr>
- <tr>
- <td width="38%" valign="top"><code>Traits::external_string_type</code></td>
- <td width="62%">A typedef which is a specialization of <code>basic_string</code>.
- The <code>value_type</code> is a character type used by the operating system
- to represent pathnames.</td>
- </tr>
- <tr>
- <td width="38%" valign="top"><code>Traits::internal_string_type</code></td>
- <td width="62%">A typedef which is a specialization of <code>basic_string</code>.
- The <code>value_type</code> is a character type to be used by the program to
- represent pathnames. Required be the same type as the <code>path
- String</code> template parameter. </td>
- </tr>
- <tr>
- <td width="38%" valign="top"><code>Traits::to_external( p, is )</code></td>
- <td width="62%"><code>is</code>, converted by the <code>m_locale</code>
- <code>codecvt</code> facet to <code>external_string_type</code>.</td>
- </tr>
- <tr>
- <td width="38%" valign="top"><code>Traits::to_internal( p, xs )</code></td>
- <td width="62%"><code>xs</code>, converted by the <code>m_locale</code>
- <code>codecvt</code> facet to to <code>internal_string_type</code>.</td>
- </tr>
- <tr>
- <td width="38%" valign="top"><code>Traits::imbue(loc)</code></td>
- <td width="62%"><i>Effects:</i> if <code>m_locked</code>, throw. Otherwise,
- <code>m_locked = true; m_locale = loc;<br>
- </code><i>Returns:</i> <code>void</code><b><br>
- </b><i>Throws:</i> <code>basic_filesystem_error</code></td>
- </tr>
- <tr>
- <td width="38%" valign="top"><code>Traits::imbue(loc, std::nothrow)</code></td>
- <td width="62%"><i>Effects:</i> <code>if (!m_locked) m_locale = loc; bool
- temp(m_locked); m_locked = true;<br>
- </code><i>Returns:</i> <code>temp</code></td>
- </tr>
-</table>
-<p>Type <code>is_path</code> shall be a <i>UnaryTypeTrait</i> (TR1, 4.1).
-The primary template shall be derived directly or indirectly from <code>
-std::tr1::false_type</code>. Type <code>is_path</code> shall be
-specialized for <code>path</code>, <code>wpath</code>, and any
-user-specialized <code>path</code> types, and such specializations shall
-be derived directly or indirectly from <code>std::tr1::true_type</code>.</p>
-<p>Structure templates <code>slash</code>, <code>dot</code>, and <code>
-<span style="background-color: #FFFFFF">colon</span></code><span style="background-color: #FFFFFF">
-</span>are supplied with
-values of type <code>char</code>. If a user-specialized <code>path</code>
-has a <code>
-value_type</code> type which is not convertible from <code>char</code>, the
-templates <code>slash</code> and <code>dot</code> shall be specialized to
-provide <code>value</code> with type which is convertible to <code>
-path::value_type</code>.</p>
+<h3><a name="Error-handling">Error reporting</a></h3>
+<p>Functions in this library may throw exceptions as described in this section.
+Such exceptions are not explicitly described in each function's <i>Throws</i>
+element.</p>
+<p>Certain functions in this library are specified as having an argument of type
+<code>system::error_code& ec</code>. This argument determines how errors are
+reported by the implementation when a call to an operating system or other
+underlying API results in an error that prevents the library function from
+meeting its specifications:</p>
+<ul>
+ <li>If <code>&ec == &throws()</code>, the function throws an exception of type
+ <code>filesystem_error.</code></li>
+ <li>Otherwise, the function sets <code>ec</code> to an error_code representing
+ the error that occurred.</li>
+</ul>
+<p>If an error does not occur and <code>&ec != &throws()</code>, <code>ec.clear()</code>
+is called.</p>
+<p>Certain failures are reported by throwing an exception, regardless of the
+value of the <code>ec</code> argument:</p>
+<ul>
+ <li>Failure to allocate storage is reported as described in the C++ standard,
+ 17.6.4.10 [res.on.exception.handling].</li>
+ <li>Class <code>path</code> failures are reported by throwing an exception of
+ type <code>system_error</code>.</li>
+</ul>
+<p>[<i>Note: </i>Because hardware failures, network failures, race conditions, and a plethora of
+other errors occur frequently in file system operations, users should be aware
+that any filesystem operational function, no matter how innocuous, may encounter
+an error. <i>-- end note</i>]</p>
<h3><a name="Class-template-path">Class <code>path</code></a></h3>
<p>An object of class <code>path</code> represents a path,
and contains a pathname in the
@@ -875,7 +735,7 @@
<blockquote>
<p><i>Postcondition:</i> <code>this->empty()</code> is true.</p>
</blockquote>
-<pre><code><span style="background-color: #FFFFFF">void swap( path & rhs );</span></code></pre>
+<pre><code><span style="background-color: #FFFFFF">void swap( path& rhs );</span></code></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF">
Swaps the contents of the two paths.</span></p>
@@ -895,7 +755,7 @@
directory_iterator</code>. It is made public to allow additional uses. <i>-- end
note</i>]</p>
</blockquote>
-<pre>path& replace_extension(const path & new_extension = path());</pre>
+<pre>path& replace_extension(const path& new_extension = path());</pre>
<blockquote>
<p><i>Postcondition: </i> <code>extension() == <i>replacement</i></code>,
where <code><i>replacement</i></code> is <code>new_extension</code> if <code>
@@ -1353,7 +1213,7 @@
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
</span> <code><span style="background-color: #FFFFFF">os</span></code></p>
</blockquote>
-<h3><a name="Class-template-basic_filesystem_error">Class template <code>basic_filesystem_error</code></a></h3>
+<h3><a name="Class-filesystem_error">Class <code>filesystem_error</code></a></h3>
<pre> namespace boost
{
namespace filesystem
@@ -1361,24 +1221,23 @@
class basic_filesystem_error : public <span style="background-color: #FFFFFF">system</span>_error
{
public:
- typedef Path path_type;
- explicit basic_filesystem_error(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, error_code ec);
- basic_filesystem_error(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, const path_type& p1, error_code ec);
- basic_filesystem_error(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, const path_type& p1, const path_type& p2, error_code ec);
+ filesystem_error(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, system::error_code ec);
+ filesystem_error(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, const path& p1, system::error_code ec);
+ filesystem_error(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, const path& p1, const path& p2, system::error_code ec);
- const path_type& path1() const;
- const path_type& path2() const;
+ const path& path1() const;
+ const path& path2() const;
- const char * what() const;
+ const char * what() const;
};
} // namespace filesystem
} // namespace boost</pre>
<p>The class template <code>basic_filesystem_error</code> defines the type of
objects thrown as exceptions to report file system errors from functions described in this
clause.</p>
-<h4> <a name="basic_filesystem_error-constructors"> <code>basic_filesystem_error</code> constructors</a></h4>
-<pre>explicit basic_filesystem_error(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, error_code ec);</pre>
+<h4> <a name="filesystem_error-members"> <code>filesystem_error</code> members</a></h4>
+<pre><a name="filesystem_error-2-arg">filesystem_error</a>(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, error_code ec);</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="46%">
@@ -1406,7 +1265,7 @@
</tr>
</table>
</blockquote>
-<pre>basic_filesystem_error(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, const path_type& p1, error_code ec);</pre>
+<pre><a name="filesystem_error-3-arg">filesystem_error</a>(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, const path_type& p1, error_code ec);</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="46%">
@@ -1435,7 +1294,7 @@
</tr>
</table>
</blockquote>
-<pre>basic_filesystem_error(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, const path_type& p1, const path_type& p2, error_code ec);</pre>
+<pre><a name="filesystem_error-4-arg">filesystem_error</a>(const std::string& <span style="background-color: #FFFFFF">what_arg</span>, const path_type& p1, const path_type& p2, error_code ec);</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="46%">
@@ -1466,32 +1325,25 @@
</tr>
</table>
</blockquote>
-<h4> <a name="basic_filesystem_error-observers"> <code>basic_filesystem_error</code> observers</a></h4>
-<pre>const path_type& path1() const;</pre>
+<pre>const path& <a name="filesystem_error-path1">path1</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> Reference to copy of <code>p1</code> stored by the
constructor, or, if none, an empty path.</p>
</blockquote>
-<pre>const path_type& path2() const;</pre>
+<pre>const path& <a name="filesystem_error-path2">path2</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> Reference to copy of <code>p2</code> stored by the
constructor, or, if none, an empty path.</p>
</blockquote>
-<pre>const char * what() const;</pre>
+<pre>const char* <a name="filesystem_error-what">what</a>() const;</pre>
<blockquote>
- <p><i>Returns: </i>A string containing <code>runtime_error::what()</code> and
- the result of calling <code>system_message()</code> with a first argument of
- <code>code()</code>. The exact format is unspecified.</p>
-<p>The implementation shall supply a specialization <code>template<> const char
-* filesystem_error::what() const</code> that returns a string
-containing <code>runtime_error::what(),</code> the result of calling <code>
-system_message()</code> with a first argument of <code>code()</code>, and if
-non-empty, <code>path1().file_string()</code> and <code>path2.file_string()</code>.
-The exact format is unspecified.</p>
-<p>Implementations and users are permitted to provide other specializations of
-the <code>what</code> member function.</p>
+ <p><i>Returns: </i>A string containing <code>runtime_error::what()</code>. The exact format is unspecified.
+ Implementations are encouraged but not required to include <code>
+ path1.native_string()</code>if not empty, <code>path2.native_string()</code>if
+ not empty, and <code>system_error::what()</code> strings in the returned
+ string.</p>
</blockquote>
-<h3><a name="Class-template-directory_entry">Class template <code>directory_entry</code></a></h3>
+<h3><a name="Class-directory_entry">Class <code>directory_entry</code></a></h3>
<pre> namespace boost
{
namespace filesystem
@@ -1499,36 +1351,21 @@
class directory_entry
{
public:
- typedef Path path_type;
- typedef typename Path::string_type string_type;
// constructors
directory_entry();
- explicit directory_entry(const path_type& p,
- <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
+ explicit directory_entry(const path_type& p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
// modifiers
void assign(const path_type& p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
void replace_filename(const string_type& s, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
// observers
- const path& path() const;
- operator const path() const;
-<span style="background-color: #FFFFFF">
- file_status status() const;
- file_status status(error_code& ec) const;
- file_status symlink_status() const;
- file_status symlink_status(error_code& ec) const;
+ const path& path() const;
+<span style="background-color: #FFFFFF"> file_status status(system::error_code& ec=throws()) const;
+ file_status symlink_status(system::error_code& ec=throws()) const;
</span><span style="background-color: #FFFF00">
-</span> // comparisons
- bool operator<(const directory_entry<Path>& rhs);
- bool operator==(const directory_entry<Path>& rhs);
- bool operator!=(const directory_entry<Path>& rhs);
- bool operator>(const directory_entry<Path>& rhs);
- bool operator<=(const directory_entry<Path>& rhs);
- bool operator>=(const directory_entry<Path>& rhs);
-
- private:
+</span> private:
path_type m_path; // for exposition only
mutable <span style="background-color: #FFFFFF">file_status</span> m_status; // for exposition only; stat()-like
mutable <span style="background-color: #FFFFFF">file_status</span> m_symlink_status; // for exposition only; lstat()-like
@@ -1642,28 +1479,11 @@
</table>
</blockquote>
<h4> <a name="directory_entry-observers"> <code>directory_entry</code> observers</a></h4>
-<pre>const path& path() const;
-operator const path() const;</pre>
+<pre>const path& path() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>m_path</code></p>
</blockquote>
-<pre><span style="background-color: #FFFFFF">file_status status() const;</span></pre>
-<blockquote>
-<p><span style="font-style: italic; background-color: #FFFFFF">Effects:</span><span style="background-color: #FFFFFF">
-As if,</span></p>
- <blockquote>
- <pre><span style="background-color: #FFFFFF">if ( !status_known( m_status ) )
-{
- if ( status_known(m_symlink_status) && !is_symlink(m_symlink_status) )
- { m_status = m_symlink_status; }
- else { m_status = status(m_path); }
-}</span></pre>
- </blockquote>
- <p><span style="background-color: #FFFFFF"><i>Throws:</i> See <code>status</code>
- function.</span></p>
- <p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_status</code></span></p>
-</blockquote>
-<pre><span style="background-color: #FFFFFF">file_status status(error_code& ec) const;</span></pre>
+<pre><span style="background-color: #FFFFFF">file_status status(system::error_code& ec=throws()) const;</span></pre>
<blockquote>
<p><span style="font-style: italic; background-color: #FFFFFF">Effects:</span><span style="background-color: #FFFFFF">
As if,</span></p>
@@ -1674,26 +1494,11 @@
{ m_status = m_symlink_status; }
else { m_status = status(m_path, ec); }
}
-else ec = 0;</span></pre>
+else if ( &ec != &boost::throws() ) ec.clear();</span></pre>
</blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_status</code></span></p>
</blockquote>
-<pre><span style="background-color: #FFFFFF">file_status symlink_status() const;</span></pre>
-<blockquote>
-<p><span style="font-style: italic; background-color: #FFFFFF">Effects:</span><span style="background-color: #FFFFFF">
-As if,</span></p>
- <blockquote>
- <pre><span style="background-color: #FFFFFF">if ( !status_known( m_symlink_status ) )
-{
- m_symlink_status = symlink_status(m_path);
-}</span></pre>
- </blockquote>
- <p><span style="background-color: #FFFFFF"><i>Throws:</i> See <code>symlink_status</code>
- function.</span></p>
- <p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>
- m_symlink_status</code></span></p>
-</blockquote>
-<pre><span style="background-color: #FFFFFF">file_status symlink_status(error_code& ec) const;</span></pre>
+<pre><span style="background-color: #FFFFFF">file_status symlink_status(system::error_code& ec=throws()) const;</span></pre>
<blockquote>
<p><span style="font-style: italic; background-color: #FFFFFF">Effects:</span><span style="background-color: #FFFFFF">
As if,</span></p>
@@ -1702,28 +1507,28 @@
{
m_symlink_status = symlink_status(m_path, ec);
}
-else ec = 0;</span></pre>
+else if ( &ec != &boost::throws() ) ec.clear();</span></pre>
</blockquote>
- <p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_symlink_status</code></span></p>
+ <p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>
+ m_symlink_status</code></span></p>
</blockquote>
-<h3><a name="Class-template-directory_iterator">Class template <code>directory_iterator</code></a></h3>
+<h3><a name="Class-directory_iterator">Class <code>directory_iterator</code></a></h3>
<pre> namespace boost
{
namespace filesystem
{
- template <class Path>
- class directory_iterator :
- public iterator<input_iterator_tag, directory_entry<Path> >
+ class directory_iterator
+ : public boost::iterator_facade< directory_iterator,
+ directory_entry,
+ boost::single_pass_traversal_tag >
{
public:
typedef Path path_type;
// constructors
- directory_iterator();
- explicit directory_iterator(const path dp);
- directory_iterator(const path dp, error_code& ec);
- directory_iterator(const directory_iterator& bdi);
- directory_iterator& operator=(const directory_iterator& bdi);
+ directory_iterator(); // creates the "end" iterator
+ explicit directory_iterator(const path& p, system::error_code& ec=throws());
+
~directory_iterator();
// other members as required by
@@ -1733,28 +1538,28 @@
} // namespace filesystem
} // namespace boost</pre>
<p> <code>directory_iterator</code> satisfies the requirements of an
-input iterator (C++ Std, 24.1.1, Input iterators [lib.input.iterators]).</p>
+input iterator (C++ Std, 24.2.1, Input iterators [input.iterators]).</p>
<p>A <code>directory_iterator</code> reads successive elements from the directory for
which it was constructed, as if by calling <i>POSIX</i>
<code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/readdir_r.html">readdir_r()</a></code>. After a <code>directory_iterator</code> is constructed, and every time
<code>operator++</code> is called,
-it reads and stores a value of <code>directory_entry<Path></code>
-and possibly stores associated status values.
+it reads a directory element and stores information about it in a object of type <code>
+directory_entry</code>.
<code>operator++</code> is not equality preserving; that is, <code>i == j</code> does not imply that
<code>++i == ++j</code>. </p>
<blockquote>
<p>[<i>Note:</i> The practical consequence of not preserving equality is that directory iterators
-can be used only for single-pass algorithms. <i>--end note</i>]</p>
+can only be used for single-pass algorithms. <i>--end note</i>]</p>
</blockquote>
<p>If the end of the directory elements is reached, the iterator becomes equal to
the end iterator value. The constructor <code>directory_iterator()</code>
with no arguments always constructs an end iterator object, which is the only
legitimate iterator to be used for the end condition. The result of <code>
operator*</code> on an end iterator is not defined. For any other iterator value
-a <code>const directory_entry<Path>&</code> is returned. The result of
+a <code>const directory_entry&</code> is returned. The result of
<code>operator-></code> on an end iterator is not defined. For any other
-iterator value a <code>const directory_entry<Path>*</code> is
+iterator value a <code>const directory_entry*</code> is
returned. </p>
<p>Two end iterators are always equal. An end iterator is not equal to a non-end
iterator.</p>
@@ -1769,39 +1574,6 @@
object composed of the directory argument from which the iterator was
constructed with filename of the directory entry appended as if by <code>
operator/=</code>. </p>
-<blockquote>
-<p>[<i><a name="Example-program">Example</a>: </i>This program accepts an
-optional command line argument, and if that argument is a directory pathname,
-iterates over the contents of the directory. For each directory entry, the name
-is output, and if the entry is for a regular file, the size of the file is
-output.</p>
- <blockquote>
- <pre>#include <iostream>
-#include <filesystem>
-
-using std::tr2::sys;
-using std::cout;
-
-int main(int argc, char* argv[])
-{
- std::string p(argc <= 1 ? "." : argv[1]);
-
- if (is_directory(p))
- {
- for (directory_iterator itr(p); itr!=directory_iterator(); ++itr)
- {
- cout << itr->path().filename() << ' '; // display filename only
- if (is_regular_file(itr->status())) cout << " [" << file_size(itr->path()) << ']';
- cout << '\n';
- }
- }
- else cout << (exists(p) : "Found: " : "Not found: ") << p << '\n';
-
- return 0;
-}</pre>
- </blockquote>
- <p><i>-- end example</i>]</p>
-</blockquote>
<p>Directory iteration shall not yield directory entries for the current (<i>dot</i>)
and parent (<i>dot dot</i>) directories.</p>
<p>The order of directory entries obtained by dereferencing successive
@@ -1832,8 +1604,7 @@
</blockquote>
-<p><code>explicit directory_iterator(const path dp);</code></p>
-
+<pre><code>explicit directory_iterator(</code>const path& p, system::error_code& ec=throws()<code>);</code></pre>
<blockquote>
<p><i>Effects:</i> Constructs a iterator representing the first
@@ -1843,31 +1614,19 @@
directory_iterator(".")</code> rather than <code>directory_iterator("")</code>.
<i>-- end note</i>]</p>
</blockquote>
-<pre><code>directory_iterator(const path dp, error_code& ec );</code></pre>
-<blockquote>
-
-<p><i>Effects:</i> Constructs a iterator representing the first
-entry in the directory resolved to by <code>dp</code>, otherwise, the end iterator.
-If an error occurs while establishing the results, the iterator constructed
-represents the end iterator and <code>ec</code> is set to the error code
-reported by the operating system, otherwise to 0.</p>
-
-</blockquote>
-<h3><a name="Class-template-recursive_directory_iterator">Class template <code>recursive_directory_iterator</code></a></h3>
+<h3><a name="Class-template-recursive_directory_iterator">Class <code>recursive_directory_iterator</code></a></h3>
<pre> namespace boost
{
namespace filesystem
{
- template <class Path>
class recursive_directory_iterator :
- public iterator<input_iterator_tag, directory_entry<Path> >
+ public iterator<input_iterator_tag, directory_entry >
{
public:
- typedef Path path_type;
// constructors
recursive_directory_iterator();
- explicit recursive_directory_iterator(const path dp);
+ explicit recursive_directory_iterator(const path& dp);
recursive_directory_iterator(const recursive_directory_iterator& brdi);
recursive_directory_iterator& operator=(const recursive_directory_iterator& brdi);
~recursive_directory_iterator();
@@ -1880,7 +1639,7 @@
void no_push();
// other members as required by
- // C++ Std, 24.1.1 Input iterators [lib.input.iterators]
+ // C++ Std, 24.1.2 Input iterators [input.iterators]
private:
int m_level; // for exposition only
@@ -1920,27 +1679,27 @@
public:
explicit file_status( file_type v = status_unknown );
- file_type type() const;
+ file_type type() const;
void type( file_type v );
};
} // namespace filesystem
} // namespace boost</pre>
-<p>A <code>file_status</code> object stores information about the status of a
+<p>An object of type <code>file_status</code> stores information about the status of a
file. The internal form of the stored information is unspecified.</p>
<blockquote>
<p><i>[Note: </i>The class may be extended in the future to store
additional status information. <i>--end note]</i></p>
</blockquote>
<h4>Members</h4>
-<pre>explicit file_status( file_type v = status_unknown );</pre>
+<pre>explicit file_status( file_type v = status_unknown );</pre>
<blockquote>
<p><i>Effects:</i> Stores <code>v</code>.</p>
</blockquote>
<pre>file_type type() const;</pre>
<blockquote>
- <p><i>Returns: </i>The stored <code>file_type</code>.</p>
+ <p><i>Returns: </i>The stored file_type
.</p>
</blockquote>
-<pre>void type( file_type v );</pre>
+<pre>void type( file_type v );</pre>
<blockquote>
<p><i>Effects:</i> Stores <code>v</code>, replacing the previously stored
value.</p>
@@ -2000,7 +1759,7 @@
<blockquote>
<p><i>Returns:</i> <code>path(p, initial_path(), ec)</code>.</p>
</blockquote>
-<pre>void <a name="copy_file">copy_file</a>(const path & from, const path & to,
+<pre>void <a name="copy_file">copy_file</a>(const path& from, const path& to,
BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec=throws());</pre>
<blockquote>
<p><i>Effects:</i> The contents and attributes of the file <code>from</code>
@@ -2010,7 +1769,7 @@
(option==copy_option::fail_if_exists
&& exists(to))</code></p>
</blockquote>
-<pre>void copy_file(const path & from, const path & to, system::error_code& ec=throws());</pre>
+<pre>void copy_file(const path& from, const path& to, system::error_code& ec=throws());</pre>
<blockquote>
<p><i>Effects: </i><code>copy_file(from, to,
copy_option::fail_if_exists, ec)</code>.</p>
@@ -2106,7 +1865,7 @@
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
<code>status_known(s) && s.type() != file_not_found</code></span></p>
</blockquote>
-<pre>bool <a name="exists">exists</a>(const path& p, system::error_code& ec=throws());</pre>
+<pre>bool <a name="exists2">exists</a>(const path& p, system::error_code& ec=throws());</pre>
<blockquote>
<p><i>Returns:</i> <code>exists( status(p, ec) )</code></p>
</blockquote>
@@ -2171,7 +1930,7 @@
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> </span>
<code><span style="background-color: #FFFFFF">s.type() == directory_file</span></code></p>
</blockquote>
-<pre><code>bool is_directory(const path& p, system::error_code& ec=throws());</code></pre>
+<pre><code>bool <a name="is_directory2">is_directory</a>(const path& p, system::error_code& ec=throws());</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_directory( status(p, ec) )</code></p>
</blockquote>
@@ -2194,7 +1953,7 @@
<code>is_other()</code> will remain unchanged even if additional <code>is_xxx()</code>
functions are added in the future. <i>-- end note</i>]</span></p>
</blockquote>
-<pre><code>bool is_other(const path& p, system::error_code& ec=throws());</code></pre>
+<pre><code>bool <a name="is_other2">is_other</a>(const path& p, system::error_code& ec=throws());</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_other( status(p, ec) )</code></p>
</blockquote>
@@ -2203,7 +1962,7 @@
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
<code>s.type() == regular_file</code></span></p>
</blockquote>
-<pre><code>bool is_regular_file(const path& p, system::error_code& ec=throws());</code></pre>
+<pre><code>bool <a name="is_regular_file2">is_regular_file</a>(const path& p, system::error_code& ec=throws());</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_regular_file( status(p, ec) )</code></p>
</blockquote>
@@ -2212,7 +1971,7 @@
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> </span>
<code><span style="background-color: #FFFFFF">s.type() == symlink_file</span></code></p>
</blockquote>
-<pre><code>bool is_symlink(const path& p, system::error_code& ec=throws());</code></pre>
+<pre><code>bool <a name="is_symlink2">is_symlink</a>(const path& p, system::error_code& ec=throws());</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_symlink( symlink_status(p, ec) )</code></p>
</blockquote>
@@ -2224,7 +1983,7 @@
as if by <i>POSIX</i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>.</p>
</blockquote>
-<pre>void last_write_time(const path& p, const std::time_t new_time<code>, system::error_code& ec=throws()</code>);</pre>
+<pre>void <a name="last_write_time2">last_write_time</a>(const path& p, const std::time_t new_time<code>, system::error_code& ec=throws()</code>);</pre>
<blockquote>
<p><i>Effects:</i> Sets the time of last data modification of the file
resolved to by <code>p</code>
@@ -2412,37 +2171,56 @@
<table border="1" cellpadding="5" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td>
- <h4>Deprecated convenience functions</h4>
- <p>The following functions have been replaced by <code>path</code>
- member functions <code>extension()</code>, <code>stem()</code>, and <code>
- replace_extension()</code>.</p>
-<pre>typename Path::string_type extension(const Path & p);</pre>
-<blockquote>
- <p><i>Returns:</i> if <code>p.filename()</code> contains a <i>dot</i>, returns
- the substring of <code>p.filename()</code> starting at the rightmost <i>dot</i>
- and ending at the string's end. Otherwise, returns an empty string. </p>
- <p>[<i>Note:<b> </b></i>The <i>dot</i> is included in the return value so that
- it is possible to distinguish between no extension and an empty extension. </p>
- <p>Implementations are permitted but not required to define additional
+ <h4><span style="background-color: #FFFF00">Deprecated convenience functions</span></h4>
+ <p><span style="background-color: #FFFF00">The following functions have been replaced by
+ </span> <code><span style="background-color: #FFFF00">path</span></code><span style="background-color: #FFFF00">
+ member functions </span> <code><span style="background-color: #FFFF00">extension()</span></code><span style="background-color: #FFFF00">,
+ </span> <code><span style="background-color: #FFFF00">stem()</span></code><span style="background-color: #FFFF00">, and
+ </span> <code>
+ <span style="background-color: #FFFF00">replace_extension()</span></code><span style="background-color: #FFFF00">.</span></p>
+<pre><span style="background-color: #FFFF00">typename </span><span style="background-color: #FFFF00">Path::string_type</span><span style="background-color: #FFFF00"> </span><span style="background-color: #FFFF00">extension(const</span><span style="background-color: #FFFF00"> path& p);</span></pre>
+<blockquote>
+ <p><i><span style="background-color: #FFFF00">Returns:</span></i><span style="background-color: #FFFF00"> if
+ </span> <code><span style="background-color: #FFFF00">p.filename()</span></code><span style="background-color: #FFFF00"> contains a
+ </span> <i><span style="background-color: #FFFF00">dot</span></i><span style="background-color: #FFFF00">, returns
+ the </span><span style="background-color: #FFFF00">substring</span><span style="background-color: #FFFF00"> of
+ </span> <code><span style="background-color: #FFFF00">p.filename()</span></code><span style="background-color: #FFFF00"> starting at the rightmost
+ </span> <i><span style="background-color: #FFFF00">dot</span></i><span style="background-color: #FFFF00">
+ and ending at the string's end. Otherwise, returns an empty string. </span> </p>
+ <p><span style="background-color: #FFFF00">[</span><i><span style="background-color: #FFFF00">Note:</span><b><span style="background-color: #FFFF00">
+ </span> </b></i><span style="background-color: #FFFF00">The </span> <i>
+ <span style="background-color: #FFFF00">dot</span></i><span style="background-color: #FFFF00"> is included in the return value so that
+ it is possible to distinguish between no extension and an empty extension.
+ </span> </p>
+ <p><span style="background-color: #FFFF00">Implementations are permitted but not required to define additional
behavior for file systems which append additional elements to extensions, such
- as alternate data stream or partitioned dataset names. <i>-- end note</i>]</p>
-</blockquote>
-<pre>typename Path::string_type basename(const Path & p);</pre>
-<blockquote>
- <p><i>Returns:</i> if <code>p.filename()</code> contains a <i>dot</i>, returns
- the substring of <code>p.filename()</code> starting at its beginning and
- ending at the last <i>dot</i> (the <i>dot</i> is not included). Otherwise,
- returns <code>
- p.filename()</code>.</p>
+ as alternate data stream or partitioned dataset names. </span> <i>
+ <span style="background-color: #FFFF00">-- end note</span></i><span style="background-color: #FFFF00">]</span></p>
</blockquote>
-<pre>template <class Path>
- Path change_extension(const Path & p, const typename Path::string_type & new_extension);</pre>
+<pre><span style="background-color: #FFFF00">typename </span><span style="background-color: #FFFF00">Path::string_type</span><span style="background-color: #FFFF00"> </span><span style="background-color: #FFFF00">basename(const</span><span style="background-color: #FFFF00"> path& p);</span></pre>
<blockquote>
- <p><i>Postcondition:</i> <code>basename(<i>return_value</i>) == basename(p) &&
- extension(<i>return_value</i>) == new_extension</code> </p>
- <p>[<i>Note:</i> It follows from the semantics of <code>extension()</code>
- that <code>new_extension</code> should include <i>dot</i> to achieve
- reasonable results. <i>-- end note</i>]</p>
+ <p><i><span style="background-color: #FFFF00">Returns:</span></i><span style="background-color: #FFFF00"> if
+ </span> <code><span style="background-color: #FFFF00">p.filename()</span></code><span style="background-color: #FFFF00"> contains a
+ </span> <i><span style="background-color: #FFFF00">dot</span></i><span style="background-color: #FFFF00">, returns
+ the </span><span style="background-color: #FFFF00">substring</span><span style="background-color: #FFFF00"> of
+ </span> <code><span style="background-color: #FFFF00">p.filename()</span></code><span style="background-color: #FFFF00"> starting at its beginning and
+ ending at the last </span> <i><span style="background-color: #FFFF00">dot</span></i><span style="background-color: #FFFF00"> (the
+ </span> <i><span style="background-color: #FFFF00">dot</span></i><span style="background-color: #FFFF00"> is not included). Otherwise,
+ returns </span> <code>
+ <span style="background-color: #FFFF00">p.filename()</span></code><span style="background-color: #FFFF00">.</span></p>
+</blockquote>
+<pre><span style="background-color: #FFFF00">template <class Path>
+ Path </span><span style="background-color: #FFFF00">change_extension(const</span><span style="background-color: #FFFF00"> path& p, const typename </span><span style="background-color: #FFFF00">Path::string_type</span><span style="background-color: #FFFF00"> & </span><span style="background-color: #FFFF00">new_extension</span><span style="background-color: #FFFF00">);</span></pre>
+<blockquote>
+ <p><i><span style="background-color: #FFFF00">Postcondition:</span></i><span style="background-color: #FFFF00">
+ </span> <code><span style="background-color: #FFFF00">basename(<i>return_value</i>) == basename(p) &&
+ extension(<i>return_value</i>) == new_extension</span></code><span style="background-color: #FFFF00">
+ </span> </p>
+ <p><span style="background-color: #FFFF00">[</span><i><span style="background-color: #FFFF00">Note:</span></i><span style="background-color: #FFFF00"> It follows from the semantics of
+ </span> <code><span style="background-color: #FFFF00">extension()</span></code><span style="background-color: #FFFF00">
+ that </span> <code><span style="background-color: #FFFF00">new_extension</span></code><span style="background-color: #FFFF00"> should include
+ </span> <i><span style="background-color: #FFFF00">dot</span></i><span style="background-color: #FFFF00"> to achieve
+ reasonable results. </span> <i><span style="background-color: #FFFF00">-- end note</span></i><span style="background-color: #FFFF00">]</span></p>
</blockquote>
</td>
</tr>
@@ -3131,7 +2909,7 @@
<tr>
<td width="16%" valign="top">[<a name="ISO_POSIX">ISO-POSIX</a>]</td>
<td width="84%">ISO/IEC 9945:2003, IEEE Std 1003.1-2001, and The Open Group
- Base Specifications, Issue 6. Also known as The Single Unix<font face="Times New Roman">®
+ Base Specifications, Issue 6. Also known as The Single Unix<font face="Times New Roman">®
Specification, Version 3. Available from each of the organizations involved
in its creation. For example, read online or download from
<a href="http://www.unix.org/single_unix_specification/">
@@ -3151,7 +2929,7 @@
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->17 October 2009<!--webbot bot="Timestamp" endspan i-checksum="32672" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->18 October 2009<!--webbot bot="Timestamp" endspan i-checksum="32674" --></p>
</body>
Modified: sandbox/filesystem-v3/libs/filesystem/src/operations.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/operations.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/operations.cpp 2009-10-27 16:06:40 EDT (Tue, 27 Oct 2009)
@@ -14,9 +14,9 @@
// the library is being built (possibly exporting rather than importing code)
#define BOOST_FILESYSTEM_SOURCE
-#define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r() needs this
+#define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r()needs this
-// enable the XPG-compliant version of readdir_r() on AIX
+// enable the XPG-compliant version of readdir_r()on AIX
#if defined(_AIX)
# define _LINUX_SOURCE_COMPAT
#endif
@@ -29,8 +29,8 @@
// 64-bit systems or on 32-bit systems which don't have files larger
// than can be represented by a traditional POSIX/UNIX off_t type.
// OTOH, defining them should kick in 64-bit off_t's (and thus
- // st_size) on 32-bit systems that provide the Large File
- // Support (LFS) interface, such as Linux, Solaris, and IRIX.
+ // st_size)on 32-bit systems that provide the Large File
+ // Support (LFS)interface, such as Linux, Solaris, and IRIX.
// The defines are given before any headers are included to
// ensure that they are available to all included headers.
// That is required at least on Solaris, and possibly on other
@@ -52,7 +52,6 @@
using boost::system::error_category;
using boost::system::system_category;
using boost::throw_exception;
-using boost::throws;
using std::string;
using std::wstring;
@@ -83,7 +82,7 @@
#endif
# include <sys/mount.h>
# define BOOST_STATVFS statfs
-# define BOOST_STATVFS_F_FRSIZE static_cast<boost::uintmax_t>( vfs.f_bsize )
+# define BOOST_STATVFS_F_FRSIZE static_cast<boost::uintmax_t>(vfs.f_bsize)
# endif
# include <dirent.h>
# include <unistd.h>
@@ -97,8 +96,8 @@
// macros being tested come from dirent.h.
//
// TODO: find out what macros indicate dirent::d_type present in more libraries
-# if defined(BOOST_WINDOWS_API) \
- || defined(_DIRENT_HAVE_D_TYPE) // defined by GNU C library if d_type present
+# if defined(BOOST_WINDOWS_API)\
+ || defined(_DIRENT_HAVE_D_TYPE)// defined by GNU C library if d_type present
# define BOOST_FILESYSTEM_STATUS_CACHE
# endif
@@ -127,17 +126,17 @@
// POSIX uses a 0 return to indicate success
# define BOOST_ERRNO errno
-# define BOOST_SET_CURRENT_DIRECTORY(P) (::chdir(P) == 0)
-# define BOOST_CREATE_DIRECTORY(P) (::mkdir( P, S_IRWXU|S_IRWXG|S_IRWXO ) == 0)
-# define BOOST_CREATE_HARD_LINK(F,T) (::link( T, F ) == 0)
-# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag) (::symlink( T, F ) == 0)
-# define BOOST_REMOVE_DIRECTORY(P) (::rmdir( P ) == 0)
-# define BOOST_DELETE_FILE(P) (::unlink( P ) == 0)
-# define BOOST_COPY_DIRECTORY(F,T) (!(::stat( from.c_str(), &from_stat ) != 0\
- || ::mkdir( to.c_str(),from_stat.st_mode ) != 0))
-# define BOOST_COPY_FILE(F,T,FailIfExistsBool) copy_file_api(F, T, FailIfExistsBool)
-# define BOOST_MOVE_FILE(F,T) (::rename(F, T) == 0)
-# define BOOST_RESIZE_FILE(P,SZ) (::truncate( P, SZ ) == 0)
+# define BOOST_SET_CURRENT_DIRECTORY(P)(::chdir(P)== 0)
+# define BOOST_CREATE_DIRECTORY(P)(::mkdir(P, S_IRWXU|S_IRWXG|S_IRWXO)== 0)
+# define BOOST_CREATE_HARD_LINK(F,T)(::link(T, F)== 0)
+# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(::symlink(T, F)== 0)
+# define BOOST_REMOVE_DIRECTORY(P)(::rmdir(P)== 0)
+# define BOOST_DELETE_FILE(P)(::unlink(P)== 0)
+# define BOOST_COPY_DIRECTORY(F,T)(!(::stat(from.c_str(), &from_stat)!= 0\
+ || ::mkdir(to.c_str(),from_stat.st_mode)!= 0))
+# define BOOST_COPY_FILE(F,T,FailIfExistsBool)copy_file_api(F, T, FailIfExistsBool)
+# define BOOST_MOVE_FILE(F,T)(::rename(F, T)== 0)
+# define BOOST_RESIZE_FILE(P,SZ)(::truncate(P, SZ)== 0)
# define BOOST_ERROR_NOT_SUPPORTED ENOSYS
# define BOOST_ERROR_ALREADY_EXISTS EEXIST
@@ -145,17 +144,17 @@
# else // BOOST_WINDOWS_API
// Windows uses a non-0 return to indicate success
-# define BOOST_ERRNO ::GetLastError()
-# define BOOST_SET_CURRENT_DIRECTORY(P) (::SetCurrentDirectoryW(P) != 0)
-# define BOOST_CREATE_DIRECTORY(P) (::CreateDirectoryW( P, 0 ) != 0)
-# define BOOST_CREATE_HARD_LINK(F,T) (create_hard_link_api( F, T, 0 ) != 0)
-# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag) (create_symbolic_link_api( F, T, Flag ) != 0)
-# define BOOST_REMOVE_DIRECTORY(P) (::RemoveDirectoryW(P) != 0)
-# define BOOST_DELETE_FILE(P) (::DeleteFileW(P) != 0)
-# define BOOST_COPY_DIRECTORY(F,T) (::CreateDirectoryExW( F, T, 0 ) != 0)
-# define BOOST_COPY_FILE(F,T,FailIfExistsBool) (::CopyFileW(F, T, FailIfExistsBool) != 0)
-# define BOOST_MOVE_FILE(F,T) (::MoveFileW( F, T ) != 0)
-# define BOOST_RESIZE_FILE(P,SZ) (resize_file_api( P, SZ ) != 0)
+# define BOOST_ERRNO ::GetLastError()
+# define BOOST_SET_CURRENT_DIRECTORY(P)(::SetCurrentDirectoryW(P)!= 0)
+# define BOOST_CREATE_DIRECTORY(P)(::CreateDirectoryW(P, 0)!= 0)
+# define BOOST_CREATE_HARD_LINK(F,T)(create_hard_link_api(F, T, 0)!= 0)
+# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(create_symbolic_link_api(F, T, Flag)!= 0)
+# define BOOST_REMOVE_DIRECTORY(P)(::RemoveDirectoryW(P)!= 0)
+# define BOOST_DELETE_FILE(P)(::DeleteFileW(P)!= 0)
+# define BOOST_COPY_DIRECTORY(F,T)(::CreateDirectoryExW(F, T, 0)!= 0)
+# define BOOST_COPY_FILE(F,T,FailIfExistsBool)(::CopyFileW(F, T, FailIfExistsBool)!= 0)
+# define BOOST_MOVE_FILE(F,T)(::MoveFileW(F, T)!= 0)
+# define BOOST_RESIZE_FILE(P,SZ)(resize_file_api(P, SZ)!= 0)
# define BOOST_READ_SYMLINK(P,T)
# define BOOST_ERROR_ALREADY_EXISTS ERROR_ALREADY_EXISTS
@@ -165,7 +164,7 @@
//--------------------------------------------------------------------------------------//
// //
-// helpers (all operating systems) //
+// helpers (all operating systems) //
// //
//--------------------------------------------------------------------------------------//
@@ -178,151 +177,151 @@
const char dot = '.';
# endif
- const std::size_t buf_size( 128 );
+ const std::size_t buf_size(128);
const error_code ok;
- bool error( bool was_error, error_code & ec, const string & message )
+ bool error(bool was_error, error_code* ec, const string& message)
{
- if ( !was_error )
+ if (!was_error)
{
- if ( &ec != &throws() ) ec.clear();
+ if (ec != 0) ec->clear();
}
else
{ // error
- if ( &ec == &throws() )
- throw_exception( filesystem_error( message,
- BOOST_ERRNO, system_category ) );
+ if (ec == 0)
+ throw_exception(filesystem_error(message,
+ error_code(BOOST_ERRNO, system_category)));
else
- ec.assign( BOOST_ERRNO, system_category );
+ ec->assign(BOOST_ERRNO, system_category);
}
return was_error;
}
- bool error( bool was_error, const path & p, error_code & ec, const string & message )
+ bool error(bool was_error, const path& p, error_code* ec, const string& message)
{
- if ( !was_error )
+ if (!was_error)
{
- if ( &ec != &throws() ) ec.clear();
+ if (ec != 0) ec->clear();
}
else
{ // error
- if ( &ec == &throws() )
- throw_exception( filesystem_error( message,
- p, BOOST_ERRNO, system_category ) );
+ if (ec == 0)
+ throw_exception(filesystem_error(message,
+ p, error_code(BOOST_ERRNO, system_category)));
else
- ec.assign( BOOST_ERRNO, system_category );
+ ec->assign(BOOST_ERRNO, system_category);
}
return was_error;
}
- bool error( bool was_error, const path & p1, const path & p2, error_code & ec,
- const string & message )
+ bool error(bool was_error, const path& p1, const path& p2, error_code* ec,
+ const string& message)
{
- if ( !was_error )
+ if (!was_error)
{
- if ( &ec != &throws() ) ec.clear();
+ if (ec != 0) ec->clear();
}
else
{ // error
- if ( &ec == &throws() )
- throw_exception( filesystem_error( message,
- p1, p2, BOOST_ERRNO, system_category ) );
+ if (ec == 0)
+ throw_exception(filesystem_error(message,
+ p1, p2, error_code(BOOST_ERRNO, system_category)));
else
- ec.assign( BOOST_ERRNO, system_category );
+ ec->assign(BOOST_ERRNO, system_category);
}
return was_error;
}
- bool error( bool was_error, const error_code & result,
- const path & p, error_code & ec, const string & message )
+ bool error(bool was_error, const error_code& result,
+ const path& p, error_code* ec, const string& message)
// Overwrites ec if there has already been an error
{
- if ( !was_error )
+ if (!was_error)
{
- if ( &ec != &throws() ) ec.clear();
+ if (ec != 0) ec->clear();
}
else
{ // error
- if ( &ec == &throws() )
- throw_exception( filesystem_error( message, p, result ) );
+ if (ec == 0)
+ throw_exception(filesystem_error(message, p, result));
else
- ec = result;
+ *ec = result;
}
return was_error;
}
- bool error( bool was_error, const error_code & result,
- const path & p1, const path & p2, error_code & ec, const string & message )
+ bool error(bool was_error, const error_code& result,
+ const path& p1, const path& p2, error_code* ec, const string& message)
// Overwrites ec if there has already been an error
{
- if ( !was_error )
+ if (!was_error)
{
- if ( &ec != &throws() ) ec.clear();
+ if (ec != 0) ec->clear();
}
else
{ // error
- if ( &ec == &throws() )
- throw_exception( filesystem_error( message, p1, p2, result ) );
+ if (ec == 0)
+ throw_exception(filesystem_error(message, p1, p2, result));
else
- ec = result;
+ *ec = result;
}
return was_error;
}
- bool is_empty_directory( const path & p )
+ bool is_empty_directory(const path& p)
{
static const fs::directory_iterator end_itr;
- return fs::directory_iterator( p ) == end_itr;
+ return fs::directory_iterator(p)== end_itr;
}
- bool remove_directory( const path & p ) // true if succeeds
- { return BOOST_REMOVE_DIRECTORY( p.c_str() ); }
+ bool remove_directory(const path& p) // true if succeeds
+ { return BOOST_REMOVE_DIRECTORY(p.c_str()); }
- bool remove_file( const path & p ) // true if succeeds
- { return BOOST_DELETE_FILE( p.c_str() ); }
+ bool remove_file(const path& p) // true if succeeds
+ { return BOOST_DELETE_FILE(p.c_str()); }
// called by remove and remove_all_aux
- bool remove_file_or_directory( const path & p, fs::file_status sym_stat, error_code & ec )
+ bool remove_file_or_directory(const path& p, fs::file_status sym_stat, error_code* ec)
// return true if file removed, false if not removed
{
- if ( sym_stat.type() == fs::file_not_found )
+ if (sym_stat.type()== fs::file_not_found)
{
- if ( &ec != &throws() ) ec.clear();
+ if (ec != 0) ec->clear();
return false;
}
- if ( fs::is_directory( sym_stat ) )
+ if (fs::is_directory(sym_stat))
{
- if ( error( !remove_directory( p ), p, ec, "boost::filesystem::remove" ) )
+ if (error(!remove_directory(p), p, ec, "boost::filesystem::remove"))
return false;
}
else
{
- if ( error( !remove_file( p ), p, ec, "boost::filesystem::remove" ) )
+ if (error(!remove_file(p), p, ec, "boost::filesystem::remove"))
return false;
}
return true;
}
- boost::uintmax_t remove_all_aux( const path & p, fs::file_status sym_stat,
- error_code & ec )
+ boost::uintmax_t remove_all_aux(const path& p, fs::file_status sym_stat,
+ error_code* ec)
{
static const fs::directory_iterator end_itr;
boost::uintmax_t count = 1;
- if ( !fs::is_symlink( sym_stat ) // don't recurse symbolic links
- && fs::is_directory( sym_stat ) )
+ if (!fs::is_symlink(sym_stat)// don't recurse symbolic links
+ && fs::is_directory(sym_stat))
{
- for ( fs::directory_iterator itr( p );
- itr != end_itr; ++itr )
+ for (fs::directory_iterator itr(p);
+ itr != end_itr; ++itr)
{
- fs::file_status tmp_sym_stat = fs::symlink_status( itr->path(), ec );
- if ( &ec != &throws() && ec )
+ fs::file_status tmp_sym_stat = fs::symlink_status(itr->path(), *ec);
+ if (ec != 0 && ec)
return count;
- count += remove_all_aux( itr->path(), tmp_sym_stat, ec );
+ count += remove_all_aux(itr->path(), tmp_sym_stat, ec);
}
}
- remove_file_or_directory( p, sym_stat, ec );
+ remove_file_or_directory(p, sym_stat, ec);
return count;
}
@@ -335,75 +334,75 @@
#if defined(BOOST_WINDOWS_API)
// these constants come from inspecting some Microsoft sample code
- std::time_t to_time_t( const FILETIME & ft )
+ std::time_t to_time_t(const FILETIME & ft)
{
- __int64 t = (static_cast<__int64>( ft.dwHighDateTime ) << 32)
+ __int64 t = (static_cast<__int64>(ft.dwHighDateTime)<< 32)
+ ft.dwLowDateTime;
-# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0
+# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // > VC++ 7.0
t -= 116444736000000000LL;
# else
t -= 116444736000000000;
# endif
t /= 10000000;
- return static_cast<std::time_t>( t );
+ return static_cast<std::time_t>(t);
}
- void to_FILETIME( std::time_t t, FILETIME & ft )
+ void to_FILETIME(std::time_t t, FILETIME & ft)
{
__int64 temp = t;
temp *= 10000000;
-# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0
+# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // > VC++ 7.0
temp += 116444736000000000LL;
# else
temp += 116444736000000000;
# endif
- ft.dwLowDateTime = static_cast<DWORD>( temp );
- ft.dwHighDateTime = static_cast<DWORD>( temp >> 32 );
+ ft.dwLowDateTime = static_cast<DWORD>(temp);
+ ft.dwHighDateTime = static_cast<DWORD>(temp >> 32);
}
// Thanks to Jeremy Maitin-Shepard for much help and for permission to
- // base the equivalent() implementation on portions of his
+ // base the equivalent()implementation on portions of his
// file-equivalence-win32.cpp experimental code.
struct handle_wrapper
{
HANDLE handle;
- handle_wrapper( HANDLE h )
- : handle(h) {}
+ handle_wrapper(HANDLE h)
+ : handle(h){}
~handle_wrapper()
{
- if ( handle != INVALID_HANDLE_VALUE )
+ if (handle != INVALID_HANDLE_VALUE)
::CloseHandle(handle);
}
};
- HANDLE create_file_handle( path p, DWORD dwDesiredAccess,
+ HANDLE create_file_handle(path p, DWORD dwDesiredAccess,
DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
- HANDLE hTemplateFile )
+ HANDLE hTemplateFile)
{
- return ::CreateFileW( p.c_str(), dwDesiredAccess, dwShareMode,
+ return ::CreateFileW(p.c_str(), dwDesiredAccess, dwShareMode,
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
- hTemplateFile );
+ hTemplateFile);
}
inline std::size_t get_full_path_name(
- const path & src, std::size_t len, wchar_t * buf, wchar_t ** p )
+ const path& src, std::size_t len, wchar_t * buf, wchar_t ** p)
{
return static_cast<std::size_t>(
- ::GetFullPathNameW( src.c_str(), static_cast<DWORD>(len), buf, p ));
+ ::GetFullPathNameW(src.c_str(), static_cast<DWORD>(len), buf, p));
}
- BOOL resize_file_api( const wchar_t * p, boost::uintmax_t size )
+ BOOL resize_file_api(const wchar_t * p, boost::uintmax_t size)
{
- HANDLE handle = CreateFileW( p, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, 0 );
+ HANDLE handle = CreateFileW(p, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL, 0);
LARGE_INTEGER sz;
sz.QuadPart = size;
return handle != INVALID_HANDLE_VALUE
- && ::SetFilePointerEx( handle, sz, 0, FILE_BEGIN )
- && ::SetEndOfFile( handle )
- && ::CloseHandle( handle );
+ && ::SetFilePointerEx(handle, sz, 0, FILE_BEGIN)
+ && ::SetEndOfFile(handle)
+ && ::CloseHandle(handle);
}
// Windows kernel32.dll functions that may or may not be present
@@ -413,21 +412,21 @@
/*__in*/ LPCWSTR lpFileName,
/*__in*/ LPCWSTR lpExistingFileName,
/*__reserved*/ LPSECURITY_ATTRIBUTES lpSecurityAttributes
- );
+ );
PtrCreateHardLinkW create_hard_link_api = PtrCreateHardLinkW(
::GetProcAddress(
- ::GetModuleHandle(TEXT("kernel32.dll")), "CreateHardLinkW") );
+ ::GetModuleHandle(TEXT("kernel32.dll")), "CreateHardLinkW"));
typedef BOOLEAN (WINAPI *PtrCreateSymbolicLinkW)(
/*__in*/ LPCWSTR lpSymlinkFileName,
/*__in*/ LPCWSTR lpTargetFileName,
/*__in*/ DWORD dwFlags
- );
+ );
PtrCreateSymbolicLinkW create_symbolic_link_api = PtrCreateSymbolicLinkW(
::GetProcAddress(
- ::GetModuleHandle(TEXT("kernel32.dll")), "CreateSymbolicLinkW") );
+ ::GetModuleHandle(TEXT("kernel32.dll")), "CreateSymbolicLinkW"));
@@ -440,55 +439,55 @@
# else
bool // true if ok
- copy_file_api( const std::string & from_p,
- const std::string & to_p, bool fail_if_exists )
+ copy_file_api(const std::string& from_p,
+ const std::string& to_p, bool fail_if_exists)
{
const std::size_t buf_sz = 32768;
- boost::scoped_array<char> buf( new char [buf_sz] );
+ boost::scoped_array<char> buf(new char [buf_sz]);
int infile=-1, outfile=-1; // -1 means not open
- // bug fixed: code previously did a stat() on the from_file first, but that
- // introduced a gratuitous race condition; the stat() is now done after the open()
+ // bug fixed: code previously did a stat()on the from_file first, but that
+ // introduced a gratuitous race condition; the stat()is now done after the open()
- if ( (infile = ::open( from_p.c_str(), O_RDONLY )) < 0 )
+ if ((infile = ::open(from_p.c_str(), O_RDONLY))< 0)
{ return false; }
struct stat from_stat;
- if ( ::stat( from_p.c_str(), &from_stat ) != 0 )
+ if (::stat(from_p.c_str(), &from_stat)!= 0)
{ return false; }
int oflag = O_CREAT | O_WRONLY;
- if ( fail_if_exists ) oflag |= O_EXCL;
- if ( (outfile = ::open( to_p.c_str(), oflag, from_stat.st_mode )) < 0 )
+ if (fail_if_exists)oflag |= O_EXCL;
+ if ( (outfile = ::open(to_p.c_str(), oflag, from_stat.st_mode))< 0)
{
int open_errno = errno;
- BOOST_ASSERT( infile >= 0 );
- ::close( infile );
+ BOOST_ASSERT(infile >= 0);
+ ::close(infile);
errno = open_errno;
return false;
}
ssize_t sz, sz_read=1, sz_write;
- while ( sz_read > 0
- && (sz_read = ::read( infile, buf.get(), buf_sz )) > 0 )
+ while (sz_read > 0
+ && (sz_read = ::read(infile, buf.get(), buf_sz))> 0)
{
// Allow for partial writes - see Advanced Unix Programming (2nd Ed.),
// Marc Rochkind, Addison-Wesley, 2004, page 94
sz_write = 0;
do
{
- if ( (sz = ::write( outfile, buf.get() + sz_write,
- sz_read - sz_write )) < 0 )
+ if ((sz = ::write(outfile, buf.get() + sz_write,
+ sz_read - sz_write))< 0)
{
sz_read = sz; // cause read loop termination
break; // and error to be thrown after closes
}
sz_write += sz;
- } while ( sz_write < sz_read );
+ } while (sz_write < sz_read);
}
- if ( ::close( infile) < 0 ) sz_read = -1;
- if ( ::close( outfile) < 0 ) sz_read = -1;
+ if (::close(infile)< 0)sz_read = -1;
+ if (::close(outfile)< 0)sz_read = -1;
return sz_read >= 0;
}
@@ -498,26 +497,26 @@
//#ifdef BOOST_WINDOWS_API
//
//
-// inline bool get_free_disk_space( const std::wstring & ph,
-// PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free )
-// { return ::GetDiskFreeSpaceExW( ph.c_str(), avail, total, free ) != 0; }
+// inline bool get_free_disk_space(const std::wstring& ph,
+// PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free)
+// { return ::GetDiskFreeSpaceExW(ph.c_str(), avail, total, free)!= 0; }
//
//
//#else // BOOST_POSIX_API
//
-// int posix_remove( const char * p )
+// int posix_remove(const char * p)
// {
//# if defined(__QNXNTO__) || (defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)))
// // Some Metrowerks C library versions fail on directories because of a
// // known Metrowerks coding error in ::remove. Workaround is to call
-// // rmdir() or unlink() as indicated.
+// // rmdir()or unlink()as indicated.
// // Same bug also reported for QNX, with the same fix.
-// int err = ::unlink( p );
-// if ( err != EPERM )
+// int err = ::unlink(p);
+// if (err != EPERM)
// return err;
-// return ::rmdir( p )
+// return ::rmdir(p)
//# else
-// return std::remove( p );
+// return std::remove(p);
//# endif
// }
//
@@ -534,257 +533,259 @@
namespace boost
{
- namespace filesystem
+namespace filesystem
+{
+namespace detail
+{
+ BOOST_FILESYSTEM_DECL bool possible_large_file_size_support()
{
- namespace detail
- {
- BOOST_FILESYSTEM_DECL bool possible_large_file_size_support()
- {
-# ifdef BOOST_POSIX_API
- struct stat lcl_stat;
- return sizeof( lcl_stat.st_size ) > 4;
-# else
- return true;
-# endif
- }
- } // namespace detail
-
+# ifdef BOOST_POSIX_API
+ struct stat lcl_stat;
+ return sizeof(lcl_stat.st_size)> 4;
+# else
+ return true;
+# endif
+ }
BOOST_FILESYSTEM_DECL
- path complete( const path & p, const path & base )
+ path complete(const path& p, const path& base)
{
- if ( p.empty() || base.empty() )
+ if (p.empty() || base.empty())
return p;
- if ( p.has_root_name() )
+ if (p.has_root_name())
{
return p.has_root_directory()
? p
- : p.root_name() / base.root_directory() / base.relative_path() / p.relative_path();
+ : p.root_name()/ base.root_directory()/ base.relative_path()/ p.relative_path();
}
return p.has_root_directory()
- ? base.root_name() / p
+ ? base.root_name()/ p
: base / p;
}
BOOST_FILESYSTEM_DECL
- void copy( const path & from, const path & to, system::error_code & ec )
+ void copy(const path& from, const path& to, system::error_code* ec)
{
- file_status s( symlink_status( from, ec ) );
- if ( &ec != &throws() && ec ) return;
+ file_status s(symlink_status(from, *ec));
+ if (ec != 0 && ec)return;
- if( is_symlink( s ) )
+ if(is_symlink(s))
{
- copy_symlink( from, to, ec );
+ copy_symlink(from, to, *ec);
}
- else if( is_directory( s ) )
+ else if(is_directory(s))
{
- copy_directory( from, to, ec );
+ copy_directory(from, to, *ec);
}
- else if( is_regular_file( s ) )
+ else if(is_regular_file(s))
{
- copy_file( from, to, copy_option::fail_if_exists, ec );
+ copy_file(from, to, copy_option::fail_if_exists, *ec);
}
else
{
- if ( &ec == &throws() )
- throw_exception( filesystem_error( "boost::filesystem::copy",
- from, to, BOOST_ERROR_NOT_SUPPORTED, system_category ) );
- ec.assign( BOOST_ERROR_NOT_SUPPORTED, system_category );
+ if (ec == 0)
+ throw_exception(filesystem_error("boost::filesystem::copy",
+ from, to, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category)));
+ ec->assign(BOOST_ERROR_NOT_SUPPORTED, system_category);
}
}
BOOST_FILESYSTEM_DECL
- void copy_directory( const path & from, const path & to, system::error_code & ec)
+ void copy_directory(const path& from, const path& to, system::error_code* ec)
{
# ifdef BOOST_POSIX_API
struct stat from_stat;
# endif
- error( !BOOST_COPY_DIRECTORY( from.c_str(), to.c_str() ),
- from, to, ec, "boost::filesystem::copy_directory" );
+ error(!BOOST_COPY_DIRECTORY(from.c_str(), to.c_str()),
+ from, to, ec, "boost::filesystem::copy_directory");
}
BOOST_FILESYSTEM_DECL
- void copy_file( const path & from, const path & to,
- BOOST_SCOPED_ENUM(copy_option) option,
- error_code & ec )
+ void copy_file(const path& from, const path& to,
+ BOOST_SCOPED_ENUM(copy_option)option,
+ error_code* ec)
{
- error( !BOOST_COPY_FILE( from.c_str(), to.c_str(),
- option == copy_option::fail_if_exists ),
- from, to, ec, "boost::filesystem::copy_file" );
+ error(!BOOST_COPY_FILE(from.c_str(), to.c_str(),
+ option == copy_option::fail_if_exists),
+ from, to, ec, "boost::filesystem::copy_file");
}
BOOST_FILESYSTEM_DECL
- void copy_symlink( const path & from, const path & to, system::error_code & ec )
+ void copy_symlink(const path& from, const path& to, system::error_code* ec)
{
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008
- error( true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
- "boost::filesystem::copy_symlink" );
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
+ "boost::filesystem::copy_symlink");
# elif defined(BOOST_WINDOWS_API)
// see if actually supported by Windows runtime dll
- if ( error( !create_symbolic_link_api,
+ if (error(!create_symbolic_link_api,
error_code(BOOST_ERROR_NOT_SUPPORTED, system_category),
to, from, ec,
- "boost::filesystem::copy_symlink" ) )
+ "boost::filesystem::copy_symlink"))
return;
// preconditions met, so attempt the copy
- error( !::CopyFileExW( from.c_str(), to.c_str(), 0, 0, 0,
- COPY_FILE_COPY_SYMLINK | COPY_FILE_FAIL_IF_EXISTS ), to, from, ec,
- "boost::filesystem::copy_symlink" );
+ error(!::CopyFileExW(from.c_str(), to.c_str(), 0, 0, 0,
+ COPY_FILE_COPY_SYMLINK | COPY_FILE_FAIL_IF_EXISTS), to, from, ec,
+ "boost::filesystem::copy_symlink");
# else // BOOST_POSIX_API
- path p( read_symlink( from, ec ) );
- if ( &ec != &throws() && ec ) return;
- create_symlink( p, to, ec );
+ path p(read_symlink(from, ec));
+ if (ec != 0 && ec) return;
+ create_symlink(p, to, ec);
# endif
}
BOOST_FILESYSTEM_DECL
- bool create_directories( const path & p/*, system::error_code & ec*/ )
+ bool create_directories(const path& p, system::error_code* ec)
{
- if ( p.empty() || exists(p))
+ if (p.empty() || exists(p))
{
- if ( !p.empty() && !is_directory(p) )
- boost::throw_exception( filesystem_error(
+ if (!p.empty() && !is_directory(p))
+ {
+ if (ec == 0)
+ boost::throw_exception(filesystem_error(
"boost::filesystem::create_directories", p,
- error_code( system::errc::file_exists, system::generic_category ) ) );
+ error_code(system::errc::file_exists, system::generic_category)));
+ else ec->assign(system::errc::file_exists, system::generic_category);
+ }
return false;
}
// First create branch, by calling ourself recursively
- create_directories( p.parent_path() );
+ create_directories(p.parent_path(), ec);
// Now that parent's path exists, create the directory
- create_directory( p );
+ create_directory(p, ec);
return true;
}
BOOST_FILESYSTEM_DECL
- bool create_directory( const path & p, error_code & ec )
+ bool create_directory(const path& p, error_code* ec)
{
- if ( BOOST_CREATE_DIRECTORY( p.c_str() ) )
+ if (BOOST_CREATE_DIRECTORY(p.c_str()))
{
- if ( &ec != &boost::throws() ) ec.clear();
+ if (ec != 0) ec->clear();
return true;
}
// attempt to create directory failed
- int errval( BOOST_ERRNO ); // save reason for failure
+ int errval(BOOST_ERRNO); // save reason for failure
error_code dummy;
- if ( errval == BOOST_ERROR_ALREADY_EXISTS && is_directory( p, dummy ) )
+ if (errval == BOOST_ERROR_ALREADY_EXISTS && is_directory(p, dummy))
{
- if ( &ec != &boost::throws() ) ec.clear();
+ if (ec != 0) ec->clear();
return false;
}
// attempt to create directory failed && it doesn't already exist
- if ( &ec == &boost::throws() )
- throw_exception( filesystem_error( "boost::filesystem::create_directory",
- p, errval, system_category ) );
+ if (ec == 0)
+ throw_exception(filesystem_error("boost::filesystem::create_directory",
+ p, error_code(errval, system_category)));
else
- ec.assign( errval, system_category );
+ ec->assign(errval, system_category);
return false;
}
BOOST_FILESYSTEM_DECL
- void create_directory_symlink( const path & to, const path & from,
- system::error_code & ec )
+ void create_directory_symlink(const path& to, const path& from,
+ system::error_code* ec)
{
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008
- error( true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
- "boost::filesystem::create_directory_symlink" );
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
+ "boost::filesystem::create_directory_symlink");
# else
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600
// see if actually supported by Windows runtime dll
- if ( error( !create_symbolic_link_api,
+ if (error(!create_symbolic_link_api,
error_code(BOOST_ERROR_NOT_SUPPORTED, system_category),
to, from, ec,
- "boost::filesystem::create_directory_symlink" ) )
+ "boost::filesystem::create_directory_symlink"))
return;
# endif
- error( !BOOST_CREATE_SYMBOLIC_LINK( from.c_str(), to.c_str(), SYMBOLIC_LINK_FLAG_DIRECTORY ),
- to, from, ec, "boost::filesystem::create_directory_symlink" );
+ error(!BOOST_CREATE_SYMBOLIC_LINK(from.c_str(), to.c_str(), SYMBOLIC_LINK_FLAG_DIRECTORY),
+ to, from, ec, "boost::filesystem::create_directory_symlink");
# endif
}
BOOST_FILESYSTEM_DECL
- void create_hard_link( const path & to, const path & from, error_code & ec )
+ void create_hard_link(const path& to, const path& from, error_code* ec)
{
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0500 // SDK earlier than Win 2K
- error( true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
- "boost::filesystem::create_hard_link" );
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
+ "boost::filesystem::create_hard_link");
# else
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0500
// see if actually supported by Windows runtime dll
- if ( error( !create_hard_link_api,
+ if (error(!create_hard_link_api,
error_code(BOOST_ERROR_NOT_SUPPORTED, system_category),
to, from, ec,
- "boost::filesystem::create_hard_link" ) )
+ "boost::filesystem::create_hard_link"))
return;
# endif
- error( !BOOST_CREATE_HARD_LINK( from.c_str(), to.c_str() ), to, from, ec,
- "boost::filesystem::create_hard_link" );
+ error(!BOOST_CREATE_HARD_LINK(from.c_str(), to.c_str()), to, from, ec,
+ "boost::filesystem::create_hard_link");
# endif
}
BOOST_FILESYSTEM_DECL
- void create_symlink( const path & to, const path & from, error_code & ec )
+ void create_symlink(const path& to, const path& from, error_code* ec)
{
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008
- error( true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
- "boost::filesystem::create_directory_symlink" );
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category), to, from, ec,
+ "boost::filesystem::create_directory_symlink");
# else
# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600
// see if actually supported by Windows runtime dll
- if ( error( !create_symbolic_link_api,
+ if (error(!create_symbolic_link_api,
error_code(BOOST_ERROR_NOT_SUPPORTED, system_category),
to, from, ec,
- "boost::filesystem::create_directory_symlink" ) )
+ "boost::filesystem::create_directory_symlink"))
return;
# endif
- error( !BOOST_CREATE_SYMBOLIC_LINK( from.c_str(), to.c_str(), 0 ),
- to, from, ec, "boost::filesystem::create_directory_symlink" );
+ error(!BOOST_CREATE_SYMBOLIC_LINK(from.c_str(), to.c_str(), 0),
+ to, from, ec, "boost::filesystem::create_directory_symlink");
# endif
}
BOOST_FILESYSTEM_DECL
- path current_path( error_code & ec )
+ path current_path(error_code* ec)
{
# ifdef BOOST_WINDOWS_API
DWORD sz;
- if ( (sz = ::GetCurrentDirectoryW( 0, NULL )) == 0 ) sz = 1;
- boost::scoped_array<path::value_type> buf( new path::value_type[sz] );
- error( ::GetCurrentDirectoryW( sz, buf.get() ) == 0, ec,
- "boost::filesystem::current_path" );
- return path( buf.get() );
+ if ((sz = ::GetCurrentDirectoryW(0, NULL))== 0)sz = 1;
+ boost::scoped_array<path::value_type> buf(new path::value_type[sz]);
+ error(::GetCurrentDirectoryW(sz, buf.get())== 0, ec,
+ "boost::filesystem::current_path");
+ return path(buf.get());
# else
path cur;
- for ( long path_max = 128;; path_max *=2 ) // loop 'til buffer large enough
+ for (long path_max = 128;; path_max *=2)// loop 'til buffer large enough
{
boost::scoped_array<char>
- buf( new char[static_cast<std::size_t>(path_max)] );
- if ( ::getcwd( buf.get(), static_cast<std::size_t>(path_max) ) == 0 )
+ buf(new char[static_cast<std::size_t>(path_max)]);
+ if (::getcwd(buf.get(), static_cast<std::size_t>(path_max))== 0)
{
- if ( error(errno != ERANGE
+ if (error(errno != ERANGE
// bug in some versions of the Metrowerks C lib on the Mac: wrong errno set
# if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
&& errno != 0
# endif
- , ec, "boost::filesystem::current_path") )
+ , ec, "boost::filesystem::current_path"))
{
break;
}
@@ -792,7 +793,7 @@
else
{
cur = buf.get();
- if ( &ec != &throws() ) ec.clear();
+ if (ec != 0) ec->clear();
break;
}
}
@@ -802,14 +803,14 @@
BOOST_FILESYSTEM_DECL
- void current_path( const path & p, system::error_code & ec )
+ void current_path(const path& p, system::error_code* ec)
{
- error( !BOOST_SET_CURRENT_DIRECTORY( p.c_str() ),
- p, ec, "boost::filesystem::current_path" );
+ error(!BOOST_SET_CURRENT_DIRECTORY(p.c_str()),
+ p, ec, "boost::filesystem::current_path");
}
BOOST_FILESYSTEM_DECL
- bool equivalent( const path & p1, const path & p2, system::error_code & ec )
+ bool equivalent(const path& p1, const path& p2, system::error_code* ec)
{
# ifdef BOOST_WINDOWS_API
// Note well: Physical location on external media is part of the
@@ -827,7 +828,7 @@
0,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
- 0 ) );
+ 0));
handle_wrapper h1(
create_file_handle(
@@ -837,16 +838,16 @@
0,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
- 0 ) );
+ 0));
- if ( h1.handle == INVALID_HANDLE_VALUE
- || h2.handle == INVALID_HANDLE_VALUE )
+ if (h1.handle == INVALID_HANDLE_VALUE
+ || h2.handle == INVALID_HANDLE_VALUE)
{
// if one is invalid and the other isn't, then they aren't equivalent,
// but if both are invalid then it is an error
- error( h1.handle == INVALID_HANDLE_VALUE
+ error(h1.handle == INVALID_HANDLE_VALUE
&& h2.handle == INVALID_HANDLE_VALUE, p1, p2, ec,
- "boost::filesystem::equivalent" );
+ "boost::filesystem::equivalent");
return false;
}
@@ -854,12 +855,12 @@
BY_HANDLE_FILE_INFORMATION info1, info2;
- if ( error( !::GetFileInformationByHandle( h1.handle, &info1 ),
- p1, p2, ec, "boost::filesystem::equivalent" ) )
+ if (error(!::GetFileInformationByHandle(h1.handle, &info1),
+ p1, p2, ec, "boost::filesystem::equivalent"))
return false;
- if ( error( !::GetFileInformationByHandle( h2.handle, &info2 ),
- p1, p2, ec, "boost::filesystem::equivalent" ) )
+ if (error(!::GetFileInformationByHandle(h2.handle, &info2),
+ p1, p2, ec, "boost::filesystem::equivalent"))
return false;
// In theory, volume serial numbers are sufficient to distinguish between
@@ -878,15 +879,15 @@
# else
struct stat s2;
- int e2( ::stat( p2.c_str(), &s2 ) );
+ int e2(::stat(p2.c_str(), &s2));
struct stat s1;
- int e1( ::stat( p1.c_str(), &s1 ) );
+ int e1(::stat(p1.c_str(), &s1));
- if ( e1 != 0 || e2 != 0 )
+ if (e1 != 0 || e2 != 0)
{
// if one is invalid and the other isn't then they aren't equivalent,
// but if both are invalid then it is an error
- error (e1 != 0 && e2 != 0, p1, p2, ec, "boost::filesystem::equivalent" );
+ error (e1 != 0 && e2 != 0, p1, p2, ec, "boost::filesystem::equivalent");
return false;
}
@@ -900,7 +901,7 @@
}
BOOST_FILESYSTEM_DECL
- boost::uintmax_t file_size( const path & p, error_code & ec )
+ boost::uintmax_t file_size(const path& p, error_code* ec)
{
# ifdef BOOST_WINDOWS_API
@@ -908,13 +909,13 @@
WIN32_FILE_ATTRIBUTE_DATA fad;
- if ( error(::GetFileAttributesExW( p.c_str(), ::GetFileExInfoStandard, &fad ) == 0,
- p, ec, "boost::filesystem::file_size" ) )
+ if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0,
+ p, ec, "boost::filesystem::file_size"))
return 0;
- if ( error((fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0,
- error_code( ERROR_FILE_NOT_FOUND, system_category),
- p, ec, "boost::filesystem::file_size" ) )
+ if (error((fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)!= 0,
+ error_code(ERROR_FILE_NOT_FOUND, system_category),
+ p, ec, "boost::filesystem::file_size"))
return 0;
return (static_cast<boost::uintmax_t>(fad.nFileSizeHigh)
@@ -922,12 +923,12 @@
# else
struct stat path_stat;
- if ( error( ::stat( p.c_str(), &path_stat ) != 0,
- p, ec, "boost::filesystem::file_size" ) )
+ if (error(::stat(p.c_str(), &path_stat)!= 0,
+ p, ec, "boost::filesystem::file_size"))
return 0;
- if ( error(!S_ISREG( path_stat.st_mode ),
- error_code( EPERM, system_category),
- p, ec, "boost::filesystem::file_size" ) )
+ if (error(!S_ISREG(path_stat.st_mode),
+ error_code(EPERM, system_category),
+ p, ec, "boost::filesystem::file_size"))
return 0;
return static_cast<boost::uintmax_t>(path_stat.st_size);
@@ -935,168 +936,168 @@
}
BOOST_FILESYSTEM_DECL
- boost::uintmax_t hard_link_count( const path & p, system::error_code & ec )
+ boost::uintmax_t hard_link_count(const path& p, system::error_code* ec)
{
# ifdef BOOST_WINDOWS_API
// Link count info is only available through GetFileInformationByHandle
BY_HANDLE_FILE_INFORMATION info;
handle_wrapper h(
- create_file_handle( p.c_str(), 0,
+ create_file_handle(p.c_str(), 0,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
- OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) );
+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0));
return
- !error( h.handle == INVALID_HANDLE_VALUE,
- p, ec, "boost::filesystem::hard_link_count" )
- && !error( ::GetFileInformationByHandle( h.handle, &info ) == 0,
- p, ec, "boost::filesystem::hard_link_count" )
+ !error(h.handle == INVALID_HANDLE_VALUE,
+ p, ec, "boost::filesystem::hard_link_count")
+ && !error(::GetFileInformationByHandle(h.handle, &info)== 0,
+ p, ec, "boost::filesystem::hard_link_count")
? info.nNumberOfLinks
: 0;
# else
struct stat path_stat;
- return error( ::stat( p.c_str(), &path_stat ) != 0,
- p, ec, "boost::filesystem::hard_link_count" )
+ return error(::stat(p.c_str(), &path_stat)!= 0,
+ p, ec, "boost::filesystem::hard_link_count")
? 0
- : static_cast<boost::uintmax_t>( path_stat.st_nlink );
+ : static_cast<boost::uintmax_t>(path_stat.st_nlink);
# endif
}
BOOST_FILESYSTEM_DECL
- path initial_path( error_code & ec )
+ path initial_path(error_code* ec)
{
static path init_path;
- if ( init_path.empty() )
- init_path = current_path( ec );
- else if ( &ec != &throws() ) ec.clear();
+ if (init_path.empty())
+ init_path = current_path(ec);
+ else if (ec != 0) ec->clear();
return init_path;
}
BOOST_FILESYSTEM_DECL
- bool is_empty( const path & p, system::error_code & ec )
+ bool is_empty(const path& p, system::error_code* ec)
{
# ifdef BOOST_WINDOWS_API
WIN32_FILE_ATTRIBUTE_DATA fad;
- if ( error(::GetFileAttributesExW( p.c_str(), ::GetFileExInfoStandard, &fad ) == 0,
- p, ec, "boost::filesystem::is_empty" ) )
+ if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0,
+ p, ec, "boost::filesystem::is_empty"))
return false;
- if ( &ec != &boost::throws() ) ec.clear();
+ if (ec != 0) ec->clear();
return
- ( fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
- ? is_empty_directory( p )
- : ( !fad.nFileSizeHigh && !fad.nFileSizeLow );
+ (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ ? is_empty_directory(p)
+ : (!fad.nFileSizeHigh && !fad.nFileSizeLow);
# else
struct stat path_stat;
- if ( error(::stat( p.c_str(), &path_stat ) != 0,
- p, ec, "boost::filesystem::is_empty" ) )
+ if (error(::stat(p.c_str(), &path_stat)!= 0,
+ p, ec, "boost::filesystem::is_empty"))
return false;
- return S_ISDIR( path_stat.st_mode )
- ? is_empty_directory( p )
+ return S_ISDIR(path_stat.st_mode)
+ ? is_empty_directory(p)
: path_stat.st_size == 0;
# endif
}
BOOST_FILESYSTEM_DECL
- std::time_t last_write_time( const path & p, system::error_code & ec )
+ std::time_t last_write_time(const path& p, system::error_code* ec)
{
# ifdef BOOST_WINDOWS_API
handle_wrapper hw(
- create_file_handle( p.c_str(), 0,
+ create_file_handle(p.c_str(), 0,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
- OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) );
+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0));
- if ( error( hw.handle == INVALID_HANDLE_VALUE,
- p, ec, "boost::filesystem::last_write_time" ) )
+ if (error(hw.handle == INVALID_HANDLE_VALUE,
+ p, ec, "boost::filesystem::last_write_time"))
return std::time_t(-1);
FILETIME lwt;
- if ( error( ::GetFileTime( hw.handle, 0, 0, &lwt ) == 0,
- p, ec, "boost::filesystem::last_write_time" ) )
+ if (error(::GetFileTime(hw.handle, 0, 0, &lwt)== 0,
+ p, ec, "boost::filesystem::last_write_time"))
return std::time_t(-1);
- return to_time_t( lwt );
+ return to_time_t(lwt);
# else
struct stat path_stat;
- if ( error( ::stat( p.c_str(), &path_stat ) != 0,
- p, ec, "boost::filesystem::last_write_time" ) )
+ if (error(::stat(p.c_str(), &path_stat)!= 0,
+ p, ec, "boost::filesystem::last_write_time"))
return std::time_t(-1);
return path_stat.st_mtime;
# endif
}
BOOST_FILESYSTEM_DECL
- void last_write_time( const path & p, const std::time_t new_time,
- system::error_code & ec )
+ void last_write_time(const path& p, const std::time_t new_time,
+ system::error_code* ec)
{
# ifdef BOOST_WINDOWS_API
handle_wrapper hw(
- create_file_handle( p.c_str(), FILE_WRITE_ATTRIBUTES,
+ create_file_handle(p.c_str(), FILE_WRITE_ATTRIBUTES,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
- OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) );
+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0));
- if ( error( hw.handle == INVALID_HANDLE_VALUE,
- p, ec, "boost::filesystem::last_write_time" ) )
+ if (error(hw.handle == INVALID_HANDLE_VALUE,
+ p, ec, "boost::filesystem::last_write_time"))
return;
FILETIME lwt;
- to_FILETIME( new_time, lwt );
+ to_FILETIME(new_time, lwt);
- error( ::SetFileTime( hw.handle, 0, 0, &lwt ) == 0,
- p, ec, "boost::filesystem::last_write_time" );
+ error(::SetFileTime(hw.handle, 0, 0, &lwt)== 0,
+ p, ec, "boost::filesystem::last_write_time");
# else
struct stat path_stat;
- if ( error( ::stat( p.c_str(), &path_stat ) != 0,
- p, ec, "boost::filesystem::last_write_time" ) )
+ if (error(::stat(p.c_str(), &path_stat)!= 0,
+ p, ec, "boost::filesystem::last_write_time"))
return;
::utimbuf buf;
- buf.actime = path_stat.st_atime; // utime() updates access time too:-(
+ buf.actime = path_stat.st_atime; // utime()updates access time too:-(
buf.modtime = new_time;
- error( ::utime( p.c_str(), &buf ) != 0,
- p, ec, "boost::filesystem::last_write_time" );
+ error(::utime(p.c_str(), &buf)!= 0,
+ p, ec, "boost::filesystem::last_write_time");
# endif
}
BOOST_FILESYSTEM_DECL
- path read_symlink( const path & p, system::error_code & ec )
+ path read_symlink(const path& p, system::error_code* ec)
{
# ifdef BOOST_WINDOWS_API
- if ( &ec == &throws() )
- throw_exception( filesystem_error( "boost::filesystem::read_symlink",
- p, BOOST_ERROR_NOT_SUPPORTED, system_category ) );
- else ec.assign( BOOST_ERROR_NOT_SUPPORTED, system_category );
+ if (ec == 0)
+ throw_exception(filesystem_error("boost::filesystem::read_symlink",
+ p, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category)));
+ else ec->assign(BOOST_ERROR_NOT_SUPPORTED, system_category);
return path();
# else
path symlink_path;
- for ( std::size_t path_max = 64;; path_max *= 2 ) // loop 'til buffer large enough
+ for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer large enough
{
- boost::scoped_array<char> buf( new char[path_max] );
+ boost::scoped_array<char> buf(new char[path_max]);
ssize_t result;
- if ( (result=::readlink( p.c_str(), buf.get(), path_max) ) == -1 )
+ if ((result=::readlink(p.c_str(), buf.get(), path_max))== -1)
{
- if ( &ec == &throws() )
- throw_exception( filesystem_error( "boost::filesystem::read_symlink",
- p, errno, system_category ) );
- else ec.assign( errno, system_category );
+ if (ec == 0)
+ throw_exception(filesystem_error("boost::filesystem::read_symlink",
+ p, errno, system_category));
+ else ec->assign(errno, system_category);
break;
}
else
{
- if( result != static_cast<ssize_t>(path_max))
+ if(result != static_cast<ssize_t>(path_max))
{
- symlink_path.assign( buf.get(), buf.get() + result );
- if ( &ec != &throws() ) ec.clear();
+ symlink_path.assign(buf.get(), buf.get() + result);
+ if (ec != 0) ec->clear();
break;
}
}
@@ -1107,86 +1108,86 @@
}
BOOST_FILESYSTEM_DECL
- bool remove( const path & p, error_code & ec )
+ bool remove(const path& p, error_code* ec)
{
error_code tmp_ec;
- file_status sym_status = symlink_status( p, tmp_ec );
- if ( error( !!tmp_ec, tmp_ec, p, ec, "boost::filesystem::remove" ) )
+ file_status sym_status = symlink_status(p, tmp_ec);
+ if (error(!!tmp_ec, tmp_ec, p, ec, "boost::filesystem::remove"))
return false;
- return remove_file_or_directory( p, sym_status, ec );
+ return remove_file_or_directory(p, sym_status, ec);
}
BOOST_FILESYSTEM_DECL
- boost::uintmax_t remove_all( const path & p, error_code & ec )
+ boost::uintmax_t remove_all(const path& p, error_code* ec)
{
error_code tmp_ec;
- file_status sym_status = symlink_status( p, tmp_ec );
- if ( error( !!tmp_ec, tmp_ec, p, ec, "boost::filesystem::remove_all" ) )
+ file_status sym_status = symlink_status(p, tmp_ec);
+ if (error(!!tmp_ec, tmp_ec, p, ec, "boost::filesystem::remove_all"))
return 0;
- return exists( sym_status )
- ? remove_all_aux( p, sym_status, ec )
+ return exists(sym_status)
+ ? remove_all_aux(p, sym_status, ec)
: 0;
}
BOOST_FILESYSTEM_DECL
- void rename( const path & from, const path & to, error_code & ec )
+ void rename(const path& from, const path& to, error_code* ec)
{
# ifdef BOOST_POSIX_API
// POSIX is too permissive so must check
error_code dummy;
- if ( error( fs::exists( to, dummy ),
- error_code( EEXIST, system_category ),
- from, to, ec, "boost::filesystem::rename" ) )
+ if (error(fs::exists(to, dummy),
+ error_code(EEXIST, system_category),
+ from, to, ec, "boost::filesystem::rename"))
return;
# endif
- error( !BOOST_MOVE_FILE( from.c_str(), to.c_str() ), from, to, ec,
- "boost::filesystem::rename" );
+ error(!BOOST_MOVE_FILE(from.c_str(), to.c_str()), from, to, ec,
+ "boost::filesystem::rename");
}
BOOST_FILESYSTEM_DECL
- void resize_file( const path & p, uintmax_t size, system::error_code & ec )
+ void resize_file(const path& p, uintmax_t size, system::error_code* ec)
{
- error(!BOOST_RESIZE_FILE( p.c_str(), size ), p, ec, "boost::filesystem::resize_file");
+ error(!BOOST_RESIZE_FILE(p.c_str(), size), p, ec, "boost::filesystem::resize_file");
}
BOOST_FILESYSTEM_DECL
- space_info space( const path & p, error_code & ec )
+ space_info space(const path& p, error_code* ec)
{
# ifdef BOOST_WINDOWS_API
ULARGE_INTEGER avail, total, free;
space_info info;
- if ( !error( ::GetDiskFreeSpaceExW( p.c_str(), &avail, &total, &free ) == 0,
- p, ec, "boost::filesystem::space" ) )
+ if (!error(::GetDiskFreeSpaceExW(p.c_str(), &avail, &total, &free)== 0,
+ p, ec, "boost::filesystem::space"))
{
info.capacity
- = (static_cast<boost::uintmax_t>(total.HighPart) << 32)
+ = (static_cast<boost::uintmax_t>(total.HighPart)<< 32)
+ total.LowPart;
info.free
- = (static_cast<boost::uintmax_t>(free.HighPart) << 32)
+ = (static_cast<boost::uintmax_t>(free.HighPart)<< 32)
+ free.LowPart;
info.available
- = (static_cast<boost::uintmax_t>(avail.HighPart) << 32)
+ = (static_cast<boost::uintmax_t>(avail.HighPart)<< 32)
+ avail.LowPart;
}
# else
struct BOOST_STATVFS vfs;
space_info info;
- if ( !error( ::BOOST_STATVFS( p.c_str(), &vfs ) != 0,
- p, ec, "boost::filesystem::space" ) )
+ if (!error(::BOOST_STATVFS(p.c_str(), &vfs)!= 0,
+ p, ec, "boost::filesystem::space"))
{
info.capacity
- = static_cast<boost::uintmax_t>(vfs.f_blocks) * BOOST_STATVFS_F_FRSIZE;
+ = static_cast<boost::uintmax_t>(vfs.f_blocks)* BOOST_STATVFS_F_FRSIZE;
info.free
- = static_cast<boost::uintmax_t>(vfs.f_bfree) * BOOST_STATVFS_F_FRSIZE;
+ = static_cast<boost::uintmax_t>(vfs.f_bfree)* BOOST_STATVFS_F_FRSIZE;
info.available
- = static_cast<boost::uintmax_t>(vfs.f_bavail) * BOOST_STATVFS_F_FRSIZE;
+ = static_cast<boost::uintmax_t>(vfs.f_bavail)* BOOST_STATVFS_F_FRSIZE;
}
# endif
@@ -1197,54 +1198,50 @@
return info;
}
+# ifdef BOOST_WINDOWS_API
- namespace detail
+ file_status process_status_failure(const path& p, error_code* ec)
{
-# ifdef BOOST_WINDOWS_API
-
- file_status process_status_failure( const path & p, error_code & ec )
- {
- int errval( ::GetLastError() );
- if ((errval == ERROR_FILE_NOT_FOUND)
- || (errval == ERROR_PATH_NOT_FOUND)
- || (errval == ERROR_INVALID_NAME) // "tools/jam/src/:sys:stat.h", "//foo"
- || (errval == ERROR_INVALID_PARAMETER) // ":sys:stat.h"
- || (errval == ERROR_BAD_PATHNAME) // "//nosuch" on Win64
- || (errval == ERROR_BAD_NETPATH)) // "//nosuch" on Win32
- {
-
- if ( &ec != &boost::throws() ) ec.clear(); // these are not errors
- return file_status( file_not_found );
- }
- else if ((errval == ERROR_SHARING_VIOLATION))
- {
- if ( &ec != &boost::throws() ) ec.clear(); // these are not errors
- return file_status( type_unknown );
- }
- if ( &ec == &boost::throws() )
- throw_exception( filesystem_error( "boost::filesystem::status",
- p, errval, system_category ) );
- else
- ec.assign( errval, system_category );
- return file_status( status_unknown );
- }
+ int errval(::GetLastError());
+ if ((errval == ERROR_FILE_NOT_FOUND)
+ || (errval == ERROR_PATH_NOT_FOUND)
+ || (errval == ERROR_INVALID_NAME)// "tools/jam/src/:sys:stat.h", "//foo"
+ || (errval == ERROR_INVALID_PARAMETER)// ":sys:stat.h"
+ || (errval == ERROR_BAD_PATHNAME)// "//nosuch" on Win64
+ || (errval == ERROR_BAD_NETPATH))// "//nosuch" on Win32
+ {
+
+ if (ec != 0) ec->clear(); // these are not errors
+ return file_status(file_not_found);
+ }
+ else if ((errval == ERROR_SHARING_VIOLATION))
+ {
+ if (ec != 0) ec->clear(); // these are not errors
+ return file_status(type_unknown);
+ }
+ if (ec == 0)
+ throw_exception(filesystem_error("boost::filesystem::status",
+ p, error_code(errval, system_category)));
+ else
+ ec->assign(errval, system_category);
+ return file_status(status_unknown);
+ }
-# endif
- } // namespace detail
+# endif
BOOST_FILESYSTEM_DECL
- file_status status( const path & p, error_code & ec )
+ file_status status(const path& p, error_code* ec)
{
# ifdef BOOST_WINDOWS_API
- DWORD attr( ::GetFileAttributesW( p.c_str() ) );
- if ( attr == 0xFFFFFFFF )
+ DWORD attr(::GetFileAttributesW(p.c_str()));
+ if (attr == 0xFFFFFFFF)
{
- return detail::process_status_failure( p, ec );
+ return detail::process_status_failure(p, ec);
}
// symlink handling
- if ( attr & FILE_ATTRIBUTE_REPARSE_POINT ) // aka symlink
+ if (attr & FILE_ATTRIBUTE_REPARSE_POINT)// aka symlink
{
handle_wrapper h(
create_file_handle(
@@ -1254,171 +1251,173 @@
0, // lpSecurityAttributes
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
- 0 ) ); // hTemplateFile
- if ( h.handle == INVALID_HANDLE_VALUE )
+ 0)); // hTemplateFile
+ if (h.handle == INVALID_HANDLE_VALUE)
{
- return detail::process_status_failure( p, ec );
+ return detail::process_status_failure(p, ec);
}
}
- if ( &ec != &boost::throws() ) ec.clear(); // these are not errors
+ if (ec != 0) ec->clear(); // these are not errors
return (attr & FILE_ATTRIBUTE_DIRECTORY)
- ? file_status( directory_file )
- : file_status( regular_file );
+ ? file_status(directory_file)
+ : file_status(regular_file);
# else
struct stat path_stat;
- if ( ::stat( p.c_str(), &path_stat ) != 0 )
+ if (::stat(p.c_str(), &path_stat)!= 0)
{
- if ( errno == ENOENT || errno == ENOTDIR )
+ if (errno == ENOENT || errno == ENOTDIR)
{
- if ( &ec != &throws() ) ec.clear();;
- return fs::file_status( fs::file_not_found );
+ if (ec != 0) ec->clear();;
+ return fs::file_status(fs::file_not_found);
}
- if ( &ec != &throws() )
- ec.assign( errno, system_category );
+ if (ec != 0)
+ ec->assign(errno, system_category);
else
- throw_exception( filesystem_error( "boost::filesystem::status",
- p, errno, system_category ) );
+ throw_exception(filesystem_error("boost::filesystem::status",
+ p, errno, system_category));
- return fs::file_status( fs::status_unknown );
+ return fs::file_status(fs::status_unknown);
}
- if ( &ec != &throws() ) ec.clear();;
- if ( S_ISDIR( path_stat.st_mode ) )
- return fs::file_status( fs::directory_file );
- if ( S_ISREG( path_stat.st_mode ) )
- return fs::file_status( fs::regular_file );
- if ( S_ISBLK( path_stat.st_mode ) )
- return fs::file_status( fs::block_file );
- if ( S_ISCHR( path_stat.st_mode ) )
- return fs::file_status( fs::character_file );
- if ( S_ISFIFO( path_stat.st_mode ) )
- return fs::file_status( fs::fifo_file );
- if ( S_ISSOCK( path_stat.st_mode ) )
- return fs::file_status( fs::socket_file );
- return fs::file_status( fs::type_unknown );
+ if (ec != 0) ec->clear();;
+ if (S_ISDIR(path_stat.st_mode))
+ return fs::file_status(fs::directory_file);
+ if (S_ISREG(path_stat.st_mode))
+ return fs::file_status(fs::regular_file);
+ if (S_ISBLK(path_stat.st_mode))
+ return fs::file_status(fs::block_file);
+ if (S_ISCHR(path_stat.st_mode))
+ return fs::file_status(fs::character_file);
+ if (S_ISFIFO(path_stat.st_mode))
+ return fs::file_status(fs::fifo_file);
+ if (S_ISSOCK(path_stat.st_mode))
+ return fs::file_status(fs::socket_file);
+ return fs::file_status(fs::type_unknown);
# endif
}
BOOST_FILESYSTEM_DECL
- file_status symlink_status( const path & p, error_code & ec )
+ file_status symlink_status(const path& p, error_code* ec)
{
# ifdef BOOST_WINDOWS_API
- DWORD attr( ::GetFileAttributesW( p.c_str() ) );
- if ( attr == 0xFFFFFFFF )
+ DWORD attr(::GetFileAttributesW(p.c_str()));
+ if (attr == 0xFFFFFFFF)
{
- return detail::process_status_failure( p, ec );
+ return detail::process_status_failure(p, ec);
}
- if ( attr & FILE_ATTRIBUTE_REPARSE_POINT ) // aka symlink
- return file_status( symlink_file );
+ if (attr & FILE_ATTRIBUTE_REPARSE_POINT)// aka symlink
+ return file_status(symlink_file);
- if ( &ec != &boost::throws() ) ec.clear(); // these are not errors
+ if (ec != 0) ec->clear(); // these are not errors
return (attr & FILE_ATTRIBUTE_DIRECTORY)
- ? file_status( directory_file )
- : file_status( regular_file );
+ ? file_status(directory_file)
+ : file_status(regular_file);
# else
struct stat path_stat;
- if ( ::lstat( p.c_str(), &path_stat ) != 0 )
+ if (::lstat(p.c_str(), &path_stat)!= 0)
{
- if ( errno == ENOENT || errno == ENOTDIR ) // these are not errors
+ if (errno == ENOENT || errno == ENOTDIR) // these are not errors
{
- if ( &ec != &boost::throws() ) ec.clear();
- return fs::file_status( fs::file_not_found );
+ if (ec != 0) ec->clear();
+ return fs::file_status(fs::file_not_found);
}
- if ( &ec != &boost::throws() ) ec.assign( errno, system_category );
+ if (ec != 0) ec->assign(errno, system_category);
else
- return fs::file_status( fs::status_unknown );
+ return fs::file_status(fs::status_unknown);
}
- if ( &ec != &boost::throws() ) ec.clear();
- if ( S_ISREG( path_stat.st_mode ) )
- return fs::file_status( fs::regular_file );
- if ( S_ISDIR( path_stat.st_mode ) )
- return fs::file_status( fs::directory_file );
- if ( S_ISLNK( path_stat.st_mode ) )
- return fs::file_status( fs::symlink_file );
- if ( S_ISBLK( path_stat.st_mode ) )
- return fs::file_status( fs::block_file );
- if ( S_ISCHR( path_stat.st_mode ) )
- return fs::file_status( fs::character_file );
- if ( S_ISFIFO( path_stat.st_mode ) )
- return fs::file_status( fs::fifo_file );
- if ( S_ISSOCK( path_stat.st_mode ) )
- return fs::file_status( fs::socket_file );
- return fs::file_status( fs::type_unknown );
+ if (ec != 0) ec->clear();
+ if (S_ISREG(path_stat.st_mode))
+ return fs::file_status(fs::regular_file);
+ if (S_ISDIR(path_stat.st_mode))
+ return fs::file_status(fs::directory_file);
+ if (S_ISLNK(path_stat.st_mode))
+ return fs::file_status(fs::symlink_file);
+ if (S_ISBLK(path_stat.st_mode))
+ return fs::file_status(fs::block_file);
+ if (S_ISCHR(path_stat.st_mode))
+ return fs::file_status(fs::character_file);
+ if (S_ISFIFO(path_stat.st_mode))
+ return fs::file_status(fs::fifo_file);
+ if (S_ISSOCK(path_stat.st_mode))
+ return fs::file_status(fs::socket_file);
+ return fs::file_status(fs::type_unknown);
# endif
}
- BOOST_FILESYSTEM_DECL
- path system_complete( const path & p, system::error_code & ec )
- {
+ BOOST_FILESYSTEM_DECL
+ path system_complete(const path& p, system::error_code* ec)
+ {
# ifdef BOOST_WINDOWS_API
- if ( p.empty() )
+ if (p.empty())
{
- if ( &ec != &throws() ) ec.clear();
+ if (ec != 0) ec->clear();
return p;
}
wchar_t buf[buf_size];
wchar_t * pfn;
- std::size_t len = get_full_path_name( p, buf_size, buf, &pfn );
+ std::size_t len = get_full_path_name(p, buf_size, buf, &pfn);
- if ( error( len == 0, p, ec, "boost::filesystem::system_complete" ) )
+ if (error(len == 0, p, ec, "boost::filesystem::system_complete"))
return path();
- if ( len < buf_size ) // len does not include null termination character
- return path( &buf[0] );
+ if (len < buf_size)// len does not include null termination character
+ return path(&buf[0]);
- boost::scoped_array<wchar_t> big_buf( new wchar_t[len] );
+ boost::scoped_array<wchar_t> big_buf(new wchar_t[len]);
- return error( get_full_path_name( p, len , big_buf.get(), &pfn ) == 0,
- p, ec, "boost::filesystem::system_complete" )
+ return error(get_full_path_name(p, len , big_buf.get(), &pfn)== 0,
+ p, ec, "boost::filesystem::system_complete")
? path()
- : path( big_buf.get() );
+ : path(big_buf.get());
# else
return (p.empty() || p.is_complete())
- ? p : current_path() / p;
+ ? p : current_path()/ p;
# endif
}
+} // namespace detail
+
//--------------------------------------------------------------------------------------//
// //
// directory_entry //
// //
//--------------------------------------------------------------------------------------//
- file_status
- directory_entry::status( system::error_code & ec ) const
+ file_status
+ directory_entry::m_get_status(system::error_code* ec) const
{
- if ( !status_known( m_status ) )
+ if (!status_known(m_status))
{
// optimization: if the symlink status is known, and it isn't a symlink,
// then status and symlink_status are identical so just copy the
// symlink status to the regular status.
- if ( status_known( m_symlink_status )
- && !is_symlink( m_symlink_status ) )
+ if (status_known(m_symlink_status)
+ && !is_symlink(m_symlink_status))
{
m_status = m_symlink_status;
- if ( &ec != &boost::throws() ) ec.clear();
+ if (ec != 0) ec->clear();
}
- else m_status = fs::status( m_path, ec );
+ else m_status = detail::status(m_path, ec);
}
- else if ( &ec != &boost::throws() ) ec.clear();
+ else if (ec != 0) ec->clear();
return m_status;
}
file_status
- directory_entry::symlink_status( system::error_code & ec ) const
+ directory_entry::m_get_symlink_status(system::error_code* ec) const
{
- if ( !status_known( m_symlink_status ) )
- m_symlink_status = fs::symlink_status( m_path, ec );
- else if ( &ec != &boost::throws() ) ec.clear();
+ if (!status_known(m_symlink_status))
+ m_symlink_status = detail::symlink_status(m_path, ec);
+ else if (ec != 0) ec->clear();
return m_symlink_status;
}
@@ -1428,13 +1427,13 @@
namespace path_traits
{
- void dispatch( const directory_entry & de,
+ void dispatch(const directory_entry & de,
# ifdef BOOST_WINDOWS_API
- std::wstring & to,
+ std::wstring& to,
# else
- std::string & to,
+ std::string& to,
# endif
- const codecvt_type & )
+ const codecvt_type &)
{
to = de.path().native();
}
@@ -1453,53 +1452,53 @@
{
# ifdef BOOST_WINDOWS_API
- error_code dir_itr_first( void *& handle, const fs::path & dir,
- wstring & target, fs::file_status & sf, fs::file_status & symlink_sf )
+ error_code dir_itr_first(void *& handle, const fs::path& dir,
+ wstring& target, fs::file_status & sf, fs::file_status & symlink_sf)
// Note: an empty root directory has no "." or ".." entries, so this
// causes a ERROR_FILE_NOT_FOUND error which we do not considered an
// error. It is treated as eof instead.
{
// use a form of search Sebastian Martel reports will work with Win98
- wstring dirpath( dir.wstring() );
+ wstring dirpath(dir.wstring());
dirpath += (dirpath.empty()
|| (dirpath[dirpath.size()-1] != L'\\'
&& dirpath[dirpath.size()-1] != L'/'
- && dirpath[dirpath.size()-1] != L':')) ? L"\\*" : L"*";
+ && dirpath[dirpath.size()-1] != L':'))? L"\\*" : L"*";
WIN32_FIND_DATAW data;
- if ( (handle = ::FindFirstFileW( dirpath.c_str(), &data ))
- == INVALID_HANDLE_VALUE )
+ if ((handle = ::FindFirstFileW(dirpath.c_str(), &data))
+ == INVALID_HANDLE_VALUE)
{
handle = 0;
- return error_code( ::GetLastError() == ERROR_FILE_NOT_FOUND
- ? 0 : ::GetLastError(), system_category );
+ return error_code(::GetLastError()== ERROR_FILE_NOT_FOUND
+ ? 0 : ::GetLastError(), system_category);
}
target = data.cFileName;
- if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
- { sf.type( fs::directory_file ); symlink_sf.type( fs::directory_file ); }
- else { sf.type( fs::regular_file ); symlink_sf.type( fs::regular_file ); }
+ if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ { sf.type(fs::directory_file); symlink_sf.type(fs::directory_file); }
+ else { sf.type(fs::regular_file); symlink_sf.type(fs::regular_file); }
return error_code();
}
- error_code dir_itr_increment( void *& handle, wstring & target,
- fs::file_status & sf, fs::file_status & symlink_sf )
+ error_code dir_itr_increment(void *& handle, wstring& target,
+ fs::file_status & sf, fs::file_status & symlink_sf)
{
WIN32_FIND_DATAW data;
- if ( ::FindNextFileW( handle, &data ) == 0 ) // fails
+ if (::FindNextFileW(handle, &data)== 0)// fails
{
int error = ::GetLastError();
- fs::detail::dir_itr_close( handle );
- return error_code( error == ERROR_NO_MORE_FILES ? 0 : error, system_category );
+ fs::detail::dir_itr_close(handle);
+ return error_code(error == ERROR_NO_MORE_FILES ? 0 : error, system_category);
}
target = data.cFileName;
- if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
- { sf.type( fs::directory_file ); symlink_sf.type( fs::directory_file ); }
- else { sf.type( fs::regular_file ); symlink_sf.type( fs::regular_file ); }
+ if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ { sf.type(fs::directory_file); symlink_sf.type(fs::directory_file); }
+ else { sf.type(fs::regular_file); symlink_sf.type(fs::regular_file); }
return error_code();
}
# else // BOOST_POSIX_API
- error_code path_max( std::size_t & result )
+ error_code path_max(std::size_t & result)
// this code is based on Stevens and Rago, Advanced Programming in the
// UNIX envirnment, 2nd Ed., ISBN 0-201-43307-9, page 49
{
@@ -1508,106 +1507,106 @@
# else
static std::size_t max = 0;
# endif
- if ( max == 0 )
+ if (max == 0)
{
errno = 0;
- long tmp = ::pathconf( "/", _PC_NAME_MAX );
- if ( tmp < 0 )
+ long tmp = ::pathconf("/", _PC_NAME_MAX);
+ if (tmp < 0)
{
- if ( errno == 0 ) // indeterminate
+ if (errno == 0)// indeterminate
max = 4096; // guess
- else return error_code( errno, system_category );
+ else return error_code(errno, system_category);
}
- else max = static_cast<std::size_t>( tmp + 1 ); // relative root
+ else max = static_cast<std::size_t>(tmp + 1); // relative root
}
result = max;
return ok;
}
- error_code dir_itr_first( void *& handle, void *& buffer,
- const char * dir, string & target,
- fs::file_status &, fs::file_status & )
- {
- if ( (handle = ::opendir( dir )) == 0 )
- return error_code( errno, system_category );
- target = string( "." ); // string was static but caused trouble
+ error_code dir_itr_first(void *& handle, void *& buffer,
+ const char * dir, string& target,
+ fs::file_status &, fs::file_status &)
+ {
+ if ((handle = ::opendir(dir))== 0)
+ return error_code(errno, system_category);
+ target = string("."); // string was static but caused trouble
// when iteration called from dtor, after
// static had already been destroyed
std::size_t path_size (0); // initialization quiets gcc warning (ticket #3509)
- error_code ec = path_max( path_size );
- if ( ec ) return ec;
+ error_code ec = path_max(path_size);
+ if (ec)return ec;
dirent de;
- buffer = std::malloc( (sizeof(dirent) - sizeof(de.d_name))
- + path_size + 1 ); // + 1 for "/0"
+ buffer = std::malloc((sizeof(dirent) - sizeof(de.d_name))
+ + path_size + 1); // + 1 for "/0"
return ok;
}
- //error_code dir_itr_close( void *& handle, void*& buffer )
+ //error_code dir_itr_close(void *& handle, void*& buffer)
//{
- // std::free( buffer );
+ // std::free(buffer);
// buffer = 0;
- // if ( handle == 0 ) return ok;
- // DIR * h( static_cast<DIR*>(handle) );
+ // if (handle == 0)return ok;
+ // DIR * h(static_cast<DIR*>(handle));
// handle = 0;
- // return error_code( ::closedir( h ) == 0 ? 0 : errno, system_category );
+ // return error_code(::closedir(h)== 0 ? 0 : errno, system_category);
//}
// warning: the only dirent member updated is d_name
- inline int readdir_r_simulator( DIR * dirp, struct dirent * entry,
- struct dirent ** result ) // *result set to 0 on end of directory
+ inline int readdir_r_simulator(DIR * dirp, struct dirent * entry,
+ struct dirent ** result)// *result set to 0 on end of directory
{
errno = 0;
-# if !defined(__CYGWIN__) \
- && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \
- && defined(_SC_THREAD_SAFE_FUNCTIONS) \
- && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) \
+# if !defined(__CYGWIN__)\
+ && defined(_POSIX_THREAD_SAFE_FUNCTIONS)\
+ && defined(_SC_THREAD_SAFE_FUNCTIONS)\
+ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0)\
&& (!defined(__hpux) || (defined(__hpux) && defined(_REENTRANT)))
- if ( ::sysconf( _SC_THREAD_SAFE_FUNCTIONS ) >= 0 )
- { return ::readdir_r( dirp, entry, result ); }
+ if (::sysconf(_SC_THREAD_SAFE_FUNCTIONS)>= 0)
+ { return ::readdir_r(dirp, entry, result); }
# endif
struct dirent * p;
*result = 0;
- if ( (p = ::readdir( dirp )) == 0 )
+ if ((p = ::readdir(dirp))== 0)
return errno;
- std::strcpy( entry->d_name, p->d_name );
+ std::strcpy(entry->d_name, p->d_name);
*result = entry;
return 0;
}
- error_code dir_itr_increment( void *& handle, void *& buffer,
- string & target, fs::file_status & sf, fs::file_status & symlink_sf )
+ error_code dir_itr_increment(void *& handle, void *& buffer,
+ string& target, fs::file_status & sf, fs::file_status & symlink_sf)
{
- BOOST_ASSERT( buffer != 0 );
- dirent * entry( static_cast<dirent *>(buffer) );
+ BOOST_ASSERT(buffer != 0);
+ dirent * entry(static_cast<dirent *>(buffer));
dirent * result;
int return_code;
- if ( (return_code = readdir_r_simulator( static_cast<DIR*>(handle),
- entry, &result )) != 0 ) return error_code( errno, system_category );
- if ( result == 0 )
- return fs::detail::dir_itr_close( handle, buffer );
+ if ((return_code = readdir_r_simulator(static_cast<DIR*>(handle),
+ entry, &result))!= 0)return error_code(errno, system_category);
+ if (result == 0)
+ return fs::detail::dir_itr_close(handle, buffer);
target = entry->d_name;
# ifdef BOOST_FILESYSTEM_STATUS_CACHE
- if ( entry->d_type == DT_UNKNOWN ) // filesystem does not supply d_type value
+ if (entry->d_type == DT_UNKNOWN) // filesystem does not supply d_type value
{
sf = symlink_sf = fs::file_status(fs::status_unknown);
}
else // filesystem supplies d_type value
{
- if ( entry->d_type == DT_DIR )
- sf = symlink_sf = fs::file_status( fs::directory_file );
- else if ( entry->d_type == DT_REG )
- sf = symlink_sf = fs::file_status( fs::regular_file );
- else if ( entry->d_type == DT_LNK )
+ if (entry->d_type == DT_DIR)
+ sf = symlink_sf = fs::file_status(fs::directory_file);
+ else if (entry->d_type == DT_REG)
+ sf = symlink_sf = fs::file_status(fs::regular_file);
+ else if (entry->d_type == DT_LNK)
{
- sf = fs::file_status( fs::status_unknown );
- symlink_sf = fs::file_status( fs::symlink_file );
+ sf = fs::file_status(fs::status_unknown);
+ symlink_sf = fs::file_status(fs::symlink_file);
}
- else sf = symlink_sf = fs::file_status( fs::status_unknown );
+ else sf = symlink_sf = fs::file_status(fs::status_unknown);
}
# else
- sf = symlink_sf = fs::file_status( fs::status_unknown );
+ sf = symlink_sf = fs::file_status(fs::status_unknown);
# endif
return ok;
}
@@ -1619,7 +1618,7 @@
# else
ENOENT
# endif
- , system_category );
+ , system_category);
} // unnamed namespace
@@ -1630,73 +1629,73 @@
namespace detail
{
- // dir_itr_close is called both from the ~dir_itr_imp() destructor
- // and dir_itr_increment()
+ // dir_itr_close is called both from the ~dir_itr_imp()destructor
+ // and dir_itr_increment()
BOOST_FILESYSTEM_DECL
- system::error_code dir_itr_close( // never throws()
+ system::error_code dir_itr_close( // never throws
void *& handle
# if defined(BOOST_POSIX_API)
, void *& buffer
# endif
- )
+ )
{
# ifdef BOOST_WINDOWS_API
- if ( handle != 0 )
+ if (handle != 0)
{
- ::FindClose( handle );
+ ::FindClose(handle);
handle = 0;
}
return ok;
# else
- std::free( buffer );
+ std::free(buffer);
buffer = 0;
- if ( handle == 0 ) return ok;
- DIR * h( static_cast<DIR*>(handle) );
+ if (handle == 0)return ok;
+ DIR * h(static_cast<DIR*>(handle));
handle = 0;
- return error_code( ::closedir( h ) == 0 ? 0 : errno, system_category );
+ return error_code(::closedir(h)== 0 ? 0 : errno, system_category);
# endif
}
- void directory_iterator_construct( directory_iterator & it,
- const path & p, system::error_code & ec )
+ void directory_iterator_construct(directory_iterator & it,
+ const path& p, system::error_code* ec)
{
- if ( error( p.empty(), not_found_error, p, ec,
- "boost::filesystem::directory_iterator::construct" ) ) return;
+ if (error(p.empty(), not_found_error, p, ec,
+ "boost::filesystem::directory_iterator::construct"))return;
path::string_type filename;
file_status file_stat, symlink_file_stat;
- error_code result = dir_itr_first( it.m_imp->handle,
+ error_code result = dir_itr_first(it.m_imp->handle,
#if defined(BOOST_POSIX_API)
it.m_imp->buffer,
#endif
- p.c_str(), filename, file_stat, symlink_file_stat );
+ p.c_str(), filename, file_stat, symlink_file_stat);
- if ( result )
+ if (result)
{
it.m_imp.reset();
- error( true, result, p,
- ec, "boost::filesystem::directory_iterator::construct" );
+ error(true, result, p,
+ ec, "boost::filesystem::directory_iterator::construct");
return;
}
- if ( it.m_imp->handle == 0 ) it.m_imp.reset(); // eof, so make end iterator
+ if (it.m_imp->handle == 0)it.m_imp.reset(); // eof, so make end iterator
else // not eof
{
- it.m_imp->dir_entry.assign( p / filename,
- file_stat, symlink_file_stat );
- if ( filename[0] == dot // dot or dot-dot
- && (filename.size() == 1
+ it.m_imp->dir_entry.assign(p / filename,
+ file_stat, symlink_file_stat);
+ if (filename[0] == dot // dot or dot-dot
+ && (filename.size()== 1
|| (filename[1] == dot
- && filename.size() == 2)) )
+ && filename.size()== 2)))
{ it.increment(); }
}
}
- void directory_iterator_increment( directory_iterator & it )
+ void directory_iterator_increment(directory_iterator & it)
{
- BOOST_ASSERT( it.m_imp.get() && "attempt to increment end iterator" );
- BOOST_ASSERT( it.m_imp->handle != 0 && "internal program error" );
+ BOOST_ASSERT(it.m_imp.get() && "attempt to increment end iterator");
+ BOOST_ASSERT(it.m_imp->handle != 0 && "internal program error");
path::string_type filename;
file_status file_stat, symlink_file_stat;
@@ -1704,28 +1703,28 @@
for (;;)
{
- ec = dir_itr_increment( it.m_imp->handle,
+ ec = dir_itr_increment(it.m_imp->handle,
#if defined(BOOST_POSIX_API)
it.m_imp->buffer,
#endif
- filename, file_stat, symlink_file_stat );
+ filename, file_stat, symlink_file_stat);
- if ( ec )
+ if (ec)
{
it.m_imp.reset();
- error( true, it.m_imp->dir_entry.path().parent_path(),
- ec, "boost::filesystem::directory_iterator::operator++" );
+ error(true, it.m_imp->dir_entry.path().parent_path(),
+ &ec, "boost::filesystem::directory_iterator::operator++");
return;
}
- if ( it.m_imp->handle == 0 ) { it.m_imp.reset(); return; } // eof, make end
- if ( !(filename[0] == dot // !(dot or dot-dot)
- && (filename.size() == 1
+ if (it.m_imp->handle == 0){ it.m_imp.reset(); return; } // eof, make end
+ if (!(filename[0] == dot // !(dot or dot-dot)
+ && (filename.size()== 1
|| (filename[1] == dot
- && filename.size() == 2))) )
+ && filename.size()== 2))))
{
it.m_imp->dir_entry.replace_filename(
- filename, file_stat, symlink_file_stat );
+ filename, file_stat, symlink_file_stat);
return;
}
}
Modified: sandbox/filesystem-v3/libs/filesystem/test/msvc/common.vsprops
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/msvc/common.vsprops (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/msvc/common.vsprops 2009-10-27 16:06:40 EDT (Tue, 27 Oct 2009)
@@ -9,7 +9,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../.."
- PreprocessorDefinitions="BOOST_SYSTEM_NO_LIB;BOOST_FILESYSTEM_NO_LIB"
+ PreprocessorDefinitions="BOOST_SYSTEM_NO_DEPRECATED;BOOST_SYSTEM_NO_LIB;BOOST_FILESYSTEM_NO_LIB"
ExceptionHandling="2"
/>
<Tool
Modified: sandbox/filesystem-v3/libs/filesystem/test/msvc/path_test/path_test.vcproj
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/msvc/path_test/path_test.vcproj (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/msvc/path_test/path_test.vcproj 2009-10-27 16:06:40 EDT (Tue, 27 Oct 2009)
@@ -40,7 +40,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ PreprocessorDefinitions="BOOST_FILESYSTEM_PATH_CTOR_COUNT;WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp 2009-10-27 16:06:40 EDT (Tue, 27 Oct 2009)
@@ -33,6 +33,9 @@
#define PATH_CHECK( a, b ) check( a, b, __FILE__, __LINE__ )
#define CHECK_EQUAL( a,b ) check_equal( a, b, __FILE__, __LINE__ )
+# ifdef BOOST_FILESYSTEM_PATH_CTOR_COUNT
+namespace boost { namespace filesystem { long path_constructor_count = 0L; }}
+# endif
namespace
{
@@ -593,6 +596,7 @@
if ( platform == "Windows" )
{
+ std::cout << "Windows relational tests..." << std::endl;
path p10 ("c:\\file");
path p11 ("c:/file");
// check each overload
@@ -602,14 +606,60 @@
BOOST_TEST( p10 == p11.string().c_str() );
BOOST_TEST( p10.string() == p11 );
BOOST_TEST( p10.string().c_str() == p11 );
- BOOST_TEST( p10 == "c:\\file" );
- BOOST_TEST( p10 == "c:/file" );
- BOOST_TEST( p11 == "c:\\file" );
- BOOST_TEST( p11 == "c:/file" );
- BOOST_TEST( "c:\\file" == p10 );
- BOOST_TEST( "c:/file" == p10 );
- BOOST_TEST( "c:\\file" == p11 );
- BOOST_TEST( "c:/file" == p11 );
+ BOOST_TEST( p10 == L"c:\\file" );
+ BOOST_TEST( p10 == L"c:/file" );
+ BOOST_TEST( p11 == L"c:\\file" );
+ BOOST_TEST( p11 == L"c:/file" );
+ BOOST_TEST( L"c:\\file" == p10 );
+ BOOST_TEST( L"c:/file" == p10 );
+ BOOST_TEST( L"c:\\file" == p11 );
+ BOOST_TEST( L"c:/file" == p11 );
+
+ BOOST_TEST( !(p10.string() != p11.string()) );
+ BOOST_TEST( !(p10 != p11) );
+ BOOST_TEST( !(p10 != p11.string()) );
+ BOOST_TEST( !(p10 != p11.string().c_str()) );
+ BOOST_TEST( !(p10.string() != p11) );
+ BOOST_TEST( !(p10.string().c_str() != p11) );
+ BOOST_TEST( !(p10 != L"c:\\file") );
+ BOOST_TEST( !(p10 != L"c:/file") );
+ BOOST_TEST( !(p11 != L"c:\\file") );
+ BOOST_TEST( !(p11 != L"c:/file") );
+ BOOST_TEST( !(L"c:\\file" != p10) );
+ BOOST_TEST( !(L"c:/file" != p10) );
+ BOOST_TEST( !(L"c:\\file" != p11) );
+ BOOST_TEST( !(L"c:/file" != p11) );
+
+ BOOST_TEST( !(p10.string() < p11.string()) );
+ BOOST_TEST( !(p10 < p11) );
+ BOOST_TEST( !(p10 < p11.string()) );
+ BOOST_TEST( !(p10 < p11.string().c_str()) );
+ BOOST_TEST( !(p10.string() < p11) );
+ BOOST_TEST( !(p10.string().c_str() < p11) );
+ BOOST_TEST( !(p10 < L"c:\\file") );
+ BOOST_TEST( !(p10 < L"c:/file") );
+ BOOST_TEST( !(p11 < L"c:\\file") );
+ BOOST_TEST( !(p11 < L"c:/file") );
+ BOOST_TEST( !(L"c:\\file" < p10) );
+ BOOST_TEST( !(L"c:/file" < p10) );
+ BOOST_TEST( !(L"c:\\file" < p11) );
+ BOOST_TEST( !(L"c:/file" < p11) );
+
+ BOOST_TEST( !(p10.string() > p11.string()) );
+ BOOST_TEST( !(p10 > p11) );
+ BOOST_TEST( !(p10 > p11.string()) );
+ BOOST_TEST( !(p10 > p11.string().c_str()) );
+ BOOST_TEST( !(p10.string() > p11) );
+ BOOST_TEST( !(p10.string().c_str() > p11) );
+ BOOST_TEST( !(p10 > L"c:\\file") );
+ BOOST_TEST( !(p10 > L"c:/file") );
+ BOOST_TEST( !(p11 > L"c:\\file") );
+ BOOST_TEST( !(p11 > L"c:/file") );
+ BOOST_TEST( !(L"c:\\file" > p10) );
+ BOOST_TEST( !(L"c:/file" > p10) );
+ BOOST_TEST( !(L"c:\\file" > p11) );
+ BOOST_TEST( !(L"c:/file" > p11) );
+
}
}
@@ -1528,5 +1578,9 @@
std::cout << round_trip.string() << "..." << round_trip << " complete\n";
# endif
+# ifdef BOOST_FILESYSTEM_PATH_CTOR_COUNT
+ std::cout << fs::path_constructor_count << " calls to single argument path constructor\n";
+# endif
+
return ::boost::report_errors();
}
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