imgtools/imglib/boostlibrary/boost/filesystem/path.hpp
author kelvzhu
Thu, 08 Jul 2010 11:07:48 +0800
changeset 611 75fabbc53db5
parent 600 6d08f4a05d93
permissions -rw-r--r--
Release-Update
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     1
//  boost/filesystem/path.hpp  -----------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     2
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     3
//  Copyright Beman Dawes 2002-2005
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     4
//  Copyright Vladimir Prus 2002
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     5
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     6
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     8
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     9
//  See library home page at http://www.boost.org/libs/filesystem
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    10
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    11
//  basic_path's stem(), extension(), and replace_extension() are based on
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    12
//  basename(), extension(), and change_extension() from the original
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    13
//  filesystem/convenience.hpp header by Vladimir Prus.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    14
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    15
//----------------------------------------------------------------------------// 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    16
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    17
#ifndef BOOST_FILESYSTEM_PATH_HPP
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
#define BOOST_FILESYSTEM_PATH_HPP
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
#include <boost/filesystem/config.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
#include <boost/system/system_error.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
#include <boost/iterator/iterator_facade.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
#include <boost/throw_exception.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
#include <boost/shared_ptr.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
#include <boost/type_traits/is_same.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
#include <boost/static_assert.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
#include <string>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
#include <algorithm> // for lexicographical_compare
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
#include <iosfwd>    // needed by basic_path inserter and extractor
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
#include <stdexcept>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
#include <cassert>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
# ifndef BOOST_FILESYSTEM_NARROW_ONLY
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
#   include <locale>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
#include <boost/config/abi_prefix.hpp> // must be the last #include
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
//----------------------------------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
namespace boost
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
  namespace BOOST_FILESYSTEM_NAMESPACE
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
  {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
    template<class String, class Traits> class basic_path;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
    struct path_traits;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
    typedef basic_path< std::string, path_traits > path;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
    struct path_traits
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    53
      typedef std::string internal_string_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    54
      typedef std::string external_string_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    55
      static external_string_type to_external( const path &,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    56
        const internal_string_type & src ) { return src; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    57
      static internal_string_type to_internal(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    58
        const external_string_type & src ) { return src; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    59
    };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    60
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    61
# ifndef BOOST_FILESYSTEM_NARROW_ONLY
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    62
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    63
    struct BOOST_FILESYSTEM_DECL wpath_traits;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    64
    
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    65
    typedef basic_path< std::wstring, wpath_traits > wpath;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    66
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    67
    struct BOOST_FILESYSTEM_DECL wpath_traits
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    68
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    69
      typedef std::wstring internal_string_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    70
# ifdef BOOST_WINDOWS_API
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    71
      typedef std::wstring external_string_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    72
      static external_string_type to_external( const wpath &,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    73
        const internal_string_type & src ) { return src; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    74
      static internal_string_type to_internal(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    75
        const external_string_type & src ) { return src; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    76
# else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    77
      typedef std::string external_string_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    78
      static external_string_type to_external( const wpath & ph,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    79
        const internal_string_type & src );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    80
      static internal_string_type to_internal(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    81
        const external_string_type & src );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    82
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    83
      static void imbue( const std::locale & loc );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    84
      static bool imbue( const std::locale & loc, const std::nothrow_t & );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    85
    };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    86
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    87
# endif // ifndef BOOST_FILESYSTEM_NARROW_ONLY
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    88
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    89
    //  path traits  ---------------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    90
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    91
    template<class Path> struct is_basic_path
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    92
      { BOOST_STATIC_CONSTANT( bool, value = false ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    93
    template<> struct is_basic_path<path>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    94
      { BOOST_STATIC_CONSTANT( bool, value = true ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    95
# ifndef BOOST_FILESYSTEM_NARROW_ONLY
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    96
    template<> struct is_basic_path<wpath>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    97
      { BOOST_STATIC_CONSTANT( bool, value = true ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    98
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    99
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   100
    // These only have to be specialized if Path::string_type::value_type
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   101
    // is not convertible from char, although specializations may eliminate
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   102
    // compiler warnings. See ticket 2543.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   103
    template<class Path> struct slash
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   104
      { BOOST_STATIC_CONSTANT( char, value = '/' ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   105
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   106
    template<class Path> struct dot
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   107
      { BOOST_STATIC_CONSTANT( char, value = '.' ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   108
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   109
    template<class Path> struct colon
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   110
      { BOOST_STATIC_CONSTANT( char, value = ':' ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   111
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   112
# ifndef BOOST_FILESYSTEM_NARROW_ONLY
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   113
    template<> struct slash<wpath>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   114
      { BOOST_STATIC_CONSTANT( wchar_t, value = L'/' ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   115
    template<> struct dot<wpath>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   116
      { BOOST_STATIC_CONSTANT( wchar_t, value = L'.' ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   117
    template<> struct colon<wpath>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   118
      { BOOST_STATIC_CONSTANT( wchar_t, value = L':' ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   119
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   120
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   121
# ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   122
    template<class Path> struct path_alt_separator
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   123
      { BOOST_STATIC_CONSTANT( char, value = '\\' ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   124
#   ifndef BOOST_FILESYSTEM_NARROW_ONLY
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   125
    template<> struct path_alt_separator<wpath>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   126
      { BOOST_STATIC_CONSTANT( wchar_t, value = L'\\' ); };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   127
#   endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   128
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   129
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   130
    //  workaround for VC++ 7.0 and earlier issues with nested classes
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   131
    namespace detail
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   132
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   133
      template<class Path>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   134
      class iterator_helper
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   135
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   136
      public:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   137
        typedef typename Path::iterator iterator;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   138
        static void do_increment( iterator & ph );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   139
        static void do_decrement( iterator & ph );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   140
      };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   141
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   142
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   143
    //  basic_path  ----------------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   144
  
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   145
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   146
    class basic_path
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   147
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   148
    // invariant: m_path valid according to the portable generic path grammar
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   149
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   150
      // validate template arguments
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   151
// TODO: get these working
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   152
//      BOOST_STATIC_ASSERT( ::boost::is_same<String,typename Traits::internal_string_type>::value );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   153
//      BOOST_STATIC_ASSERT( ::boost::is_same<typename Traits::external_string_type,std::string>::value || ::boost::is_same<typename Traits::external_string_type,std::wstring>::value );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   154
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   155
    public:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   156
      // compiler generates copy constructor and copy assignment
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   157
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   158
      typedef basic_path<String, Traits> path_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   159
      typedef String string_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   160
      typedef typename String::value_type value_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   161
      typedef Traits traits_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   162
      typedef typename Traits::external_string_type external_string_type; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   163
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   164
      // constructors/destructor
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   165
      basic_path() {}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   166
      basic_path( const string_type & s ) { operator/=( s ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   167
      basic_path( const value_type * s )  { operator/=( s ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   168
#     ifndef BOOST_NO_MEMBER_TEMPLATES
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   169
        template <class InputIterator>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   170
          basic_path( InputIterator first, InputIterator last )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   171
            { append( first, last ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   172
#     endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   173
     ~basic_path() {}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   174
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   175
      // assignments
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   176
      basic_path & operator=( const string_type & s )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   177
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   178
#     if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   179
        m_path.clear();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   180
#     else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   181
        m_path.erase( m_path.begin(), m_path.end() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   182
#     endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   183
        operator/=( s ); 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   184
        return *this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   185
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   186
      basic_path & operator=( const value_type * s )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   187
      { 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   188
#     if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   189
        m_path.clear();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   190
#     else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   191
        m_path.erase( m_path.begin(), m_path.end() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   192
#     endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   193
        operator/=( s ); 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   194
        return *this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   195
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   196
#     ifndef BOOST_NO_MEMBER_TEMPLATES
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   197
        template <class InputIterator>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   198
          basic_path & assign( InputIterator first, InputIterator last )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   199
            { m_path.clear(); append( first, last ); return *this; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   200
#     endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   201
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   202
      // modifiers
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   203
      basic_path & operator/=( const basic_path & rhs )  { return operator /=( rhs.string().c_str() ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   204
      basic_path & operator/=( const string_type & rhs ) { return operator /=( rhs.c_str() ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   205
      basic_path & operator/=( const value_type * s );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   206
#     ifndef BOOST_NO_MEMBER_TEMPLATES
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   207
        template <class InputIterator>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   208
          basic_path & append( InputIterator first, InputIterator last );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   209
#     endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   210
      
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   211
      void swap( basic_path & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   212
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   213
        m_path.swap( rhs.m_path );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   214
#       ifdef BOOST_CYGWIN_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   215
          std::swap( m_cygwin_root, rhs.m_cygwin_root );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   216
#       endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   217
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   218
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   219
      basic_path & remove_filename();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   220
      basic_path & replace_extension( const string_type & new_extension = string_type() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   221
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   222
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   223
      basic_path & remove_leaf() { return remove_filename(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   224
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   225
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   226
      // observers
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   227
      const string_type & string() const         { return m_path; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   228
      const string_type file_string() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   229
      const string_type directory_string() const { return file_string(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   230
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   231
      const external_string_type external_file_string() const { return Traits::to_external( *this, file_string() ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   232
      const external_string_type external_directory_string() const { return Traits::to_external( *this, directory_string() ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   233
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   234
      basic_path   root_path() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   235
      string_type  root_name() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   236
      string_type  root_directory() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   237
      basic_path   relative_path() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   238
      basic_path   parent_path() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   239
      string_type  filename() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   240
      string_type  stem() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   241
      string_type  extension() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   242
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   243
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   244
      string_type  leaf() const            { return filename(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   245
      basic_path   branch_path() const     { return parent_path(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   246
      bool         has_leaf() const        { return !m_path.empty(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   247
      bool         has_branch_path() const { return !parent_path().empty(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   248
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   249
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   250
      bool empty() const               { return m_path.empty(); } // name consistent with std containers
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   251
      bool is_complete() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   252
      bool has_root_path() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   253
      bool has_root_name() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   254
      bool has_root_directory() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   255
      bool has_relative_path() const   { return !relative_path().empty(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   256
      bool has_filename() const        { return !m_path.empty(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   257
      bool has_parent_path() const     { return !parent_path().empty(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   258
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   259
      // iterators
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   260
      class iterator : public boost::iterator_facade<
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   261
        iterator,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   262
        string_type const,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   263
        boost::bidirectional_traversal_tag >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   264
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   265
      private:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   266
        friend class boost::iterator_core_access;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   267
        friend class boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits>;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   268
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   269
        const string_type & dereference() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   270
          { return m_name; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   271
        bool equal( const iterator & rhs ) const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   272
          { return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   273
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   274
        friend class boost::BOOST_FILESYSTEM_NAMESPACE::detail::iterator_helper<path_type>;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   275
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   276
        void increment()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   277
        { 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   278
          boost::BOOST_FILESYSTEM_NAMESPACE::detail::iterator_helper<path_type>::do_increment(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   279
            *this );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   280
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   281
        void decrement()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   282
        { 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   283
          boost::BOOST_FILESYSTEM_NAMESPACE::detail::iterator_helper<path_type>::do_decrement(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   284
            *this );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   285
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   286
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   287
        string_type             m_name;     // current element
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   288
        const basic_path *      m_path_ptr; // path being iterated over
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   289
        typename string_type::size_type  m_pos;  // position of name in
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   290
                                            // path_ptr->string(). The
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   291
                                            // end() iterator is indicated by 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   292
                                            // pos == path_ptr->m_path.size()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   293
      }; // iterator
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   294
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   295
      typedef iterator const_iterator;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   296
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   297
      iterator begin() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   298
      iterator end() const;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   299
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   300
    private:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   301
      // Note: This is an implementation for POSIX and Windows, where there
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   302
      // are only minor differences between generic and native path grammars.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   303
      // Private members might be quite different in other implementations,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   304
      // particularly where there were wide differences between portable and
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   305
      // native path formats, or between file_string() and
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   306
      // directory_string() formats, or simply that the implementation
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   307
      // was willing expend additional memory to achieve greater speed for
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   308
      // some operations at the expense of other operations.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   309
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   310
      string_type  m_path; // invariant: portable path grammar
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   311
                           // on Windows, backslashes converted to slashes
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   312
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   313
#   ifdef BOOST_CYGWIN_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   314
      bool m_cygwin_root; // if present, m_path[0] was slash. note: initialization
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   315
                          // done by append
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   316
#   endif  
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   317
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   318
      void m_append_separator_if_needed();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   319
      void m_append( value_type value ); // converts Windows alt_separator
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   320
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   321
      // Was qualified; como433beta8 reports:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   322
      //    warning #427-D: qualified name is not allowed in member declaration 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   323
      friend class iterator;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   324
      friend class boost::BOOST_FILESYSTEM_NAMESPACE::detail::iterator_helper<path_type>;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   325
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   326
      // Deprecated features ease transition for existing code. Don't use these
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   327
      // in new code.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   328
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   329
    public:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   330
      typedef bool (*name_check)( const std::string & name );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   331
      basic_path( const string_type & str, name_check ) { operator/=( str ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   332
      basic_path( const typename string_type::value_type * s, name_check )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   333
        { operator/=( s );}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   334
      string_type native_file_string() const { return file_string(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   335
      string_type native_directory_string() const { return directory_string(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   336
      static bool default_name_check_writable() { return false; } 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   337
      static void default_name_check( name_check ) {}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   338
      static name_check default_name_check() { return 0; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   339
      basic_path & canonize();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   340
      basic_path & normalize();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   341
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   342
    };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   343
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   344
  //  basic_path non-member functions  ---------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   345
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   346
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   347
    inline void swap( basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   348
               basic_path<String, Traits> & rhs ) { lhs.swap( rhs ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   349
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   350
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   351
    bool operator<( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   352
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   353
      return std::lexicographical_compare(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   354
        lhs.begin(), lhs.end(), rhs.begin(), rhs.end() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   355
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   356
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   357
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   358
    bool operator<( const typename basic_path<String, Traits>::string_type::value_type * lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   359
                    const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   360
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   361
      basic_path<String, Traits> tmp( lhs );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   362
      return std::lexicographical_compare(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   363
        tmp.begin(), tmp.end(), rhs.begin(), rhs.end() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   364
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   365
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   366
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   367
    bool operator<( const typename basic_path<String, Traits>::string_type & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   368
                    const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   369
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   370
      basic_path<String, Traits> tmp( lhs );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   371
      return std::lexicographical_compare(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   372
        tmp.begin(), tmp.end(), rhs.begin(), rhs.end() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   373
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   374
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   375
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   376
    bool operator<( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   377
                    const typename basic_path<String, Traits>::string_type::value_type * rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   378
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   379
      basic_path<String, Traits> tmp( rhs );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   380
      return std::lexicographical_compare(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   381
        lhs.begin(), lhs.end(), tmp.begin(), tmp.end() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   382
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   383
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   384
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   385
    bool operator<( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   386
                    const typename basic_path<String, Traits>::string_type & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   387
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   388
      basic_path<String, Traits> tmp( rhs );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   389
      return std::lexicographical_compare(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   390
        lhs.begin(), lhs.end(), tmp.begin(), tmp.end() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   391
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   392
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   393
    //  operator == uses string compare rather than !(lhs < rhs) && !(rhs < lhs) because
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   394
    //  the result is the same yet the direct string compare is much more efficient that
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   395
    //  lexicographical_compare, and lexicographical_compare used twice at that.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   396
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   397
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   398
    inline bool operator==( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   399
    { 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   400
      return lhs.string() == rhs.string();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   401
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   402
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   403
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   404
    inline bool operator==( const typename basic_path<String, Traits>::string_type::value_type * lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   405
                    const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   406
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   407
      return lhs == rhs.string();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   408
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   409
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   410
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   411
    inline bool operator==( const typename basic_path<String, Traits>::string_type & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   412
                    const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   413
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   414
      return lhs == rhs.string();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   415
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   416
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   417
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   418
    inline bool operator==( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   419
                    const typename basic_path<String, Traits>::string_type::value_type * rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   420
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   421
      return lhs.string() == rhs;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   422
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   423
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   424
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   425
    inline bool operator==( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   426
                    const typename basic_path<String, Traits>::string_type & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   427
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   428
      return lhs.string() == rhs;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   429
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   430
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   431
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   432
    inline bool operator!=( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   433
      const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   434
        { return !(lhs == rhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   435
    
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   436
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   437
    inline bool operator!=( const typename basic_path<String,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   438
      Traits>::string_type::value_type * lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   439
        const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   440
        { return !(lhs == rhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   441
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   442
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   443
    inline bool operator!=( const typename basic_path<String, Traits>::string_type & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   444
      const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   445
        { return !(lhs == rhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   446
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   447
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   448
    inline bool operator!=( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   449
      const typename basic_path<String, Traits>::string_type::value_type * rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   450
        { return !(lhs == rhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   451
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   452
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   453
    inline bool operator!=( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   454
      const typename basic_path<String, Traits>::string_type & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   455
        { return !(lhs == rhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   456
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   457
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   458
    inline bool operator>( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return rhs < lhs; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   459
    
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   460
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   461
    inline bool operator>( const typename basic_path<String, Traits>::string_type::value_type * lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   462
                    const basic_path<String, Traits> & rhs ) { return rhs < basic_path<String, Traits>(lhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   463
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   464
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   465
    inline bool operator>( const typename basic_path<String, Traits>::string_type & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   466
                    const basic_path<String, Traits> & rhs ) { return rhs < basic_path<String, Traits>(lhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   467
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   468
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   469
    inline bool operator>( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   470
                    const typename basic_path<String, Traits>::string_type::value_type * rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   471
                    { return basic_path<String, Traits>(rhs) < lhs; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   472
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   473
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   474
    inline bool operator>( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   475
                    const typename basic_path<String, Traits>::string_type & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   476
                    { return basic_path<String, Traits>(rhs) < lhs; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   477
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   478
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   479
    inline bool operator<=( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return !(rhs < lhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   480
    
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   481
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   482
    inline bool operator<=( const typename basic_path<String, Traits>::string_type::value_type * lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   483
                    const basic_path<String, Traits> & rhs ) { return !(rhs < basic_path<String, Traits>(lhs)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   484
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   485
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   486
    inline bool operator<=( const typename basic_path<String, Traits>::string_type & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   487
                    const basic_path<String, Traits> & rhs ) { return !(rhs < basic_path<String, Traits>(lhs)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   488
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   489
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   490
    inline bool operator<=( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   491
                    const typename basic_path<String, Traits>::string_type::value_type * rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   492
                    { return !(basic_path<String, Traits>(rhs) < lhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   493
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   494
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   495
    inline bool operator<=( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   496
                    const typename basic_path<String, Traits>::string_type & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   497
                    { return !(basic_path<String, Traits>(rhs) < lhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   498
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   499
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   500
    inline bool operator>=( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return !(lhs < rhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   501
    
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   502
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   503
    inline bool operator>=( const typename basic_path<String, Traits>::string_type::value_type * lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   504
                    const basic_path<String, Traits> & rhs ) { return !(lhs < basic_path<String, Traits>(rhs)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   505
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   506
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   507
    inline bool operator>=( const typename basic_path<String, Traits>::string_type & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   508
                    const basic_path<String, Traits> & rhs ) { return !(lhs < basic_path<String, Traits>(rhs)); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   509
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   510
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   511
    inline bool operator>=( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   512
                    const typename basic_path<String, Traits>::string_type::value_type * rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   513
                    { return !(basic_path<String, Traits>(lhs) < rhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   514
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   515
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   516
    inline bool operator>=( const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   517
                    const typename basic_path<String, Traits>::string_type & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   518
                    { return !(basic_path<String, Traits>(lhs) < rhs); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   519
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   520
    // operator /
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   521
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   522
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   523
    inline basic_path<String, Traits> operator/( 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   524
      const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   525
      const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   526
      { return basic_path<String, Traits>( lhs ) /= rhs; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   527
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   528
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   529
    inline basic_path<String, Traits> operator/( 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   530
      const basic_path<String, Traits> & lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   531
      const typename String::value_type * rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   532
      { return basic_path<String, Traits>( lhs ) /=
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   533
          basic_path<String, Traits>( rhs ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   534
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   535
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   536
    inline basic_path<String, Traits> operator/( 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   537
      const basic_path<String, Traits> & lhs, const String & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   538
      { return basic_path<String, Traits>( lhs ) /=
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   539
          basic_path<String, Traits>( rhs ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   540
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   541
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   542
    inline basic_path<String, Traits> operator/( 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   543
      const typename String::value_type * lhs,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   544
      const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   545
      { return basic_path<String, Traits>( lhs ) /= rhs; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   546
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   547
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   548
    inline basic_path<String, Traits> operator/(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   549
      const String & lhs, const basic_path<String, Traits> & rhs )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   550
      { return basic_path<String, Traits>( lhs ) /= rhs; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   551
   
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   552
    //  inserters and extractors  --------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   553
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   554
// bypass VC++ 7.0 and earlier, and broken Borland compilers
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   555
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__BORLANDC__, < 0x610)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   556
    template< class Path >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   557
    std::basic_ostream< typename Path::string_type::value_type,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   558
      typename Path::string_type::traits_type > &
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   559
      operator<<
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   560
      ( std::basic_ostream< typename Path::string_type::value_type,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   561
      typename Path::string_type::traits_type >& os, const Path & ph )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   562
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   563
      os << ph.string();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   564
      return os;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   565
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   566
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   567
    template< class Path >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   568
    std::basic_istream< typename Path::string_type::value_type,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   569
      typename Path::string_type::traits_type > &
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   570
      operator>>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   571
      ( std::basic_istream< typename Path::string_type::value_type,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   572
      typename Path::string_type::traits_type >& is, Path & ph )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   573
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   574
      typename Path::string_type str;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   575
      is >> str;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   576
      ph = str;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   577
      return is;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   578
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   579
# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   580
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   581
    std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   582
      BOOST_DEDUCED_TYPENAME String::traits_type > &
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   583
      operator<<
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   584
      ( std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   585
          BOOST_DEDUCED_TYPENAME String::traits_type >& os, 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   586
        const basic_path< String, Traits > & ph )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   587
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   588
      os << ph.string();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   589
      return os;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   590
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   591
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   592
    template< class String, class Traits >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   593
    std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type, 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   594
      BOOST_DEDUCED_TYPENAME String::traits_type > &
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   595
      operator>>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   596
      ( std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   597
          BOOST_DEDUCED_TYPENAME String::traits_type> & is,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   598
        basic_path< String, Traits > & ph )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   599
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   600
      String str;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   601
      is >> str;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   602
      ph = str;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   603
      return is;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   604
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   605
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   606
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   607
    //  basic_filesystem_error helpers  --------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   608
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   609
    //  Originally choice of implementation was done via specialization of
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   610
    //  basic_filesystem_error::what(). Several compilers (GCC, aCC, etc.)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   611
    //  couldn't handle that, so the choice is now accomplished by overloading.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   612
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   613
    namespace detail
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   614
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   615
      // BOOST_FILESYSTEM_DECL version works for VC++ but not GCC. Go figure!
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   616
      inline
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   617
      const char * what( const char * sys_err_what,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   618
        const path & path1_arg, const path & path2_arg, std::string & target )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   619
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   620
        try
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   621
        {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   622
          if ( target.empty() )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   623
          {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   624
            target = sys_err_what;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   625
            if ( !path1_arg.empty() )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   626
            {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   627
              target += ": \"";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   628
              target += path1_arg.file_string();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   629
              target += "\"";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   630
            }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   631
            if ( !path2_arg.empty() )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   632
            {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   633
              target += ", \"";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   634
              target += path2_arg.file_string();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   635
              target += "\"";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   636
            }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   637
          }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   638
          return target.c_str();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   639
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   640
        catch (...)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   641
        {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   642
          return sys_err_what;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   643
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   644
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   645
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   646
      template<class Path>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   647
      const char * what( const char * sys_err_what,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   648
        const Path & /*path1_arg*/, const Path & /*path2_arg*/, std::string & /*target*/ )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   649
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   650
        return sys_err_what;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   651
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   652
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   653
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   654
    //  basic_filesystem_error  ----------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   655
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   656
    template<class Path>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   657
    class basic_filesystem_error : public system::system_error
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   658
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   659
    // see http://www.boost.org/more/error_handling.html for design rationale
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   660
    public:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   661
      // compiler generates copy constructor and copy assignment
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   662
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   663
      typedef Path path_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   664
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   665
      basic_filesystem_error( const std::string & what_arg,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   666
        system::error_code ec );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   667
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   668
      basic_filesystem_error( const std::string & what_arg,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   669
        const path_type & path1_arg, system::error_code ec );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   670
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   671
      basic_filesystem_error( const std::string & what_arg, const path_type & path1_arg,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   672
        const path_type & path2_arg, system::error_code ec );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   673
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   674
      ~basic_filesystem_error() throw() {}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   675
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   676
      const path_type & path1() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   677
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   678
        static const path_type empty_path;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   679
        return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   680
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   681
      const path_type & path2() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   682
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   683
        static const path_type empty_path;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   684
        return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   685
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   686
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   687
      const char * what() const throw()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   688
      { 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   689
        if ( !m_imp_ptr.get() )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   690
          return system::system_error::what();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   691
        return detail::what( system::system_error::what(), m_imp_ptr->m_path1,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   692
          m_imp_ptr->m_path2, m_imp_ptr->m_what );  
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   693
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   694
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   695
    private:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   696
      struct m_imp
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   697
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   698
        path_type                 m_path1; // may be empty()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   699
        path_type                 m_path2; // may be empty()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   700
        std::string               m_what;  // not built until needed
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   701
      };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   702
      boost::shared_ptr<m_imp> m_imp_ptr;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   703
    };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   704
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   705
    typedef basic_filesystem_error<path> filesystem_error;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   706
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   707
# ifndef BOOST_FILESYSTEM_NARROW_ONLY
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   708
    typedef basic_filesystem_error<wpath> wfilesystem_error;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   709
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   710
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   711
  //  path::name_checks  -----------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   712
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   713
    BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   714
    BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   715
    BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   716
    BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   717
    BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   718
    BOOST_FILESYSTEM_DECL bool native( const std::string & name );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   719
    inline bool no_check( const std::string & )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   720
      { return true; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   721
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   722
// implementation  -----------------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   723
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   724
    namespace detail
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   725
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   726
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   727
      //  is_separator helper ------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   728
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   729
      template<class Path>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   730
      inline  bool is_separator( typename Path::string_type::value_type c )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   731
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   732
        return c == slash<Path>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   733
#     ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   734
          || c == path_alt_separator<Path>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   735
#     endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   736
          ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   737
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   738
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   739
      // filename_pos helper  ----------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   740
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   741
      template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   742
      typename String::size_type filename_pos(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   743
        const String & str, // precondition: portable generic path grammar
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   744
        typename String::size_type end_pos ) // end_pos is past-the-end position
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   745
      // return 0 if str itself is filename (or empty)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   746
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   747
        typedef typename
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   748
          boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits> path_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   749
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   750
        // case: "//"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   751
        if ( end_pos == 2 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   752
          && str[0] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   753
          && str[1] == slash<path_type>::value ) return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   754
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   755
        // case: ends in "/"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   756
        if ( end_pos && str[end_pos-1] == slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   757
          return end_pos-1;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   758
        
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   759
        // set pos to start of last element
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   760
        typename String::size_type pos(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   761
          str.find_last_of( slash<path_type>::value, end_pos-1 ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   762
#       ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   763
        if ( pos == String::npos )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   764
          pos = str.find_last_of( path_alt_separator<path_type>::value, end_pos-1 );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   765
        if ( pos == String::npos )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   766
          pos = str.find_last_of( colon<path_type>::value, end_pos-2 );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   767
#       endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   768
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   769
        return ( pos == String::npos // path itself must be a filename (or empty)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   770
          || (pos == 1 && str[0] == slash<path_type>::value) ) // or net
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   771
            ? 0 // so filename is entire string
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   772
            : pos + 1; // or starts after delimiter
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   773
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   774
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   775
      // first_element helper  -----------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   776
      //   sets pos and len of first element, excluding extra separators
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   777
      //   if src.empty(), sets pos,len, to 0,0.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   778
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   779
      template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   780
        void first_element(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   781
          const String & src, // precondition: portable generic path grammar
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   782
          typename String::size_type & element_pos,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   783
          typename String::size_type & element_size,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   784
#       if !BOOST_WORKAROUND( BOOST_MSVC, <= 1310 ) // VC++ 7.1
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   785
          typename String::size_type size = String::npos
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   786
#       else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   787
          typename String::size_type size = -1
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   788
#       endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   789
          )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   790
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   791
        if ( size == String::npos ) size = src.size();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   792
        element_pos = 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   793
        element_size = 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   794
        if ( src.empty() ) return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   795
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   796
        typedef typename boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits> path_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   797
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   798
        typename String::size_type cur(0);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   799
        
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   800
        // deal with // [network]
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   801
        if ( size >= 2 && src[0] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   802
          && src[1] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   803
          && (size == 2
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   804
            || src[2] != slash<path_type>::value) )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   805
        { 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   806
          cur += 2;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   807
          element_size += 2;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   808
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   809
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   810
        // leading (not non-network) separator
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   811
        else if ( src[0] == slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   812
        {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   813
          ++element_size;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   814
          // bypass extra leading separators
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   815
          while ( cur+1 < size
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   816
            && src[cur+1] == slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   817
          {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   818
            ++cur;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   819
            ++element_pos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   820
          }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   821
          return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   822
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   823
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   824
        // at this point, we have either a plain name, a network name,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   825
        // or (on Windows only) a device name
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   826
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   827
        // find the end
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   828
        while ( cur < size
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   829
#         ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   830
          && src[cur] != colon<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   831
#         endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   832
          && src[cur] != slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   833
        {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   834
          ++cur;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   835
          ++element_size;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   836
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   837
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   838
#       ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   839
        if ( cur == size ) return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   840
        // include device delimiter
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   841
        if ( src[cur] == colon<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   842
          { ++element_size; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   843
#       endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   844
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   845
        return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   846
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   847
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   848
      // root_directory_start helper  ----------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   849
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   850
      template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   851
      typename String::size_type root_directory_start(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   852
        const String & s, // precondition: portable generic path grammar
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   853
        typename String::size_type size )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   854
      // return npos if no root_directory found
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   855
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   856
        typedef typename boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits> path_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   857
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   858
#     ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   859
        // case "c:/"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   860
        if ( size > 2
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   861
          && s[1] == colon<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   862
          && s[2] == slash<path_type>::value ) return 2;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   863
#     endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   864
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   865
        // case "//"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   866
        if ( size == 2
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   867
          && s[0] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   868
          && s[1] == slash<path_type>::value ) return String::npos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   869
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   870
        // case "//net {/}"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   871
        if ( size > 3
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   872
          && s[0] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   873
          && s[1] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   874
          && s[2] != slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   875
        {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   876
          typename String::size_type pos(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   877
            s.find( slash<path_type>::value, 2 ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   878
          return pos < size ? pos : String::npos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   879
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   880
        
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   881
        // case "/"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   882
        if ( size > 0 && s[0] == slash<path_type>::value ) return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   883
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   884
        return String::npos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   885
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   886
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   887
      // is_non_root_slash helper  -------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   888
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   889
      template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   890
      bool is_non_root_slash( const String & str,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   891
        typename String::size_type pos ) // pos is position of the slash
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   892
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   893
        typedef typename
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   894
          boost::BOOST_FILESYSTEM_NAMESPACE::basic_path<String, Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   895
            path_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   896
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   897
        assert( !str.empty() && str[pos] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   898
          && "precondition violation" );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   899
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   900
        // subsequent logic expects pos to be for leftmost slash of a set
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   901
        while ( pos > 0 && str[pos-1] == slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   902
          --pos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   903
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   904
        return  pos != 0
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   905
          && (pos <= 2 || str[1] != slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   906
            || str.find( slash<path_type>::value, 2 ) != pos)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   907
#       ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   908
          && (pos !=2 || str[1] != colon<path_type>::value)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   909
#       endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   910
            ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   911
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   912
    } // namespace detail
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   913
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   914
    // decomposition functions  ----------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   915
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   916
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   917
    String basic_path<String, Traits>::filename() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   918
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   919
      typename String::size_type end_pos(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   920
        detail::filename_pos<String, Traits>( m_path, m_path.size() ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   921
      return (m_path.size()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   922
                && end_pos
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   923
                && m_path[end_pos] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   924
                && detail::is_non_root_slash< String, Traits >(m_path, end_pos))
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   925
        ? String( 1, dot<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   926
        : m_path.substr( end_pos );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   927
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   928
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   929
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   930
    String basic_path<String, Traits>::stem() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   931
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   932
      string_type name = filename();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   933
      typename string_type::size_type n = name.rfind('.');
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   934
      return name.substr(0, n);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   935
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   936
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   937
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   938
    String basic_path<String, Traits>::extension() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   939
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   940
      string_type name = filename();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   941
      typename string_type::size_type n = name.rfind('.');
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   942
      if (n != string_type::npos)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   943
        return name.substr(n);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   944
      else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   945
        return string_type();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   946
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   947
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   948
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   949
    basic_path<String, Traits> basic_path<String, Traits>::parent_path() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   950
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   951
      typename String::size_type end_pos(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   952
        detail::filename_pos<String, Traits>( m_path, m_path.size() ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   953
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   954
      bool filename_was_separator( m_path.size()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   955
        && m_path[end_pos] == slash<path_type>::value );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   956
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   957
      // skip separators unless root directory
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   958
      typename string_type::size_type root_dir_pos( detail::root_directory_start
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   959
        <string_type, traits_type>( m_path, end_pos ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   960
      for ( ; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   961
        end_pos > 0
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   962
        && (end_pos-1) != root_dir_pos
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   963
        && m_path[end_pos-1] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   964
        ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   965
        --end_pos ) {}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   966
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   967
     return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   968
       ? path_type()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   969
       : path_type( m_path.substr( 0, end_pos ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   970
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   971
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   972
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   973
    basic_path<String, Traits> basic_path<String, Traits>::relative_path() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   974
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   975
      iterator itr( begin() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   976
      for ( ; itr.m_pos != m_path.size()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   977
          && (itr.m_name[0] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   978
#     ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   979
          || itr.m_name[itr.m_name.size()-1]
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   980
            == colon<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   981
#     endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   982
             ); ++itr ) {}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   983
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   984
      return basic_path<String, Traits>( m_path.substr( itr.m_pos ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   985
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   986
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   987
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   988
    String basic_path<String, Traits>::root_name() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   989
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   990
      iterator itr( begin() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   991
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   992
      return ( itr.m_pos != m_path.size()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   993
        && (
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   994
            ( itr.m_name.size() > 1
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   995
              && itr.m_name[0] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   996
              && itr.m_name[1] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   997
            )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   998
#     ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   999
          || itr.m_name[itr.m_name.size()-1]
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1000
            == colon<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1001
#     endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1002
           ) )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1003
        ? *itr
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1004
        : String();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1005
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1006
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1007
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1008
    String basic_path<String, Traits>::root_directory() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1009
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1010
      typename string_type::size_type start(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1011
        detail::root_directory_start<String, Traits>( m_path, m_path.size() ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1012
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1013
      return start == string_type::npos
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1014
        ? string_type()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1015
        : m_path.substr( start, 1 );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1016
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1017
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1018
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1019
    basic_path<String, Traits> basic_path<String, Traits>::root_path() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1020
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1021
      // even on POSIX, root_name() is non-empty() on network paths
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1022
      return basic_path<String, Traits>( root_name() ) /= root_directory();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1023
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1024
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1025
    // path query functions  -------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1026
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1027
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1028
    inline bool basic_path<String, Traits>::is_complete() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1029
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1030
#   ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1031
      return has_root_name() && has_root_directory();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1032
#   else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1033
      return has_root_directory();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1034
#   endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1035
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1036
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1037
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1038
    inline bool basic_path<String, Traits>::has_root_path() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1039
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1040
      return !root_path().empty();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1041
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1042
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1043
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1044
    inline bool basic_path<String, Traits>::has_root_name() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1045
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1046
      return !root_name().empty();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1047
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1048
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1049
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1050
    inline bool basic_path<String, Traits>::has_root_directory() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1051
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1052
      return !root_directory().empty();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1053
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1054
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1055
    // append  ---------------------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1056
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1057
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1058
    void basic_path<String, Traits>::m_append_separator_if_needed()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1059
    // requires: !empty()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1060
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1061
      if (
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1062
#       ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1063
        *(m_path.end()-1) != colon<path_type>::value && 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1064
#       endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1065
        *(m_path.end()-1) != slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1066
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1067
        m_path += slash<path_type>::value;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1068
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1069
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1070
      
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1071
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1072
    void basic_path<String, Traits>::m_append( value_type value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1073
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1074
#   ifdef BOOST_CYGWIN_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1075
      if ( m_path.empty() ) m_cygwin_root = (value == slash<path_type>::value);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1076
#   endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1077
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1078
#   ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1079
      // for BOOST_WINDOWS_PATH, convert alt_separator ('\') to separator ('/')
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1080
      m_path += ( value == path_alt_separator<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1081
        ? slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1082
        : value );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1083
#   else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1084
      m_path += value;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1085
#   endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1086
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1087
    
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1088
    // except that it wouldn't work for BOOST_NO_MEMBER_TEMPLATES compilers,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1089
    // the append() member template could replace this code.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1090
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1091
    basic_path<String, Traits> & basic_path<String, Traits>::operator /=
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1092
      ( const value_type * next_p )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1093
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1094
      // ignore escape sequence on POSIX or Windows
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1095
      if ( *next_p == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1096
        && *(next_p+1) == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1097
        && *(next_p+2) == colon<path_type>::value ) next_p += 3;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1098
      
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1099
      // append slash<path_type>::value if needed
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1100
      if ( !empty() && *next_p != 0
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1101
        && !detail::is_separator<path_type>( *next_p ) )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1102
      { m_append_separator_if_needed(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1103
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1104
      for ( ; *next_p != 0; ++next_p ) m_append( *next_p );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1105
      return *this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1106
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1107
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1108
# ifndef BOOST_NO_MEMBER_TEMPLATES
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1109
    template<class String, class Traits> template <class InputIterator>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1110
      basic_path<String, Traits> & basic_path<String, Traits>::append(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1111
        InputIterator first, InputIterator last )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1112
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1113
      // append slash<path_type>::value if needed
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1114
      if ( !empty() && first != last
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1115
        && !detail::is_separator<path_type>( *first ) )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1116
      { m_append_separator_if_needed(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1117
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1118
      // song-and-dance to avoid violating InputIterator requirements
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1119
      // (which prohibit lookahead) in detecting a possible escape sequence
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1120
      // (escape sequences are simply ignored on POSIX and Windows)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1121
      bool was_escape_sequence(true);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1122
      std::size_t append_count(0);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1123
      typename String::size_type initial_pos( m_path.size() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1124
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1125
      for ( ; first != last && *first; ++first )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1126
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1127
        if ( append_count == 0 && *first != slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1128
          was_escape_sequence = false;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1129
        if ( append_count == 1 && *first != slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1130
          was_escape_sequence = false;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1131
        if ( append_count == 2 && *first != colon<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1132
          was_escape_sequence = false;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1133
        m_append( *first );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1134
        ++append_count;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1135
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1136
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1137
      // erase escape sequence if any
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1138
      if ( was_escape_sequence && append_count >= 3 )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1139
        m_path.erase( initial_pos, 3 );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1140
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1141
      return *this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1142
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1143
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1144
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1145
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1146
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1147
    // canonize  ------------------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1148
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1149
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1150
    basic_path<String, Traits> & basic_path<String, Traits>::canonize()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1151
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1152
      static const typename string_type::value_type dot_str[]
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1153
        = { dot<path_type>::value, 0 };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1154
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1155
      if ( m_path.empty() ) return *this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1156
        
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1157
      path_type temp;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1158
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1159
      for ( iterator itr( begin() ); itr != end(); ++itr )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1160
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1161
        temp /= *itr;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1162
      };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1163
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1164
      if ( temp.empty() ) temp /= dot_str;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1165
      m_path = temp.m_path;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1166
      return *this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1167
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1168
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1169
    // normalize  ------------------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1170
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1171
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1172
    basic_path<String, Traits> & basic_path<String, Traits>::normalize()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1173
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1174
      static const typename string_type::value_type dot_str[]
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1175
        = { dot<path_type>::value, 0 };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1176
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1177
      if ( m_path.empty() ) return *this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1178
        
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1179
      path_type temp;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1180
      iterator start( begin() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1181
      iterator last( end() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1182
      iterator stop( last-- );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1183
      for ( iterator itr( start ); itr != stop; ++itr )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1184
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1185
        // ignore "." except at start and last
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1186
        if ( itr->size() == 1
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1187
          && (*itr)[0] == dot<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1188
          && itr != start
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1189
          && itr != last ) continue;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1190
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1191
        // ignore a name and following ".."
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1192
        if ( !temp.empty()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1193
          && itr->size() == 2
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1194
          && (*itr)[0] == dot<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1195
          && (*itr)[1] == dot<path_type>::value ) // dot dot
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1196
        {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1197
          string_type lf( temp.filename() );  
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1198
          if ( lf.size() > 0  
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1199
            && (lf.size() != 1
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1200
              || (lf[0] != dot<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1201
                && lf[0] != slash<path_type>::value))
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1202
            && (lf.size() != 2 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1203
              || (lf[0] != dot<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1204
                && lf[1] != dot<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1205
#             ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1206
                && lf[1] != colon<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1207
#             endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1208
                 )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1209
               )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1210
            )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1211
          {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1212
            temp.remove_filename();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1213
            // if not root directory, must also remove "/" if any
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1214
            if ( temp.m_path.size() > 0
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1215
              && temp.m_path[temp.m_path.size()-1]
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1216
                == slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1217
            {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1218
              typename string_type::size_type rds(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1219
                detail::root_directory_start<String,Traits>( temp.m_path,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1220
                  temp.m_path.size() ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1221
              if ( rds == string_type::npos
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1222
                || rds != temp.m_path.size()-1 ) 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1223
                { temp.m_path.erase( temp.m_path.size()-1 ); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1224
            }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1225
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1226
            iterator next( itr );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1227
            if ( temp.empty() && ++next != stop
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1228
              && next == last && *last == dot_str ) temp /= dot_str;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1229
            continue;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1230
          }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1231
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1232
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1233
        temp /= *itr;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1234
      };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1235
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1236
      if ( temp.empty() ) temp /= dot_str;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1237
      m_path = temp.m_path;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1238
      return *this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1239
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1240
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1241
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1242
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1243
    // modifiers  ------------------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1244
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1245
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1246
    basic_path<String, Traits> & basic_path<String, Traits>::remove_filename()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1247
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1248
      m_path.erase(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1249
        detail::filename_pos<String, Traits>( m_path, m_path.size() ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1250
      return *this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1251
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1252
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1253
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1254
    basic_path<String, Traits> &
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1255
    basic_path<String, Traits>::replace_extension( const string_type & new_ext )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1256
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1257
      // erase existing extension if any
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1258
      string_type old_ext = extension();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1259
      if ( !old_ext.empty() )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1260
        m_path.erase( m_path.size() - old_ext.size() );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1261
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1262
      if ( !new_ext.empty() && new_ext[0] != dot<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1263
        m_path += dot<path_type>::value;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1264
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1265
      m_path += new_ext;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1266
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1267
      return *this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1268
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1269
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1270
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1271
    // path conversion functions  --------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1272
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1273
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1274
    const String
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1275
    basic_path<String, Traits>::file_string() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1276
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1277
#   ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1278
      // for Windows, use the alternate separator, and bypass extra 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1279
      // root separators
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1280
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1281
      typename string_type::size_type root_dir_start(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1282
        detail::root_directory_start<String, Traits>( m_path, m_path.size() ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1283
      bool in_root( root_dir_start != string_type::npos );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1284
      String s;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1285
      for ( typename string_type::size_type pos( 0 );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1286
        pos != m_path.size(); ++pos )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1287
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1288
        // special case // [net]
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1289
        if ( pos == 0 && m_path.size() > 1
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1290
          && m_path[0] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1291
          && m_path[1] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1292
          && ( m_path.size() == 2 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1293
            || !detail::is_separator<path_type>( m_path[2] )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1294
             ) )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1295
        {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1296
          ++pos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1297
          s += path_alt_separator<path_type>::value;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1298
          s += path_alt_separator<path_type>::value;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1299
          continue;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1300
        }   
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1301
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1302
        // bypass extra root separators
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1303
        if ( in_root )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1304
        { 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1305
          if ( s.size() > 0
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1306
            && s[s.size()-1] == path_alt_separator<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1307
            && m_path[pos] == slash<path_type>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1308
            ) continue;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1309
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1310
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1311
        if ( m_path[pos] == slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1312
          s += path_alt_separator<path_type>::value;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1313
        else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1314
          s += m_path[pos];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1315
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1316
        if ( pos > root_dir_start
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1317
          && m_path[pos] == slash<path_type>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1318
          { in_root = false; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1319
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1320
#   ifdef BOOST_CYGWIN_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1321
      if ( m_cygwin_root ) s[0] = slash<path_type>::value;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1322
#   endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1323
      return s;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1324
#   else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1325
      return m_path;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1326
#   endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1327
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1328
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1329
    // iterator functions  ---------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1330
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1331
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1332
    typename basic_path<String, Traits>::iterator basic_path<String, Traits>::begin() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1333
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1334
      iterator itr;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1335
      itr.m_path_ptr = this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1336
      typename string_type::size_type element_size;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1337
      detail::first_element<String, Traits>( m_path, itr.m_pos, element_size );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1338
      itr.m_name = m_path.substr( itr.m_pos, element_size );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1339
      return itr;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1340
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1341
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1342
    template<class String, class Traits>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1343
    typename basic_path<String, Traits>::iterator basic_path<String, Traits>::end() const
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1344
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1345
        iterator itr;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1346
        itr.m_path_ptr = this;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1347
        itr.m_pos = m_path.size();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1348
        return itr;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1349
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1350
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1351
    namespace detail
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1352
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1353
      //  do_increment  ------------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1354
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1355
      template<class Path>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1356
      void iterator_helper<Path>::do_increment( iterator & itr )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1357
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1358
        typedef typename Path::string_type string_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1359
        typedef typename Path::traits_type traits_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1360
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1361
        assert( itr.m_pos < itr.m_path_ptr->m_path.size() && "basic_path::iterator increment past end()" );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1362
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1363
        bool was_net( itr.m_name.size() > 2
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1364
          && itr.m_name[0] == slash<Path>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1365
          && itr.m_name[1] == slash<Path>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1366
          && itr.m_name[2] != slash<Path>::value );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1367
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1368
        // increment to position past current element
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1369
        itr.m_pos += itr.m_name.size();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1370
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1371
        // if end reached, create end iterator
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1372
        if ( itr.m_pos == itr.m_path_ptr->m_path.size() )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1373
        {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1374
          itr.m_name.erase( itr.m_name.begin(), itr.m_name.end() ); // VC++ 6.0 lib didn't supply clear() 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1375
          return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1376
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1377
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1378
        // process separator (Windows drive spec is only case not a separator)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1379
        if ( itr.m_path_ptr->m_path[itr.m_pos] == slash<Path>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1380
        {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1381
          // detect root directory
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1382
          if ( was_net
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1383
  #       ifdef BOOST_WINDOWS_PATH
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1384
            // case "c:/"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1385
            || itr.m_name[itr.m_name.size()-1] == colon<Path>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1386
  #       endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1387
             )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1388
          {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1389
            itr.m_name = slash<Path>::value;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1390
            return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1391
          }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1392
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1393
          // bypass separators
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1394
          while ( itr.m_pos != itr.m_path_ptr->m_path.size()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1395
            && itr.m_path_ptr->m_path[itr.m_pos] == slash<Path>::value )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1396
            { ++itr.m_pos; }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1397
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1398
          // detect trailing separator, and treat it as ".", per POSIX spec
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1399
          if ( itr.m_pos == itr.m_path_ptr->m_path.size()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1400
            && detail::is_non_root_slash< string_type, traits_type >(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1401
                itr.m_path_ptr->m_path, itr.m_pos-1 ) ) 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1402
          {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1403
            --itr.m_pos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1404
            itr.m_name = dot<Path>::value;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1405
            return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1406
          }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1407
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1408
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1409
        // get next element
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1410
        typename string_type::size_type end_pos(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1411
          itr.m_path_ptr->m_path.find( slash<Path>::value, itr.m_pos ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1412
        itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1413
      } 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1414
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1415
      //  do_decrement  ------------------------------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1416
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1417
      template<class Path>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1418
      void iterator_helper<Path>::do_decrement( iterator & itr )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1419
      {                                                                                
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1420
        assert( itr.m_pos && "basic_path::iterator decrement past begin()"  );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1421
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1422
        typedef typename Path::string_type string_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1423
        typedef typename Path::traits_type traits_type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1424
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1425
        typename string_type::size_type end_pos( itr.m_pos );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1426
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1427
        typename string_type::size_type root_dir_pos(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1428
          detail::root_directory_start<string_type, traits_type>(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1429
            itr.m_path_ptr->m_path, end_pos ) );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1430
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1431
        // if at end and there was a trailing non-root '/', return "."
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1432
        if ( itr.m_pos == itr.m_path_ptr->m_path.size()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1433
          && itr.m_path_ptr->m_path.size() > 1
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1434
          && itr.m_path_ptr->m_path[itr.m_pos-1] == slash<Path>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1435
          && detail::is_non_root_slash< string_type, traits_type >(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1436
               itr.m_path_ptr->m_path, itr.m_pos-1 ) 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1437
           )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1438
        {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1439
          --itr.m_pos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1440
            itr.m_name = dot<Path>::value;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1441
            return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1442
        }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1443
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1444
        // skip separators unless root directory
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1445
        for ( 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1446
          ; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1447
          end_pos > 0
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1448
          && (end_pos-1) != root_dir_pos
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1449
          && itr.m_path_ptr->m_path[end_pos-1] == slash<Path>::value
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1450
          ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1451
          --end_pos ) {}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1452
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1453
        itr.m_pos = detail::filename_pos<string_type, traits_type>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1454
            ( itr.m_path_ptr->m_path, end_pos );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1455
        itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1456
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1457
    } // namespace detail
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1458
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1459
    //  basic_filesystem_error implementation --------------------------------//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1460
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1461
    template<class Path>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1462
    basic_filesystem_error<Path>::basic_filesystem_error(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1463
      const std::string & what_arg, system::error_code ec )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1464
      : system::system_error(ec, what_arg)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1465
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1466
      try
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1467
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1468
        m_imp_ptr.reset( new m_imp );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1469
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1470
      catch (...) { m_imp_ptr.reset(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1471
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1472
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1473
    template<class Path>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1474
    basic_filesystem_error<Path>::basic_filesystem_error(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1475
      const std::string & what_arg, const path_type & path1_arg,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1476
      system::error_code ec )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1477
      : system::system_error(ec, what_arg)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1478
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1479
      try
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1480
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1481
        m_imp_ptr.reset( new m_imp );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1482
        m_imp_ptr->m_path1 = path1_arg;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1483
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1484
      catch (...) { m_imp_ptr.reset(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1485
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1486
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1487
    template<class Path>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1488
    basic_filesystem_error<Path>::basic_filesystem_error(
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1489
      const std::string & what_arg, const path_type & path1_arg,
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1490
      const path_type & path2_arg, system::error_code ec )
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1491
      : system::system_error(ec, what_arg)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1492
    {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1493
      try
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1494
      {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1495
        m_imp_ptr.reset( new m_imp );
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1496
        m_imp_ptr->m_path1 = path1_arg;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1497
        m_imp_ptr->m_path2 = path2_arg;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1498
      }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1499
      catch (...) { m_imp_ptr.reset(); }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1500
    }
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1501
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1502
  } // namespace BOOST_FILESYSTEM_NAMESPACE
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1503
} // namespace boost
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1504
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1505
#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1506
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
  1507
#endif // BOOST_FILESYSTEM_PATH_HPP