diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/filesystem | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/filesystem')
-rw-r--r-- | 3rdParty/Boost/src/boost/filesystem/operations.hpp | 18 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/filesystem/path.hpp | 58 |
2 files changed, 53 insertions, 23 deletions
diff --git a/3rdParty/Boost/src/boost/filesystem/operations.hpp b/3rdParty/Boost/src/boost/filesystem/operations.hpp index 5c2080c..4d52ab7 100644 --- a/3rdParty/Boost/src/boost/filesystem/operations.hpp +++ b/3rdParty/Boost/src/boost/filesystem/operations.hpp @@ -15,6 +15,7 @@ #define BOOST_FILESYSTEM_OPERATIONS_HPP #include <boost/filesystem/path.hpp> +#include <boost/detail/scoped_enum_emulation.hpp> #include <boost/shared_ptr.hpp> #include <boost/utility/enable_if.hpp> @@ -182,7 +183,7 @@ namespace boost BOOST_FILESYSTEM_DECL system::error_code rename_api( const std::string & from, const std::string & to ); BOOST_FILESYSTEM_DECL system::error_code - copy_file_api( const std::string & from, const std::string & to ); + copy_file_api( const std::string & from, const std::string & to, bool fail_if_exists ); # if defined(BOOST_WINDOWS_API) @@ -226,7 +227,7 @@ namespace boost BOOST_FILESYSTEM_DECL system::error_code rename_api( const std::wstring & from, const std::wstring & to ); BOOST_FILESYSTEM_DECL system::error_code - copy_file_api( const std::wstring & from, const std::wstring & to ); + copy_file_api( const std::wstring & from, const std::wstring & to, bool fail_if_exists ); # endif # endif @@ -506,11 +507,16 @@ namespace boost from_path, to_path, ec ) ); } - BOOST_FS_FUNC(void) copy_file( const Path & from_path, const Path & to_path ) + BOOST_SCOPED_ENUM_START(copy_option) + { fail_if_exists, overwrite_if_exists }; + BOOST_SCOPED_ENUM_END + + BOOST_FS_FUNC(void) copy_file( const Path & from_path, const Path & to_path, + BOOST_SCOPED_ENUM(copy_option) option = copy_option::fail_if_exists ) { system::error_code ec( detail::copy_file_api( from_path.external_directory_string(), - to_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::copy_file", @@ -659,9 +665,9 @@ namespace boost { return is_symlink<wpath>( ph ); } inline bool is_empty( const path & ph ) - { return is_empty<path>( ph ); } + { return boost::filesystem::is_empty<path>( ph ); } inline bool is_empty( const wpath & ph ) - { return is_empty<wpath>( ph ); } + { return boost::filesystem::is_empty<wpath>( ph ); } inline bool equivalent( const path & ph1, const path & ph2 ) { return equivalent<path>( ph1, ph2 ); } diff --git a/3rdParty/Boost/src/boost/filesystem/path.hpp b/3rdParty/Boost/src/boost/filesystem/path.hpp index bfb1aab..8f5eaa0 100644 --- a/3rdParty/Boost/src/boost/filesystem/path.hpp +++ b/3rdParty/Boost/src/boost/filesystem/path.hpp @@ -208,6 +208,15 @@ namespace boost basic_path & append( InputIterator first, InputIterator last ); # endif + void clear() + { +# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310) + m_path.clear(); +# else + m_path.erase( m_path.begin(), m_path.end() ); +# endif + } + void swap( basic_path & rhs ) { m_path.swap( rhs.m_path ); @@ -390,42 +399,57 @@ namespace boost lhs.begin(), lhs.end(), tmp.begin(), tmp.end() ); } - // operator == uses string compare rather than !(lhs < rhs) && !(rhs < lhs) because - // the result is the same yet the direct string compare is much more efficient that - // lexicographical_compare, and lexicographical_compare used twice at that. + // operator == uses hand-written compare rather than !(lhs < rhs) && !(rhs < lhs) + // because the result is the same yet the direct compare is much more efficient + // than lexicographical_compare, which would also be called twice. template< class String, class Traits > - inline bool operator==( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) + inline bool operator==( const basic_path<String, Traits> & lhs, + const typename basic_path<String, Traits>::string_type::value_type * rhs ) + { + typedef typename + boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits> path_type; + const typename path_type::string_type::value_type * l (lhs.string().c_str()); + while ( (*l == *rhs +# ifdef BOOST_WINDOWS_PATH + || (*l == path_alt_separator<path_type>::value && *rhs == slash<path_type>::value) + || (*l == slash<path_type>::value && *rhs == path_alt_separator<path_type>::value) +# endif + ) && *l ) { ++l; ++rhs; } + return *l == *rhs +# ifdef BOOST_WINDOWS_PATH + || (*l == path_alt_separator<path_type>::value && *rhs == slash<path_type>::value) + || (*l == slash<path_type>::value && *rhs == path_alt_separator<path_type>::value) +# endif + ; + } + + template< class String, class Traits > + inline bool operator==( const basic_path<String, Traits> & lhs, + const basic_path<String, Traits> & rhs ) { - return lhs.string() == rhs.string(); + return lhs == rhs.string().c_str(); } template< class String, class Traits > inline bool operator==( const typename basic_path<String, Traits>::string_type::value_type * lhs, const basic_path<String, Traits> & rhs ) { - return lhs == rhs.string(); + return rhs == lhs; } template< class String, class Traits > inline bool operator==( const typename basic_path<String, Traits>::string_type & lhs, const basic_path<String, Traits> & rhs ) { - return lhs == rhs.string(); - } - - template< class String, class Traits > - inline bool operator==( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { - return lhs.string() == rhs; + return rhs == lhs.c_str(); } template< class String, class Traits > inline bool operator==( const basic_path<String, Traits> & lhs, const typename basic_path<String, Traits>::string_type & rhs ) { - return lhs.string() == rhs; + return lhs == rhs.c_str(); } template< class String, class Traits > @@ -930,7 +954,7 @@ namespace boost String basic_path<String, Traits>::stem() const { string_type name = filename(); - typename string_type::size_type n = name.rfind('.'); + typename string_type::size_type n = name.rfind(dot<path_type>::value); return name.substr(0, n); } @@ -938,7 +962,7 @@ namespace boost String basic_path<String, Traits>::extension() const { string_type name = filename(); - typename string_type::size_type n = name.rfind('.'); + typename string_type::size_type n = name.rfind(dot<path_type>::value); if (n != string_type::npos) return name.substr(n); else |