Updated Boost libraries to version 1.49, and recompiled them with NDK r8d

This commit is contained in:
pelya
2013-01-05 20:34:39 +02:00
parent 1c1e8f84ad
commit ebebac16b6
3885 changed files with 464519 additions and 52852 deletions

View File

@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_CONFIGX_HPP
#define BOOST_FILESYSTEM_CONFIGX_HPP
#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
// BOOST_FILESYSTEM_VERSION defined there
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
# define BOOST_FILESYSTEM_VERSION 2
# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2

View File

@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_CONVENIENCEX_HPP
#define BOOST_FILESYSTEM_CONVENIENCEX_HPP
#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
// BOOST_FILESYSTEM_VERSION defined there
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
# define BOOST_FILESYSTEM_VERSION 2
# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2

View File

@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_EXCEPTIONX_HPP
#define BOOST_FILESYSTEM_EXCEPTIONX_HPP
#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
// BOOST_FILESYSTEM_VERSION defined there
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
# define BOOST_FILESYSTEM_VERSION 2
# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2

View File

@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_FSTREAMX_HPP
#define BOOST_FILESYSTEM_FSTREAMX_HPP
#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
// BOOST_FILESYSTEM_VERSION defined there
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
# define BOOST_FILESYSTEM_VERSION 2
# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2

View File

@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_OPERATIONSX_HPP
#define BOOST_FILESYSTEM_OPERATIONSX_HPP
#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
// BOOST_FILESYSTEM_VERSION defined there
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
# define BOOST_FILESYSTEM_VERSION 2
# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2

View File

@@ -12,13 +12,16 @@
#ifndef BOOST_FILESYSTEM_PATHX_HPP
#define BOOST_FILESYSTEM_PATHX_HPP
#include <boost/config.hpp> // for <boost/config/user.hpp>, in case
// BOOST_FILESYSTEM_VERSION defined there
# if defined(BOOST_FILESYSTEM_VERSION) \
&& BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3
# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3
# endif
# if !defined(BOOST_FILESYSTEM_VERSION)
# define BOOST_FILESYSTEM_VERSION 2
# define BOOST_FILESYSTEM_VERSION 3
# endif
#if BOOST_FILESYSTEM_VERSION == 2

View File

@@ -51,6 +51,16 @@
# endif
# endif
// throw an exception ----------------------------------------------------------------//
//
// Exceptions were originally thrown via boost::throw_exception().
// As throw_exception() became more complex, it caused user error reporting
// to be harder to interpret, since the exception reported became much more complex.
// The immediate fix was to throw directly, wrapped in a macro to make any later change
// easier.
#define BOOST_FILESYSTEM_THROW(EX) throw EX
// narrow support only for badly broken compilers or libraries -------------//
# if defined(BOOST_NO_STD_WSTRING) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STD_LOCALE) || BOOST_WORKAROUND(__BORLANDC__, <0x610)

View File

@@ -13,7 +13,8 @@
#ifndef BOOST_FILESYSTEM2_CONVENIENCE_HPP
#define BOOST_FILESYSTEM2_CONVENIENCE_HPP
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/v2/config.hpp>
#include <boost/filesystem/v2/operations.hpp>
#include <boost/system/error_code.hpp>
#include <vector>
#include <stack>
@@ -85,11 +86,11 @@ namespace boost
# if !defined(_STLPORT_VERSION)
return ph.parent_path() / (basename(ph) + new_extension);
# else
typedef BOOST_FS_TYPENAME Path::string_type string_type;
string_type filename = basename(ph) + new_extension;
return ph.parent_path() / filename;
typedef BOOST_FS_TYPENAME Path::string_type string_type;
string_type filename = basename(ph) + new_extension;
return ph.parent_path() / filename;
# endif
}
}
# endif
# ifndef BOOST_FILESYSTEM2_NARROW_ONLY

View File

@@ -12,6 +12,7 @@
#ifndef BOOST_FILESYSTEM2_FSTREAM_HPP
#define BOOST_FILESYSTEM2_FSTREAM_HPP
#include <boost/filesystem/v2/config.hpp>
#include <boost/filesystem/v2/operations.hpp> // for 8.3 hack (see below)
#include <boost/utility/enable_if.hpp>
#include <boost/detail/workaround.hpp>

View File

@@ -14,6 +14,7 @@
#ifndef BOOST_FILESYSTEM2_OPERATIONS_HPP
#define BOOST_FILESYSTEM2_OPERATIONS_HPP
#include <boost/filesystem/v2/config.hpp>
#include <boost/filesystem/v2/path.hpp>
#include <boost/detail/scoped_enum_emulation.hpp>
@@ -258,7 +259,7 @@ namespace boost
system::error_code ec;
file_status result( detail::status_api( ph.external_file_string(), ec ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::status", ph, ec ) );
return result;
}
@@ -277,7 +278,7 @@ namespace boost
system::error_code ec;
file_status result( symlink_status( ph, ec ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::symlink_status", ph, ec ) );
return result;
}
@@ -292,7 +293,7 @@ namespace boost
system::error_code ec;
file_status result( detail::status_api( ph.external_file_string(), ec ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::exists", ph, ec ) );
return exists( result );
}
@@ -302,7 +303,7 @@ namespace boost
system::error_code ec;
file_status result( detail::status_api( ph.external_file_string(), ec ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_directory", ph, ec ) );
return is_directory( result );
}
@@ -312,7 +313,7 @@ namespace boost
system::error_code ec;
file_status result( detail::status_api( ph.external_file_string(), ec ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_regular_file", ph, ec ) );
return is_regular_file( result );
}
@@ -323,7 +324,7 @@ namespace boost
system::error_code ec;
file_status result( detail::status_api( ph.external_file_string(), ec ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_regular", ph, ec ) );
return is_regular( result );
}
@@ -334,7 +335,7 @@ namespace boost
system::error_code ec;
file_status result( detail::status_api( ph.external_file_string(), ec ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_other", ph, ec ) );
return is_other( result );
}
@@ -350,7 +351,7 @@ namespace boost
system::error_code ec;
file_status result( detail::symlink_status_api( ph.external_file_string(), ec ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_symlink", ph, ec ) );
return is_symlink( result );
# endif
@@ -369,7 +370,7 @@ namespace boost
detail::query_pair result(
detail::is_empty_api( ph.external_file_string() ) );
if ( result.first )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::is_empty", ph, result.first ) );
return result.second;
}
@@ -379,7 +380,7 @@ namespace boost
detail::query_pair result( detail::equivalent_api(
ph1.external_file_string(), ph2.external_file_string() ) );
if ( result.first )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::equivalent", ph1, ph2, result.first ) );
return result.second;
}
@@ -389,7 +390,7 @@ namespace boost
detail::uintmax_pair result
( detail::file_size_api( ph.external_file_string() ) );
if ( result.first )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::file_size", ph, result.first ) );
return result.second;
}
@@ -399,7 +400,7 @@ namespace boost
detail::space_pair result
( detail::space_api( ph.external_file_string() ) );
if ( result.first )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::space", ph, result.first ) );
return result.second;
}
@@ -409,7 +410,7 @@ namespace boost
detail::time_pair result
( detail::last_write_time_api( ph.external_file_string() ) );
if ( result.first )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::last_write_time", ph, result.first ) );
return result.second;
}
@@ -422,7 +423,7 @@ namespace boost
detail::query_pair result(
detail::create_directory_api( dir_ph.external_directory_string() ) );
if ( result.first )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::create_directory",
dir_ph, result.first ) );
return result.second;
@@ -437,7 +438,7 @@ namespace boost
to_ph.external_file_string(),
from_ph.external_file_string() ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::create_hard_link",
to_ph, from_ph, ec ) );
}
@@ -461,7 +462,7 @@ namespace boost
to_ph.external_file_string(),
from_ph.external_file_string() ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::create_symlink",
to_ph, from_ph, ec ) );
}
@@ -481,7 +482,7 @@ namespace boost
system::error_code ec;
file_status f = symlink_status( ph, ec );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::remove", ph, ec ) );
return detail::remove_aux( ph, f );
}
@@ -491,7 +492,7 @@ namespace boost
system::error_code ec;
file_status f = symlink_status( ph, ec );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::remove_all", ph, ec ) );
return exists( f ) ? detail::remove_all_aux( ph, f ) : 0;
}
@@ -502,7 +503,7 @@ namespace boost
from_path.external_directory_string(),
to_path.external_directory_string() ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::rename",
from_path, to_path, ec ) );
}
@@ -518,7 +519,7 @@ namespace boost
from_path.external_directory_string(),
to_path.external_directory_string(), option == copy_option::fail_if_exists ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::copy_file",
from_path, to_path, ec ) );
}
@@ -529,7 +530,7 @@ namespace boost
typename Path::external_string_type ph;
system::error_code ec( detail::get_current_path_api( ph ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::current_path", ec ) );
return Path( Path::traits_type::to_internal( ph ) );
}
@@ -539,7 +540,7 @@ namespace boost
system::error_code ec( detail::set_current_path_api(
ph.external_directory_string() ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::current_path", ph, ec ) );
}
@@ -567,7 +568,7 @@ namespace boost
system::error_code ec( detail::get_full_path_name_api( ph.external_file_string(),
sys_ph ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::system_complete", ph, ec ) );
return Path( Path::traits_type::to_internal( sys_ph ) );
# else
@@ -606,7 +607,7 @@ namespace boost
system::error_code ec( detail::last_write_time_api( ph.external_file_string(),
new_time ) );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::last_write_time", ph, ec ) );
}
@@ -782,7 +783,7 @@ namespace boost
{
system::error_code ec = remove_api( ph.external_file_string() );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::remove", ph, ec ) );
return true;
}
@@ -803,7 +804,7 @@ namespace boost
boost::system::error_code ec;
boost::filesystem2::file_status fn = boost::filesystem2::symlink_status( itr->path(), ec );
if ( ec )
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem:remove_all", ph, ec ) );
count += remove_all_aux( itr->path(), fn );
}
@@ -980,7 +981,7 @@ namespace boost
system::error_code ec( m_init(dir_path) );
if ( ec )
{
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::basic_directory_iterator constructor",
dir_path, ec ) );
}
@@ -1013,7 +1014,7 @@ namespace boost
name, fs, symlink_fs );
if ( ec )
{
boost::throw_exception( basic_filesystem_error<Path>(
BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>(
"boost::filesystem::basic_directory_iterator increment",
m_imp->m_directory_entry.path().parent_path(), ec ) );
}

View File

@@ -20,16 +20,15 @@
#include <boost/filesystem/v2/config.hpp>
#include <boost/system/system_error.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/throw_exception.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
#include <boost/assert.hpp>
#include <string>
#include <algorithm> // for lexicographical_compare
#include <iosfwd> // needed by basic_path inserter and extractor
#include <stdexcept>
#include <cassert>
# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
# include <locale>
@@ -916,7 +915,7 @@ namespace boost
boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits>
path_type;
assert( !str.empty() && str[pos] == slash<path_type>::value
BOOST_ASSERT( !str.empty() && str[pos] == slash<path_type>::value
&& "precondition violation" );
// subsequent logic expects pos to be for leftmost slash of a set
@@ -1380,7 +1379,7 @@ namespace boost
typedef typename Path::string_type string_type;
typedef typename Path::traits_type traits_type;
assert( itr.m_pos < itr.m_path_ptr->m_path.size() && "basic_path::iterator increment past end()" );
BOOST_ASSERT( itr.m_pos < itr.m_path_ptr->m_path.size() && "basic_path::iterator increment past end()" );
bool was_net( itr.m_name.size() > 2
&& itr.m_name[0] == slash<Path>::value
@@ -1439,7 +1438,7 @@ namespace boost
template<class Path>
void iterator_helper<Path>::do_decrement( iterator & itr )
{
assert( itr.m_pos && "basic_path::iterator decrement past begin()" );
BOOST_ASSERT( itr.m_pos && "basic_path::iterator decrement past begin()" );
typedef typename Path::string_type string_type;
typedef typename Path::traits_type traits_type;

View File

@@ -27,7 +27,8 @@
// on Windows, except for standard libaries known to have wchar_t overloads for
// file stream I/O, use path::string() to get a narrow character c_str()
#if defined(BOOST_WINDOWS_API) \
&& !(defined(_CPPLIB_VER) && _CPPLIB_VER >= 405) // not (Dinkumware with overloads)
&& (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405 || defined(_STLPORT_VERSION))
// !Dinkumware || early Dinkumware || STLPort masquerading as Dinkumware
# define BOOST_FILESYSTEM_C_STR string().c_str() // use narrow, since wide not available
#else // use the native c_str, which will be narrow on POSIX, wide on Windows
# define BOOST_FILESYSTEM_C_STR c_str()

View File

@@ -25,6 +25,7 @@
#include <boost/filesystem/v3/path.hpp>
#include <boost/detail/scoped_enum_emulation.hpp>
#include <boost/detail/bitmask.hpp>
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
#include <boost/shared_ptr.hpp>
@@ -54,9 +55,7 @@ namespace boost
{
//--------------------------------------------------------------------------------------//
// //
// support classes and enums //
// //
// file_type //
//--------------------------------------------------------------------------------------//
enum file_type
@@ -75,32 +74,102 @@ namespace boost
fifo_file,
socket_file,
reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
type_unknown, // file does exist, but isn't one of the above types or
// we don't have strong enough permission to find its type
type_unknown, // file does exist, but isn't one of the above types or
// we don't have strong enough permission to find its type
_detail_directory_symlink // internal use only; never exposed to users
};
//--------------------------------------------------------------------------------------//
// perms //
//--------------------------------------------------------------------------------------//
enum perms
{
no_perms = 0, // file_not_found is no_perms rather than perms_not_known
// POSIX equivalent macros given in comments.
// Values are from POSIX and are given in octal per the POSIX standard.
// permission bits
owner_read = 0400, // S_IRUSR, Read permission, owner
owner_write = 0200, // S_IWUSR, Write permission, owner
owner_exe = 0100, // S_IXUSR, Execute/search permission, owner
owner_all = 0700, // S_IRWXU, Read, write, execute/search by owner
group_read = 040, // S_IRGRP, Read permission, group
group_write = 020, // S_IWGRP, Write permission, group
group_exe = 010, // S_IXGRP, Execute/search permission, group
group_all = 070, // S_IRWXG, Read, write, execute/search by group
others_read = 04, // S_IROTH, Read permission, others
others_write = 02, // S_IWOTH, Write permission, others
others_exe = 01, // S_IXOTH, Execute/search permission, others
others_all = 07, // S_IRWXO, Read, write, execute/search by others
all_all = owner_all|group_all|others_all, // 0777
// other POSIX bits
set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution
set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution
sticky_bit = 01000, // S_ISVTX,
// (POSIX XSI) On directories, restricted deletion flag
// (V7) 'sticky bit': save swapped text even after use
// (SunOS) On non-directories: don't cache this file
// (SVID-v4.2) On directories: restricted deletion flag
// Also see http://en.wikipedia.org/wiki/Sticky_bit
perms_mask = all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit, // 07777
perms_not_known = 0xFFFF, // present when directory_entry cache not loaded
// options for permissions() function
add_perms = 0x1000, // adds the given permission bits to the current bits
remove_perms = 0x2000, // removes the given permission bits from the current bits;
// choose add_perms or remove_perms, not both; if neither add_perms
// nor remove_perms is given, replace the current bits with
// the given bits.
symlink_perms = 0x4000 // on POSIX, don't resolve symlinks; implied on Windows
};
BOOST_BITMASK(perms)
//--------------------------------------------------------------------------------------//
// file_status //
//--------------------------------------------------------------------------------------//
class BOOST_FILESYSTEM_DECL file_status
{
public:
explicit file_status(file_type v = status_error) : m_value(v) {}
file_status() : m_value(status_error), m_perms(perms_not_known) {}
explicit file_status(file_type v, perms prms = perms_not_known)
: m_value(v), m_perms(prms) {}
void type(file_type v) { m_value = v; }
file_type type() const { return m_value; }
// observers
file_type type() const { return m_value; }
perms permissions() const { return m_perms; }
bool operator==(const file_status& rhs) const { return type() == rhs.type(); }
// modifiers
void type(file_type v) { m_value = v; }
void permissions(perms prms) { m_perms = prms; }
bool operator==(const file_status& rhs) const { return type() == rhs.type() &&
permissions() == rhs.permissions(); }
bool operator!=(const file_status& rhs) const { return !(*this == rhs); }
private:
// the internal representation is unspecified so that additional state
// information such as permissions can be added in the future; this
// implementation just uses file_type as the internal representation
file_type m_value;
file_type m_value;
enum perms m_perms;
};
inline bool status_known(file_status f) { return f.type() != status_error; }
inline bool type_present(file_status f) { return f.type() != status_error; }
inline bool permissions_present(file_status f)
{return f.permissions() != perms_not_known;}
inline bool status_known(file_status f) { return type_present(f) && permissions_present(f); }
inline bool exists(file_status f) { return f.type() != status_error
&& f.type() != file_not_found; }
inline bool is_regular_file(file_status f){ return f.type() == regular_file; }
@@ -122,7 +191,7 @@ namespace boost
};
BOOST_SCOPED_ENUM_START(copy_option)
{fail_if_exists, overwrite_if_exists};
{none, fail_if_exists = none, overwrite_if_exists};
BOOST_SCOPED_ENUM_END
//--------------------------------------------------------------------------------------//
@@ -140,6 +209,8 @@ namespace boost
BOOST_FILESYSTEM_DECL
path initial_path(system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path canonical(const path& p, const path& base, 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);
@@ -155,7 +226,7 @@ namespace boost
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);
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
@@ -174,7 +245,9 @@ namespace boost
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);
system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
void permissions(const path& p, perms prms, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path read_symlink(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
@@ -191,6 +264,8 @@ namespace boost
BOOST_FILESYSTEM_DECL
path system_complete(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path temp_directory_path(system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path unique_path(const path& p, system::error_code* ec=0);
} // namespace detail
@@ -258,14 +333,22 @@ namespace boost
// forward declarations
path current_path(); // fwd declaration
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
path initial_path();
# endif
BOOST_FILESYSTEM_DECL
path absolute(const path& p, const path& base=current_path());
// If base.is_absolute(), throws nothing. Thus no need for ec argument
inline
path canonical(const path& p, const path& base=current_path())
{return detail::canonical(p, base);}
inline
path canonical(const path& p, system::error_code& ec)
{return detail::canonical(p, current_path(), &ec);}
inline
path canonical(const path& p, const path& base, system::error_code& ec)
{return detail::canonical(p, base, &ec);}
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline
path complete(const path& p)
@@ -331,17 +414,17 @@ namespace boost
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);}
void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);}
inline
void create_hard_link(const path& to, const path& from, system::error_code& ec)
{detail::create_hard_link(to, from, &ec);}
void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec)
{detail::create_hard_link(to, new_hard_link, &ec);}
inline
void create_symlink(const path& to, const path& from) {detail::create_symlink(to, from);}
void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);}
inline
void create_symlink(const path& to, const path& from, system::error_code& ec)
{detail::create_symlink(to, from, &ec);}
void create_symlink(const path& to, const path& new_symlink, system::error_code& ec)
{detail::create_symlink(to, new_symlink, &ec);}
inline
path current_path() {return detail::current_path();}
@@ -372,7 +455,6 @@ namespace boost
inline
boost::uintmax_t hard_link_count(const path& p, system::error_code& ec)
{return detail::hard_link_count(p, &ec);}
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline
path initial_path() {return detail::initial_path();}
@@ -383,7 +465,6 @@ namespace boost
path initial_path() {return initial_path();}
template <class Path>
path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
# endif
inline
std::time_t last_write_time(const path& p) {return detail::last_write_time(p);}
@@ -398,6 +479,13 @@ namespace boost
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
void permissions(const path& p, perms prms)
{detail::permissions(p, prms);}
inline
void permissions(const path& p, perms prms, system::error_code& ec)
{detail::permissions(p, prms, &ec);}
inline
path read_symlink(const path& p) {return detail::read_symlink(p);}
inline
@@ -446,6 +534,12 @@ namespace boost
path system_complete(const path& p, system::error_code& ec)
{return detail::system_complete(p, &ec);}
inline
path temp_directory_path() {return detail::temp_directory_path();}
inline
path temp_directory_path(system::error_code& ec)
{return detail::temp_directory_path(&ec);}
inline
path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%")
{ return detail::unique_path(p); }
inline
@@ -617,7 +711,7 @@ namespace detail
directory_entry,
boost::single_pass_traversal_tag >::reference dereference() const
{
BOOST_ASSERT(m_imp.get() && "attempt to dereference end iterator");
BOOST_ASSERT_MSG(m_imp.get(), "attempt to dereference end iterator");
return m_imp->dir_entry;
}
@@ -633,6 +727,17 @@ namespace detail
// //
//--------------------------------------------------------------------------------------//
BOOST_SCOPED_ENUM_START(symlink_option)
{
none,
no_recurse = none, // don't follow directory symlinks (default behavior)
recurse, // follow directory symlinks
_detail_no_push = recurse << 1 // internal use only
};
BOOST_SCOPED_ENUM_END
BOOST_BITMASK(BOOST_SCOPED_ENUM(symlink_option))
namespace detail
{
struct recur_dir_itr_imp
@@ -640,9 +745,9 @@ namespace detail
typedef directory_iterator element_type;
std::stack< element_type, std::vector< element_type > > m_stack;
int m_level;
bool m_no_push_request;
BOOST_SCOPED_ENUM(symlink_option) m_options;
recur_dir_itr_imp() : m_level(0), m_no_push_request(false) {}
recur_dir_itr_imp() : m_level(0), m_options(symlink_option::none) {}
void increment(system::error_code* ec); // ec == 0 means throw on error
@@ -658,23 +763,45 @@ namespace detail
void recur_dir_itr_imp::increment(system::error_code* ec)
// ec == 0 means throw on error
{
if (m_no_push_request)
{ m_no_push_request = false; }
else if (is_directory(m_stack.top()->status()))
if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push)
m_options &= ~symlink_option::_detail_no_push;
else
{
if (ec == 0)
m_stack.push(directory_iterator(m_stack.top()->path()));
else
{
m_stack.push(directory_iterator(m_stack.top()->path(), *ec));
if (*ec) return;
}
if (m_stack.top() != directory_iterator())
{
++m_level;
// Logic for following predicate was contributed by Daniel Aarno to handle cyclic
// symlinks correctly and efficiently, fixing ticket #5652.
// if (((m_options & symlink_option::recurse) == symlink_option::recurse
// || !is_symlink(m_stack.top()->symlink_status()))
// && is_directory(m_stack.top()->status())) ...
// The predicate code has since been rewritten to pass error_code arguments,
// per ticket #5653.
bool or_pred = (m_options & symlink_option::recurse) == symlink_option::recurse
|| (ec == 0 ? !is_symlink(m_stack.top()->symlink_status())
: !is_symlink(m_stack.top()->symlink_status(*ec)));
if (ec != 0 && *ec)
return;
bool and_pred = or_pred && (ec == 0 ? is_directory(m_stack.top()->status())
: is_directory(m_stack.top()->status(*ec)));
if (ec != 0 && *ec)
return;
if (and_pred)
{
if (ec == 0)
m_stack.push(directory_iterator(m_stack.top()->path()));
else
{
m_stack.push(directory_iterator(m_stack.top()->path(), *ec));
if (*ec)
return;
}
if (m_stack.top() != directory_iterator())
{
++m_level;
return;
}
m_stack.pop();
}
m_stack.pop();
}
while (!m_stack.empty() && ++m_stack.top() == directory_iterator())
@@ -687,7 +814,8 @@ namespace detail
inline
void recur_dir_itr_imp::pop()
{
BOOST_ASSERT(m_level > 0 && "pop() on recursive_directory_iterator with level < 1");
BOOST_ASSERT_MSG(m_level > 0,
"pop() on recursive_directory_iterator with level < 1");
do
{
@@ -714,66 +842,95 @@ namespace detail
recursive_directory_iterator(){} // creates the "end" iterator
explicit recursive_directory_iterator(const path& dir_path)
explicit recursive_directory_iterator(const path& dir_path,
BOOST_SCOPED_ENUM(symlink_option) opt = symlink_option::none)
: m_imp(new detail::recur_dir_itr_imp)
{
m_imp->m_options = opt;
m_imp->m_stack.push(directory_iterator(dir_path));
if (m_imp->m_stack.top() == directory_iterator())
{ m_imp.reset (); }
}
recursive_directory_iterator(const path& dir_path,
BOOST_SCOPED_ENUM(symlink_option) opt,
system::error_code & ec)
: m_imp(new detail::recur_dir_itr_imp)
{
m_imp->m_options = opt;
m_imp->m_stack.push(directory_iterator(dir_path, ec));
if (m_imp->m_stack.top() == directory_iterator())
{ m_imp.reset (); }
}
recursive_directory_iterator(const path& dir_path,
system::error_code & ec)
: m_imp(new detail::recur_dir_itr_imp)
{
m_imp->m_options = symlink_option::none;
m_imp->m_stack.push(directory_iterator(dir_path, ec));
if (m_imp->m_stack.top() == directory_iterator())
{ m_imp.reset (); }
}
recursive_directory_iterator& increment(system::error_code* ec)
recursive_directory_iterator& increment(system::error_code& ec)
{
BOOST_ASSERT(m_imp.get() && "increment() on end recursive_directory_iterator");
m_imp->increment(ec);
BOOST_ASSERT_MSG(m_imp.get(),
"increment() on end recursive_directory_iterator");
m_imp->increment(&ec);
if (m_imp->m_stack.empty())
m_imp.reset(); // done, so make end iterator
return *this;
}
int level() const
{
BOOST_ASSERT(m_imp.get() && "level() on end recursive_directory_iterator");
BOOST_ASSERT_MSG(m_imp.get(),
"level() on end recursive_directory_iterator");
return m_imp->m_level;
}
bool no_push_request() const
bool no_push_pending() const
{
BOOST_ASSERT(m_imp.get() && "no_push_request() on end recursive_directory_iterator");
return m_imp->m_no_push_request;
BOOST_ASSERT_MSG(m_imp.get(),
"is_no_push_requested() on end recursive_directory_iterator");
return (m_imp->m_options & symlink_option::_detail_no_push)
== symlink_option::_detail_no_push;
}
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
bool no_push_request() const { return no_push_pending(); }
# endif
void pop()
{
BOOST_ASSERT(m_imp.get() && "pop() on end recursive_directory_iterator");
BOOST_ASSERT_MSG(m_imp.get(),
"pop() on end recursive_directory_iterator");
m_imp->pop();
if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator
}
void no_push()
void no_push(bool value=true)
{
BOOST_ASSERT(m_imp.get() && "no_push() on end recursive_directory_iterator");
m_imp->m_no_push_request = true;
BOOST_ASSERT_MSG(m_imp.get(),
"no_push() on end recursive_directory_iterator");
if (value)
m_imp->m_options |= symlink_option::_detail_no_push;
else
m_imp->m_options &= ~symlink_option::_detail_no_push;
}
file_status status() const
{
BOOST_ASSERT(m_imp.get()
&& "status() on end recursive_directory_iterator");
BOOST_ASSERT_MSG(m_imp.get(),
"status() on end recursive_directory_iterator");
return m_imp->m_stack.top()->status();
}
file_status symlink_status() const
{
BOOST_ASSERT(m_imp.get()
&& "symlink_status() on end recursive_directory_iterator");
BOOST_ASSERT_MSG(m_imp.get(),
"symlink_status() on end recursive_directory_iterator");
return m_imp->m_stack.top()->symlink_status();
}
@@ -791,15 +948,18 @@ namespace detail
boost::single_pass_traversal_tag >::reference
dereference() const
{
BOOST_ASSERT(m_imp.get() && "dereference of end recursive_directory_iterator");
BOOST_ASSERT_MSG(m_imp.get(),
"dereference of end recursive_directory_iterator");
return *m_imp->m_stack.top();
}
void increment()
{
BOOST_ASSERT(m_imp.get() && "increment of end recursive_directory_iterator");
BOOST_ASSERT_MSG(m_imp.get(),
"increment of end recursive_directory_iterator");
m_imp->increment(0);
if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator
if (m_imp->m_stack.empty())
m_imp.reset(); // done, so make end iterator
}
bool equal(const recursive_directory_iterator& rhs) const
@@ -938,8 +1098,33 @@ namespace boost
{
namespace filesystem
{
// permissions
using filesystem3::no_perms;
using filesystem3::owner_read;
using filesystem3::owner_write;
using filesystem3::owner_exe;
using filesystem3::owner_all;
using filesystem3::group_read;
using filesystem3::group_write;
using filesystem3::group_exe;
using filesystem3::group_all;
using filesystem3::others_read;
using filesystem3::others_write;
using filesystem3::others_exe;
using filesystem3::others_all;
using filesystem3::all_all;
using filesystem3::set_uid_on_exe;
using filesystem3::set_gid_on_exe;
using filesystem3::sticky_bit;
using filesystem3::perms_mask;
using filesystem3::perms_not_known;
using filesystem3::add_perms;
using filesystem3::remove_perms;
using filesystem3::symlink_perms;
using filesystem3::absolute;
using filesystem3::block_file;
using filesystem3::canonical;
using filesystem3::character_file;
// using filesystem3::copy;
using filesystem3::copy_file;
@@ -963,6 +1148,7 @@ namespace boost
using filesystem3::file_type;
using filesystem3::filesystem_error;
using filesystem3::hard_link_count;
using filesystem3::initial_path;
using filesystem3::is_directory;
using filesystem3::is_directory;
using filesystem3::is_empty;
@@ -970,9 +1156,13 @@ namespace boost
using filesystem3::is_regular_file;
using filesystem3::is_symlink;
using filesystem3::last_write_time;
using filesystem3::permissions;
using filesystem3::permissions_present;
using filesystem3::perms;
using filesystem3::read_symlink;
using filesystem3::recursive_directory_iterator;
using filesystem3::regular_file;
using filesystem3::reparse_file;
using filesystem3::remove;
using filesystem3::remove_all;
using filesystem3::rename;
@@ -984,12 +1174,14 @@ namespace boost
using filesystem3::status_error;
using filesystem3::status_known;
using filesystem3::symlink_file;
using filesystem3::symlink_option;
using filesystem3::symlink_status;
using filesystem3::system_complete;
using filesystem3::temp_directory_path;
using filesystem3::type_present;
using filesystem3::type_unknown;
using filesystem3::unique_path;
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
using filesystem3::initial_path;
using filesystem3::is_regular;
using filesystem3::status_unknown;
using filesystem3::symbolic_link_exists;

View File

@@ -29,6 +29,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/io/detail/quoted_manip.hpp>
#include <boost/static_assert.hpp>
#include <boost/functional/hash_fwd.hpp>
#include <string>
#include <iterator>
#include <cstring>
@@ -95,7 +96,7 @@ namespace filesystem3
// TODO: rules needed for operating systems that use / or .
// differently, or format directory paths differently from file paths.
//
// ************************************************************************
// **********************************************************************************
//
// More work needed: How to handle an operating system that may have
// slash characters or dot characters in valid filenames, either because
@@ -107,7 +108,7 @@ namespace filesystem3
// ^^^^
// Note that 0x2F is the ASCII slash character
//
// ************************************************************************
// **********************************************************************************
// Supported source arguments: half-open iterator range, container, c-array,
// and single pointer to null terminated string.
@@ -116,16 +117,16 @@ namespace filesystem3
// multi-byte character strings which may have embedded nulls. Embedded null
// support is required for some Asian languages on Windows.
// "const codecvt_type& cvt=codecvt()" default arguments are not used because some
// compilers, such as Microsoft prior to VC++ 10, do not handle defaults correctly
// in templates.
// [defaults] "const codecvt_type& cvt=codecvt()" default arguments are not used
// because some compilers, such as Microsoft prior to VC++ 10, do not handle defaults
// correctly in templates.
// ----- constructors -----
path(){}
path(const path& p) : m_pathname(p.m_pathname) {}
template <class Source>
path(Source const& source,
typename boost::enable_if<path_traits::is_pathable<
@@ -134,9 +135,20 @@ namespace filesystem3
path_traits::dispatch(source, m_pathname, codecvt());
}
// Overloads for the operating system API's native character type. Rationale:
// - Avoids use of codecvt() for native value_type strings. This limits the
// impact of locale("") initialization failures on POSIX systems to programs
// that actually depend on locale(""). It further ensures that exceptions thrown
// as a result of such failues occur after main() has started, so can be caught.
// This is a partial resolution of tickets 4688, 5100, and 5289.
// - A slight optimization for a common use case, particularly on POSIX since
// value_type is char and that is the most common useage.
path(const value_type* s) : m_pathname(s) {}
path(const std::basic_string<value_type>& s) : m_pathname(s) {}
template <class Source>
path(Source const& source, const codecvt_type& cvt)
// see note above explaining why codecvt() default arguments are not used
// see [defaults] note above explaining why codecvt() default arguments are not used
{
path_traits::dispatch(source, m_pathname, cvt);
}
@@ -171,6 +183,12 @@ namespace filesystem3
return *this;
}
path& operator=(const value_type* ptr) // required in case ptr overlaps *this
{
m_pathname = ptr;
return *this;
}
template <class Source>
typename boost::enable_if<path_traits::is_pathable<
typename boost::decay<Source>::type>, path&>::type
@@ -181,6 +199,12 @@ namespace filesystem3
return *this;
}
path& assign(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
{
m_pathname = ptr;
return *this;
}
template <class Source>
path& assign(Source const& source, const codecvt_type& cvt)
{
@@ -215,6 +239,8 @@ namespace filesystem3
path& operator/=(const path& p);
path& operator/=(const value_type* ptr);
template <class Source>
typename boost::enable_if<path_traits::is_pathable<
typename boost::decay<Source>::type>, path&>::type
@@ -223,6 +249,12 @@ namespace filesystem3
return append(source, codecvt());
}
path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
{
this->operator/=(ptr);
return *this;
}
template <class Source>
path& append(Source const& source, const codecvt_type& cvt);
@@ -366,6 +398,16 @@ namespace filesystem3
}
bool is_relative() const { return !is_absolute(); }
// ----- iterators -----
class iterator;
typedef iterator const_iterator;
iterator begin() const;
iterator end() const;
// ----- static members -----
// ----- imbue -----
static std::locale imbue(const std::locale& loc);
@@ -377,14 +419,6 @@ namespace filesystem3
return *wchar_t_codecvt_facet();
}
// ----- iterators -----
class iterator;
typedef iterator const_iterator;
iterator begin() const;
iterator end() const;
// ----- deprecated functions -----
# if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED)
@@ -452,7 +486,6 @@ namespace filesystem3
void m_erase_redundant_separator(string_type::size_type sep_pos);
string_type::size_type m_parent_path_end() const;
void m_portable();
path& m_normalize();
@@ -479,7 +512,7 @@ namespace filesystem3
class path::iterator
: public boost::iterator_facade<
iterator,
path::iterator,
path const,
boost::bidirectional_traversal_tag >
{
@@ -549,18 +582,31 @@ namespace filesystem3
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'\\');
return *l == *rhs;
}
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 std::size_t hash_value(const path& x)
{
std::size_t seed = 0;
for(const path::value_type* it = x.c_str(); *it; ++it)
hash_combine(seed, *it == '/' ? L'\\' : *it);
return seed;
}
# 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 std::size_t hash_value(const path& x)
{
return hash_range(x.native().begin(), x.native().end());
}
# endif
inline bool operator!=(const path& lhs, const path& rhs) { return !(lhs == rhs); }
@@ -582,7 +628,7 @@ namespace filesystem3
operator<<(std::basic_ostream<Char, Traits>& os, const path& p)
{
return os
<< boost::io::quoted(p.string<std::basic_string<Char> >(), static_cast<Char>('&'));
<< boost::io::quoted(p.template string<std::basic_string<Char> >(), static_cast<Char>('&'));
}
template <class Char, class Traits>
@@ -626,14 +672,14 @@ namespace filesystem3
}
template <class Source>
path& path::append(Source const & source, const codecvt_type& cvt)
path& path::append(Source const& source, const codecvt_type& cvt)
{
if (path_traits::empty(source))
return *this;
string_type::size_type sep_pos(m_append_separator_if_needed());
path_traits::dispatch(source, m_pathname, cvt);
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_pathname, cvt);
if (sep_pos)
m_erase_redundant_separator(sep_pos);
return *this;
}

View File

@@ -164,7 +164,7 @@ namespace path_traits {
to += from;
}
// Source dispatch
// Source dispatch -----------------------------------------------------------------//
// contiguous containers
template <class U> inline