|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55730 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/doc libs/filesystem/src libs/filesystem/test
From: bdawes_at_[hidden]
Date: 2009-08-23 09:38:22
Author: bemandawes
Date: 2009-08-23 09:38:21 EDT (Sun, 23 Aug 2009)
New Revision: 55730
URL: http://svn.boost.org/trac/boost/changeset/55730
Log:
Name changes, particularly path observers. Start to bring reference.html in sync with implementation.
Text files modified:
sandbox/filesystem-v3/boost/filesystem/path.hpp | 141 ++---
sandbox/filesystem-v3/libs/filesystem/doc/reference.html | 944 +++++++++++++++++++++------------------
sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 4
sandbox/filesystem-v3/libs/filesystem/src/path.cpp | 50 +
sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp | 8
sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp | 82 +-
sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp | 85 ++-
7 files changed, 696 insertions(+), 618 deletions(-)
Modified: sandbox/filesystem-v3/boost/filesystem/path.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path.hpp 2009-08-23 09:38:21 EDT (Sun, 23 Aug 2009)
@@ -30,15 +30,11 @@
* Document behavior of path::replace_extension has change WRT argument w/o a dot.
* reference.html: operator /= is underspecified as to when a "/" is appended, and
whether a '/' or '\' is appended.
- * path.cpp: locale and detail append/convert need error handling.
* Provide the name check functions for more character types? Templatize?
* Why do preferred() and generic() return paths rather than const strings/string refs?
Either change or document rationale.
* Use BOOST_DELETED, BOOST_DEFAULTED, where appropriate.
- * imbue/codecvt too complex. Move to path_traits? Refactor?
- * path_unit_test, x /= x test failing, commented out. Fix. See test_appends.
* Add test for scoped_path_locale.
- * Should there be a public "preferered_separator" const?
Design Questions
@@ -52,7 +48,6 @@
template< class T >
T string( const error_code ec = throws() );
TODO: Yes; all member functions need to be usable in generic code.
- Can string() and native_string() make use of detail::convert()?
* Assuming generic versions of string(), native_string(), are the w flavors needed?
No. KISS. basic_string<char> is special because it is the predominent
use case. w (and other) flavors can be added later.
@@ -62,7 +57,6 @@
-- the actual separator used
-- the preferred separator
-- the generic separator <-- makes it easier to write portable code
- * Should the preferred native separator be available?
*/
//--------------------------------------------------------------------------------------//
@@ -132,7 +126,7 @@
const String & source_ )
: path_error( what_, ec_ ), m_source( source_ ) {}
- const String & rep() const { return m_source; }
+ const String & native() const { return m_source; }
private:
String m_source;
@@ -148,17 +142,19 @@
{
public:
- // string_type is the std::basic_string type corresponding to the character
- // type for paths used by the native operating system API.
+ // value_type is the character type used by the operating system API to
+ // represent paths.
-#ifdef BOOST_WINDOWS_API
- typedef std::wstring string_type; // internal representation type
-#else
- typedef std::string string_type;
-#endif
- typedef string_type::value_type value_type;
- typedef string_type::size_type size_type;
- typedef path_traits::codecvt_type codecvt_type;
+# ifdef BOOST_WINDOWS_API
+ typedef wchar_t value_type;
+ static const wchar_t preferred_separator = L'\\';
+# else
+ typedef char value_type;
+ static const char preferred_separator = '/';
+# endif
+ typedef std::basic_string<value_type> string_type;
+ typedef string_type::size_type size_type;
+ typedef path_traits::codecvt_type codecvt_type;
// ----- character encoding conversions -----
@@ -238,8 +234,8 @@
m_path, codecvt() );
}
- template <class Pathable>
- path( Pathable const & pathable )
+ template <class PathSource>
+ path( PathSource const & pathable )
{
path_traits::dispatch( pathable, m_path, codecvt() );
}
@@ -262,8 +258,8 @@
return *this;
}
- template <class Pathable>
- path & operator=( Pathable const & range )
+ template <class PathSource>
+ path & operator=( PathSource const & range )
{
m_path.clear();
path_traits::dispatch( range, m_path, codecvt() );
@@ -277,7 +273,7 @@
path & operator/=( const path & p )
{
- append_separator_if_needed_();
+ m_append_separator_if_needed();
m_path += p.m_path;
return *this;
}
@@ -285,17 +281,17 @@
template <class ContiguousIterator>
path & append( ContiguousIterator begin, ContiguousIterator end )
{
- append_separator_if_needed_();
+ m_append_separator_if_needed();
if ( begin != end )
path_traits::convert( &*begin, &*begin+std::distance(begin, end),
m_path, codecvt() );
return *this;
}
- template <class Pathable>
- path & operator/=( Pathable const & range )
+ template <class PathSource>
+ path & operator/=( PathSource const & range )
{
- append_separator_if_needed_();
+ m_append_separator_if_needed();
path_traits::dispatch( range, m_path, codecvt() );
return *this;
}
@@ -306,14 +302,22 @@
void swap( path & rhs ) { m_path.swap( rhs.m_path ); }
path & remove_filename();
path & replace_extension( const path & new_extension = path() );
+
+# ifdef BOOST_WINDOWS_API
+
+ path & path::localize(); // change slash to backslash
+
+# else // BOOST_POSIX_API
+
+ path & path::localize() { return *this; } // POSIX m_path already localized
+
+# endif
+
//# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
// path & normalize() { return m_normalize(); }
//# endif
// ----- observers -----
-
- std::size_t size() const { return m_path.size(); }
-
// For operating systems that format file paths differently than directory
// paths, return values from observers are formatted as file names unless there
@@ -323,13 +327,14 @@
// Implementations are permitted to return const values or const references.
// The string or path returned by an observer will be described as being formatted
- // as "native", "generic", or "internal".
+ // as "native" or "portable".
//
- // For POSIX, these are all the same format; slashes and backslashes are not modified.
+ // For POSIX, these are all the same format; slashes and backslashes are as input and
+ // are not modified.
//
- // For Windows, native: slashes are converted to backslashes
- // generic: backslashes are converted to slashes
- // internal: slashes and backslashes are not modified
+ // For Windows, native: as input; slashes and backslashes are not modified;
+ // this is the format of the internally stored string.
+ // portable: backslashes are converted to slashes
// template< class T >
// T string( system::error_code & ec = boost::throws() ) const // internal (i.e. original) format
@@ -337,22 +342,23 @@
// return path_traits::convert<T>( m_path, ec );
// }
+ // ----- native format observers -----
+ //
+ // access to the internal representation string is efficient and often convenient,
+ // but may result in less than fully portable code.
+
+ const string_type & native() const { return m_path; }
+ const value_type * c_str() const { return m_path.c_str(); }
+
# ifdef BOOST_WINDOWS_API
- const std::string string() const // internal format
- {
- std::string tmp;
- if ( !m_path.empty() )
- path_traits::convert( &*m_path.begin(), &*m_path.begin()+m_path.size(),
- tmp, codecvt() );
- return tmp;
- }
- const std::wstring & wstring() const { return m_path; }
+ const std::string native_string() const;
+ const std::wstring & native_wstring() const { return m_path; }
# else // BOOST_POSIX_API
- const std::string & string() const { return m_path; }
- const std::wstring wstring() const
+ const std::string & native_string() const { return m_path; }
+ const std::wstring native_wstring() const
{
std::wstring tmp;
if ( !m_path.empty() )
@@ -362,29 +368,20 @@
}
# endif
-
-# ifdef BOOST_WINDOWS_PATH
-
- const path preferred() const; // preferred format
- const path generic() const; // generic format
-# else // BOOST_POSIX_PATH
+ // ----- portable format observers -----
- const path preferred() const { return m_path; }
- const path generic() const { return m_path; }
+# ifdef BOOST_WINDOWS_API
-# endif
+ const std::string string() const;
+ const std::wstring wstring() const;
- // ----- internals observers -----
- //
- // access to the internal string is efficient and often convenient, but may result in
- // less than fully portable code.
+# else // BOOST_POSIX_API
- const string_type & rep() const { return m_path; } // internal format
+ const std::string & string() const { return m_path; }
+ const std::wstring wstring() const;
- // c_str() returns a C string suitable for calls to the operating system API.
- // On POSIX and Windows that's internal format, on some OS's it may be native format.
- const value_type * c_str() const { return m_path.c_str(); }
+# endif
// ----- decomposition -----
@@ -405,8 +402,8 @@
bool has_root_name() const { return !root_name().empty(); }
bool has_root_directory() const { return !root_directory().empty(); }
bool has_relative_path() const { return !relative_path().empty(); }
- bool has_filename() const { return !m_path.empty(); }
bool has_parent_path() const { return !parent_path().empty(); }
+ bool has_filename() const { return !m_path.empty(); }
bool is_complete() const
{
# ifdef BOOST_WINDOWS_PATH
@@ -451,7 +448,9 @@
string_type m_path; // Windows: as input; backslashes NOT converted to slashes,
// slashes NOT converted to backslashes
- void append_separator_if_needed_();
+ void m_append_separator_if_needed();
+ void m_portable();
+
//path & m_normalize();
// Was qualified; como433beta8 reports:
@@ -568,11 +567,11 @@
inline bool operator==( const path::string_type & lhs, const path & rhs ) { return rhs == lhs; }
inline bool operator==( const path::value_type * lhs, const path & rhs ) { return rhs == lhs; }
# else // BOOST_POSIX_API
- inline bool operator==( const path & lhs, const path & rhs ) { return lhs.rep() == rhs.rep(); }
- inline bool operator==( const path & lhs, const path::string_type & rhs ) { return lhs.rep() == rhs; }
- inline bool operator==( const path & lhs, const path::value_type * rhs ) { return lhs.rep() == rhs; }
- inline bool operator==( const path::string_type & lhs, const path & rhs ) { return lhs == rhs.rep(); }
- inline bool operator==( const path::value_type * lhs, const path & rhs ) { return lhs == rhs.rep(); }
+ inline bool operator==( const path & lhs, const path & rhs ) { return lhs.native() == rhs.native(); }
+ inline bool operator==( const path & lhs, const path::string_type & rhs ) { return lhs.native() == rhs; }
+ inline bool operator==( const path & lhs, const path::value_type * rhs ) { return lhs.native() == rhs; }
+ inline bool operator==( const path::string_type & lhs, const path & rhs ) { return lhs == rhs.native(); }
+ inline bool operator==( const path::value_type * lhs, const path & rhs ) { return lhs == rhs.native(); }
# endif
@@ -586,13 +585,13 @@
inline std::ostream & operator<<( std::ostream & os, const path & p )
{
- os << p.string();
+ os << p.native_string();
return os;
}
inline std::wostream & operator<<( std::wostream & os, const path & p )
{
- os << p.wstring();
+ os << p.native_wstring();
return os;
}
Modified: sandbox/filesystem-v3/libs/filesystem/doc/reference.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/reference.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/reference.html 2009-08-23 09:38:21 EDT (Sun, 23 Aug 2009)
@@ -47,33 +47,33 @@
<a href="#Header-filesystem-synopsis">
Header <filesystem> synopsis</a><br>
<a href="#Path-traits">Path traits</a><br>
- <a href="#Class-template-basic_path">
- Class template basic_path</a><br>
+ <a href="#Class-template-path">
+ Class template path</a><br>
<a href="#Pathname-formats">Pathname formats</a><br>
<a href="#Pathname-grammar">Pathname grammar</a><br>
-Filename conversion<br>
+Filename conversion<br>
-Requirements </td>
- <td width="35%" valign="top"> Class template basic_path (continued)<br>
+Requirements </td>
+ <td width="35%" valign="top"> Class template path (continued)<br>
-basic_path constructors<br>
+path constructors<br>
-basic_path assignments<br>
+path assignments<br>
-basic_path modifiers<br>
+path modifiers<br>
-basic_path operators<br>
+path operators<br>
-basic_path observers<br>
+path observers<br>
-basic_path iterators<br>
+path iterators<br>
-basic_path non-member functions<br>
+path non-member functions<br>
-basic_path inserter and extractor<span style="background-color: #FFFFFF"><br>
+path inserter and extractor<span style="background-color: #FFFFFF"><br>
</span>
<a href="#Class-template-basic_filesystem_error">Class template
basic_filesystem_error</a><br>
@@ -83,26 +83,26 @@
<a href="#basic_filesystem_error-observers">basic_filesystem_error observers</a><br>
-<a href="#Class-template-basic_directory_entry">Class template
- basic_directory_entry</a><br>
+<a href="#Class-template-directory_entry">Class template
+ directory_entry</a><br>
-basic_directory_entry constructors<br>
+directory_entry constructors<br>
-basic_directory_entry modifiers<br>
+directory_entry modifiers<br>
-basic_directory_entry observers<br>
+directory_entry observers<br>
-basic_directory_entry comparisons</td>
+directory_entry comparisons</td>
<td width="89%" valign="top">Filesystem library chapter (continued)<br>
-<a href="#Class-template-basic_directory_iterator">Class template
- basic_directory_iterator</a><br>
+<a href="#Class-template-directory_iterator">Class template
+ directory_iterator</a><br>
-<a href="#basic_directory_iterator-constructors">basic_directory_iterator
+<a href="#directory_iterator-constructors">directory_iterator
constructors</a><br>
-<a href="#Class-template-basic_recursive_directory_iterator">Class template
- basic_recursive_directory_iterator</a><br>
+<a href="#Class-template-recursive_directory_iterator">Class template
+ recursive_directory_iterator</a><br>
<a href="#file_status">Class
file_status</a><br>
<a href="#Non-member-functions">
@@ -211,23 +211,23 @@
the same object within a file system.</p>
<h3><a name="Requirements">Requirements</a></h3>
<h4><a name="Requirements-on-programs">Requirements on programs</a></h4>
-<p>The arguments for template parameters named <code>Path</code>, <code>Path1</code>,
-or <code>Path2</code> described in this clause shall be of type <code>basic_path</code>,
-or a class derived from <code>basic_path</code>, unless otherwise
+<p>The arguments for template parameters named <code>Path</code>, <code>path</code>,
+or <code>path</code> described in this clause shall be of type <code>path</code>,
+or a class derived from <code>path</code>, unless otherwise
specified.</p>
<h4><a name="Requirements-on-implementations">Requirements on implementations</a></h4>
<p>Some function templates described in this clause have a template parameter
-named <code>Path</code>, <code>Path1</code>, or <code>Path2</code>. When called
+named <code>Path</code>, <code>path</code>, or <code>path</code>. When called
with a function argument <code>s</code> of type <code>char*</code> or <code>
std::string</code>, the implementation shall treat the argument as if it were
coded <code>path(s)</code>. When called with a function argument <code>s</code>
of type <code>wchar_t*</code> or <code>std::wstring</code>, the implementation
shall treat the argument as if it were coded <code>wpath(s)</code>. For
functions with two arguments, implementations shall not supply this treatment
-when <code>Path1</code> and <code>Path2</code> are different types.</p>
+when <code>path</code> and <code>path</code> are different types.</p>
<blockquote>
<p>[<i>Note:</i> This "do-the-right-thing" rule allows users to write <code>exists("foo")</code>,
-taking advantage of class <code>basic_path</code>'s string conversion
+taking advantage of class <code>path</code>'s string conversion
constructor, rather
than the lengthier and more error prone <code>exists(path("foo"))</code>. This
is particularly important for the simple, script-like, programs which are an
@@ -239,13 +239,13 @@
<code>exists()</code> as an example, is:</p>
<blockquote>
<pre>template <class Path>
- typename boost::enable_if<is_basic_path<Path>,bool>::type exists(const Path& p);
+ typename boost::enable_if<is_path<Path>,bool>::type exists(const path& p);
inline bool exists(const path& p) { return exists<path>(p); }
inline bool exists(const wpath& p) { return exists<wpath>(p); }</pre>
</blockquote>
<p> The <code>enable_if</code> will fail for a C string or <code>
std::basic_string</code> argument, which will then be automatically converted
- to a <code>basic_path</code> object via the appropriate <code>basic_path</code> conversion
+ to a <code>path</code> object via the appropriate <code>path</code> conversion
constructor. <i>-- end note</i>]</p>
<p><span style="background-color: #E0E0E0"><i>The two overloads are not given
in the normative text because:</i></span></p>
@@ -290,10 +290,10 @@
{
namespace filesystem
{
- template <class String, class Traits> class basic_path;
+ class path;
template<class String, class Traits>
- void swap(basic_path<String, Traits> & lhs, basic_path<String, Traits> & rhs);
+ void swap(path<String, Traits> & lhs, path<String, Traits> & rhs);
template<class String, class Traits> bool operator<(<i>a</i> a, <i>b</i> b);
template<class String, class Traits> bool operator==(<i>a</i> a, <i>b</i> b);
@@ -311,13 +311,7 @@
basic_istream<typename Path::string_type::value_type, typename Path::string_type::traits_type> &
operator>>(basic_istream<typename Path::string_type::value_type, typename Path::string_type::traits_type>& is, Path & ph);
- struct path_traits;
- struct wpath_traits;
-
- typedef basic_path<std::string, path_traits> path;
- typedef basic_path<std::wstring, wpath_traits> wpath;
-
- template<class Path> struct is_basic_path;
+ template<class Path> struct is_path;
template<class Path> struct slash { static const char value = '/'; };
template<class Path> struct dot { static const char value = '.'; };
@@ -325,25 +319,16 @@
</span>
<span style="background-color: #FFFFFF">class filesystem_error;</span><span style="background-color: #FFFF00">
</span>
- template <class Path> class basic_filesystem_error;
+ class basic_filesystem_error;
typedef basic_filesystem_error<path> filesystem_error;
typedef basic_filesystem_error<wpath> wfilesystem_error;
- <span style="background-color: #FFFFFF">template <class Path> class basic_directory_entry;
-
- typedef basic_directory_entry<path> directory_entry;
- typedef basic_directory_entry<wpath> wdirectory_entry;
-</span>
- template <class Path> class basic_directory_iterator;
+ <span style="background-color: #FFFFFF">class directory_entry;
- typedef basic_directory_iterator<path> directory_iterator;
- typedef basic_directory_iterator<wpath> wdirectory_iterator;
+</span> class directory_iterator;
- template <class Path> class basic_recursive_directory_iterator;
-
- typedef basic_recursive_directory_iterator<path> <a name="recursive_directory_iterator">recursive_directory_iterator</a>;
- typedef basic_recursive_directory_iterator<wpath> wrecursive_directory_iterator;
+ class recursive_directory_iterator;
enum file_type { status_unknown, file_not_found, regular_file, directory_file,
symlink_file, block_file, character_file, fifo_file, socket_file,
@@ -360,10 +345,10 @@
};
</span>
// status functions
- template <class Path> file_status status(const Path& p);
- template <class Path> file_status status(const Path& p, error_code& ec);
- template <class Path> file_status symlink_status(const Path& p);
- template <class Path> file_status symlink_status(const Path& p, error_code& ec);
+ file_status status(const path& p);
+ file_status status(const path& p, error_code& ec);
+ file_status symlink_status(const path& p);
+ file_status symlink_status(const path& p, error_code& ec);
// predicate functions
bool status_known( file_status s );
@@ -373,50 +358,40 @@
bool is_symlink( file_status s );
bool is_other( file_status s );
- template <class Path> bool exists(const Path& p);
- template <class Path> bool is_directory(const Path& p);
- template <class Path> bool is_regular_file(const Path& p);
- template <class Path> bool is_other(const Path& p);
- template <class Path> bool is_symlink(const Path& p);
- template <class Path> bool is_empty(const Path& p);
+ bool exists(const path& p);
+ bool is_directory(const path& p);
+ bool is_regular_file(const path& p);
+ bool is_other(const path& p);
+ bool is_symlink(const path& p);
+ bool is_empty(const path& p);
- template <class Path1, class Path2>
- bool equivalent(const Path1& p1, const Path2& p2);
+ bool equivalent(const path& p1, const path& p2);
// attribute functions
- template <class Path> Path current_path();
- template <class Path> void current_path(const Path& p);
- template <class Path> const Path& initial_path();
- template <class Path> <span style="background-color: #FFFFFF; ">uintmax_t</span> file_size(const Path& p);
-<span style="background-color: #FFFFFF"> template <class Path> space_info space(const Path& p);</span><span style="background-color: #FFFF00">
-</span> template <class Path> std::time_t last_write_time(const Path& p);
- template <class Path>
- void last_write_time(const Path& p, const std::time_t new_time);
+ path current_path();
+ void current_path(const path& p);
+ const path& initial_path();
+ <span style="background-color: #FFFFFF; ">uintmax_t</span> file_size(const path& p);
+<span style="background-color: #FFFFFF"> space_info space(const path& p);</span><span style="background-color: #FFFF00">
+</span> std::time_t last_write_time(const path& p);
+ void last_write_time(const path& p, const std::time_t new_time);
// operations functions
- template <class Path> bool create_directory(const Path& dp);
- template <class Path1, class Path2>
- void create_hard_link(const Path1& old_fp, const Path2& new_fp);
-<span style="background-color: #FFFFFF"> template <class Path1, class Path2>
- error_code create_hard_link(const Path1& old_fp, const Path2& new_fp, error_code& ec);
- template <class Path1, class Path2>
- void create_symlink(const Path1& old_fp, const Path2& new_fp);
- template <class Path1, class Path2>
- error_code create_symlink(const Path1& old_fp, const Path2& new_fp, error_code& ec);
-</span> template <class Path> bool remove(const Path& p);
- template <class Path1, class Path2>
- void rename(const Path1& from_p, const Path2& to_p);
- template <class Path1, class Path2>
- void copy_file(const Path1& from_fp, const Path2& to_fp);
- template <class Path> Path system_complete(const Path& p);
- template <class Path> Path complete(const Path& p, const Path& base=initial_path<Path>());
+ bool create_directory(const path& p);
+ void create_hard_link(const path& old, const path& new_link);
+<span style="background-color: #FFFFFF"> void create_symlink(const path& old, const path& new_link);
+</span> bool remove_path(const path& p);
+ void rename_path(const path& old, const path& new_p);
+ void copy_file(const path& from, const path& to);
+ path system_complete(const path& p);
+ path complete(const path& p, const path base=initial_path());
// convenience functions
- template <class Path> bool create_directories(const Path& p);
- template <class Path> typename Path::string_type extension(const Path& p);
- template <class Path> typename Path::string_type basename(const Path& p);
+ bool create_directories(const path& p);
+ typename Path::string_type extension(const path& p);
+ typename Path::string_type basename(const path& p);
template <class Path>
- Path change_extension(const Path& p, const typename Path::string_type& new_extension);
+ Path change_extension(const path& p, const typename Path::string_type& new_extension);
} // namespace filesystem
} // namespace boost</pre>
@@ -426,7 +401,7 @@
on <code>string</code> and <code>wstring</code>.. It also defines several path
additional path traits structure templates, and defines several specializations
of them.</p>
-<p>Class template <code>basic_path</code> defined in this clause requires additional
+<p>Class template <code>path</code> defined in this clause requires additional
types, values, and behavior to complete the definition of its semantics.</p>
<p>For purposes of exposition, Traits behaves as if it is a class with private
members bool m_locked, initialized false, and std::locale m_locale, initialized </p>
@@ -450,7 +425,7 @@
<td width="38%" valign="top"><code>Traits::internal_string_type</code></td>
<td width="62%">A typedef which is a specialization of <code>basic_string</code>.
The <code>value_type</code> is a character type to be used by the program to
- represent pathnames. Required be the same type as the <code>basic_path
+ represent pathnames. Required be the same type as the <code>path
String</code> template parameter. </td>
</tr>
<tr>
@@ -477,27 +452,41 @@
</code><i>Returns:</i> <code>temp</code></td>
</tr>
</table>
-<p>Type <code>is_basic_path</code> shall be a <i>UnaryTypeTrait</i> (TR1, 4.1).
+<p>Type <code>is_path</code> shall be a <i>UnaryTypeTrait</i> (TR1, 4.1).
The primary template shall be derived directly or indirectly from <code>
-std::tr1::false_type</code>. Type <code>is_basic_path</code> shall be
+std::tr1::false_type</code>. Type <code>is_path</code> shall be
specialized for <code>path</code>, <code>wpath</code>, and any
-user-specialized <code>basic_path</code> types, and such specializations shall
+user-specialized <code>path</code> types, and such specializations shall
be derived directly or indirectly from <code>std::tr1::true_type</code>.</p>
<p>Structure templates <code>slash</code>, <code>dot</code>, and <code>
<span style="background-color: #FFFFFF">colon</span></code><span style="background-color: #FFFFFF">
</span>are supplied with
-values of type <code>char</code>. If a user-specialized <code>basic_path</code>
+values of type <code>char</code>. If a user-specialized <code>path</code>
has a <code>
value_type</code> type which is not convertible from <code>char</code>, the
templates <code>slash</code> and <code>dot</code> shall be specialized to
provide <code>value</code> with type which is convertible to <code>
-basic_path::value_type</code>.</p>
-<h3><a name="Class-template-basic_path">Class template <code>basic_path</code></a></h3>
-<p>Class template <code>basic_path</code> provides a portable mechanism for
+path::value_type</code>.</p>
+<h3><a name="Class-template-path">Class <code>path</code></a></h3>
+<p>An object of class <code>path</code> represents a path. The exact string type,
+format, and encoding are as required by the host operating system.</p>
+<p><i>[Note:</i></p>
+<ul>
+ <li>For POSIX-like operating systems, <code>string_type</code> is <code>std::string</code>, the
+ format is the portable pathname format, and
+ the encoding follows the conventions of the specific operating system.<br>
+ </li>
+ <li>For Windows, <code>string_type</code> is <code>std::wstring</code>,
+ the format is the Windows pathname format, and the encoding is UTF-16 (UCS-2
+ for older versions). Windows recognizes either slash or backslash as a
+ directory separator. The preferred separator is backslash.</li>
+</ul>
+<p><i>-- end note]</i></p>
+<p>Class template <code>path</code> provides a portable mechanism for
representing paths in C++ programs, using a portable generic
pathname grammar. When portability is not a
requirement, native file system specific formats can be used. Class template
-<code>basic_path</code> is concerned only with the lexical and syntactic aspects
+<code>path</code> is concerned only with the lexical and syntactic aspects
of a path. The path does not have to exist in the operating system's file
system, and may contain names which are not even valid for the current operating
system. </p>
@@ -511,104 +500,117 @@
{
namespace filesystem
{
- template <class String, class Traits> class basic_path
+ class path
{
public:
- typedef basic_path<String, Traits> path_type;
- typedef String string_type;
- typedef typename String::value_type value_type;
- typedef Traits traits_type;
- typedef typename Traits::external_string_type external_string_type;
-
- // constructors/destructor
- basic_path();
- basic_path(const basic_path& p);
- basic_path(const string_type& s);
- basic_path(const value_type* s);
- template <class InputIterator>
- basic_path(InputIterator first, InputIterator last);
-
- ~basic_path();
-
- // assignments
- basic_path& operator=(const basic_path& p);
- basic_path& operator=(const string_type& s);
- basic_path& operator=(const value_type* s);
- template <class InputIterator>
- basic_path& assign(InputIterator first, InputIterator last);
-
- // modifiers
- basic_path& operator/=(const basic_path& rhs);
- basic_path& operator/=(const string_type& s);
- basic_path& operator/=(const value_type* s);
- template <class InputIterator>
- basic_path& append(InputIterator first, InputIterator last);
+ typedef <b><i>see below</i></b> value_type; // char for POSIX, wchar_t for Windows
+ typedef std::basic_string<value_type> string_type;
+ typedef string_type::size_type size_type;
+ typedef path_traits::codecvt_type codecvt_type;
- <span style="background-color: #FFFFFF">void clear();
- void swap( basic_path & rhs );</span>
- basic_path& remove_filename();
- basic_path& replace_extension(const string_type & new_extension = "");
-
- // observers
- const string_type string() const;
- const string_type file_string() const;
- const string_type directory_string() const;
-
- const external_string_type external_file_string() const;
- const external_string_type external_directory_string() const;
-
- string_type root_name() const;
- string_type root_directory() const;
- basic_path root_path() const;
- basic_path relative_path() const;
+ static const value_type generic_separator = <b><i>see below</i></b>; // '/' for POSIX
+ // L'/' for Windows
+ static const value_type preferred_separator = <b><i>see below</i></b>; // '/' for POSIX
+ // L'\\' for Windows
+
+ // constructors/destructor
+ path();
+ path(const path& p);
+
+ template <class ContiguousIterator>
+ path(ContiguousIterator begin, ContiguousIterator end);
+
+ template <class PathSource>
+ path(PathSource const & source);
+
+ ~path();
- basic_path parent_path() const;
- string_type filename() const;
+ // assignments
+ path& operator=(const path& p);
- string_type stem() const;
- string_type extension() const;
+ template <class ContiguousIterator>
+ path& assign(ContiguousIterator begin, ContiguousIterator end);
+ template <class PathSource>
+ path& operator=(PathSource const & source);
+
+ // appends
+ path& operator/=(const path& p);
+
+ template <class ContiguousIterator>
+ path& append(ContiguousIterator begin, ContiguousIterator end);
+
+ template <class PathSource>
+ path& operator/=(PathSource const & source);
+
+ // modifiers
+ <span style="background-color: #FFFFFF">void clear();
+ void swap(path & rhs);</span>
+ path& remove_filename();
+ path& replace_extension(const path & new_extension = path());
+
+ // observers
+ const string_type& native() const; // native format, native string-type, native encoding
+ const value_type* c_str() const; // native().c_str()
+
+ <i><b>const-string</b></i> native_string() const; // native format, uses codecvt() for encoding
+ <i><b>const-wstring</b></i> native_wstring() const; // native format, uses codecvt() for encoding
+
+ <b><i>const-string</i></b> string() const; // portable format, uses codecvt() for encoding
+ <b><i>const-wstring</i></b> wstring() const; // portable format, uses codecvt() for encoding
+
+ // decomposition
+ path root_name() const;
+ path root_directory() const;
+ path root_path() const;
+ path relative_path() const;
+ path parent_path() const;
+ path filename() const;
+ path stem() const;
+ path extension() const;
+
+ // query
bool empty() const;
- bool is_complete() const;
bool has_root_name() const;
bool has_root_directory() const;
bool has_root_path() const;
bool has_relative_path() const;
- bool has_filename() const;
bool has_parent_path() const;
+ bool has_filename() const;
+ bool is_complete() const;
- // iterators
+ // iterators
class iterator;
typedef iterator const_iterator;
iterator begin() const;
iterator end() const;
-
+
+ // encoding conversion
+ static std::locale imbue( const std::locale & loc );
+ static const codecvt_type & codecvt()
};
} // namespace filesystem
} // namespace boost</pre>
-<p>A <code>basic_path</code> object stores a possibly empty path.
-The internal form of the stored path is unspecified.</p>
+<p><code>value_type</code> is an implementation-defined typedef for the
+character type used by the implementation to represent paths.</p>
+<blockquote>
+<p><i>[Note:</i> On POSIX-like systems, including Cygwin, <code>value_type</code>
+is <code>char</code>. On Windows-like systems, <code>value_type</code> is <code>
+wchar_t</code>. <i>--end note]</i></p>
+</blockquote>
<p><a name="pathname-resolution">Functions</a> described in this clause which access files or their attributes do so by
-resolving a <code>basic_path</code> object into a particular file in a file
-hierarchy. The pathname, suitably converted to the string type, format, and
-encoding
-required by the operating system, is resolved as if by the <i>POSIX</i>
+resolving a <code>path</code> object to a particular file in a file
+hierarchy. The path is resolved as if by the <i>POSIX</i>
<a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap04.html#tag_04_11">
-Pathname Resolution</a> mechanism. The encoding of the resulting pathname is determined by the <code>Traits::to_external</code> conversion function.</p>
+Pathname Resolution</a> mechanism.</p>
<blockquote>
-<p>[<i>Note:</i> There is no guarantee that the path stored in a <code>basic_path</code>
+<p>[<i>Note:</i> There is no guarantee that the path stored in a <code>path</code>
object is valid for a particular operating system or file system. <i>-- end note</i>]</p>
</blockquote>
-<p>Some functions in this clause return <code>basic_path</code> objects for
-paths composed partly or wholly of pathnames obtained from the operating system.
-Such pathnames are suitably converted from the actual format and string
-type supplied by the operating system. The encoding of the resulting path is determined by the <code>Traits::to_internal</code> conversion function.</p>
-<p>For member functions described as returning "<code>const string_type</code>" or
-"<code>const external_string_type</code>", implementations are permitted to return
-"<code>const string_type&</code>" or "<code>const external_string_type&</code>"
-respectively.</p>
+<p>For member functions described as returning "<code>const path</code>", implementations are permitted to return
+"<code>const path&</code>".</p>
<blockquote>
<p>[<i>Note:</i> This allows implementations to avoid unnecessary copies.
Return-by-value is specified as
@@ -633,7 +635,7 @@
operating systems familiar to large numbers of programmers. </span></p>
<p>Use of the portable format does not alone guarantee
portability; filenames must also be portable.<span style="background-color: #FFFFFF">
-See Filename conversions. Each operating system
+See Filename conversions. Each operating system
follows its own rules. Use of the portable format
does not change that. </span> <i>-- end note</i>]</p>
@@ -652,7 +654,7 @@
</blockquote>
</li>
</ul>
-<p><span style="background-color: #FFFFFF">All <code>basic_path</code> string or sequence arguments that describe a
+<p><span style="background-color: #FFFFFF">All <code>path</code> string or sequence arguments that describe a
path shall accept the portable pathname format, and shall accept the native
format if explicitly identified by a native format escape sequence prefix of
<code>slash slash colon</code>.</span></p>
@@ -754,7 +756,9 @@
followed by a colon as a native format <i>root-name</i>,
and a backslash as a format element equivalent to <i>slash</i>. <i>-- end note</i>]</p>
</blockquote>
-<h4><a name="Filename-conversion">Filename conversion</a></h4>
+<h4><a name="Input-conversion">Input conversion</a></h4>
+<p><span style="background-color: #FFFF00">To be supplied. Explain when, how
+codecvt applied.</span></p>
<p>When converting filenames to the native operating system format,
implementations are encouraged, but not required, to convert otherwise invalid
characters or character sequences to valid characters or character sequences.
@@ -773,104 +777,112 @@
Boost may settle on % hex hex as the preferred escape sequence. If so, should
there be normative encouragement?</i></span></p>
</blockquote>
-<h4><a name="basic_path-requirements">Requirements</a></h4>
-<p>The argument for the template parameter named <code>String</code> shall be a
-class that includes members with the same names, types, values, and semantics as
-class template <code>basic_string</code>.</p>
-<p>The argument for the template parameter named <code>Traits</code> shall be a
-class that satisfies the requirements specified in the
-Path Behavior Traits Requirements
-table.</p>
-<p>The argument for template parameters named <code>InputIterator</code> shall satisfy the
-requirements of an input iterator (C++ Std, 24.1.1, Input iterators [lib.input.iterators]) and shall have a value type convertible to
-<code>basic_path::value_type</code>. </p>
-<p>Some function templates with a template
-parameter named <code>InputIterator</code> also have non-template overloads. Implementations shall
-only select the function template overload if the type named by <code>InputIterator</code>
-is not <code>path_format_t</code>.</p>
-<blockquote>
-<p>[<i>Note:</i> This "do-the-right-thing" rule ensures that the
-overload expected by the user is selected. The implementation technique is unspecified -
-implementations may use
-enable_if or
-other techniques to achieve the effect. <i>-- end note</i>]</p>
-</blockquote>
-<h4> <a name="basic_path-constructors"> <code>basic_path</code> constructors</a></h4>
-<pre>basic_path();</pre>
+<h4><a name="path-requirements">Requirements</a></h4>
+<p><code>ContiguousIterator</code> is required to be a <code>RandomIterator</code>
+pointing to contiguous storage. The iterator's value_type is required to be </p>
+<p>PathSource is:</p>
+<ul>
+ <li>A container. The value type is required to be <code>char</code>, <code>
+ wchar_t</code>, <code>char16_t</code>, or <code>char32_t</code>.</li>
+ <li>An iterator for a null terminated byte-string. The value type is required
+ to be <code>char</code>, <code>wchar_t</code>, <code>char16_t</code>, or <code>
+ char32_t</code>.</li>
+ <li>A c-array. The value type is required to be <code>char</code>, <code>
+ wchar_t</code>, <code>char16_t</code>, or <code>char32_t</code>.</li>
+ <li>A boost::filesystem::directory_entry.</li>
+</ul>
+<h4> <code><font size="4">class </font></code> <a name="path-constructors"> <code>
+<font size="4">path</font></code> constructors</a></h4>
+<pre>path();</pre>
<blockquote>
<p><i>Postconditions:</i> <code>empty()</code>.</p>
</blockquote>
-<pre>basic_path(const string_type& s);
-basic_path(const value_type * s);
-template <class InputIterator>
- basic_path(InputIterator s, InputIterator last);</pre>
-<blockquote>
- <p><i>Remarks:</i> The format of string <code>s</code> and sequence [<code>first</code>,<code>last</code>)
- is described in Pathname formats.</p>
- <p><i>Effects:</i> The path elements in string <code>s</code> or sequence [<code>first</code>,<code>last</code>)
- are stored.</p>
-</blockquote>
-<h4> <a name="basic_path-assignments"> <code>basic_path</code> assignments</a></h4>
-<pre>basic_path& operator=(const string_type& s);
-basic_path& operator=(const value_type* s);
-template <class InputIterator>
- basic_path& assign(InputIterator first, InputIterator last);</pre>
-<blockquote>
- <p><i>Remarks:</i> The format of string <code>s</code> and sequence [<code>first</code>,<code>last</code>)
- is described in Pathname formats.</p>
- <p><i>Effects:</i> The path elements in string <code>s</code> or sequence [<code>first</code>,<code>last</code>)
- are stored.</p>
+<pre>template <class ContiguousIterator>
+ path(ContiguousIterator begin, ContiguousIterator end);</pre>
+<pre>template <class PathSource>
+ path(PathSource const & source);</pre>
+<blockquote>
+ <p><i>Postconditions:</i> <code>native()</code> is a copy of [<code>begin</code>,<code>end</code>)
+ or <code>source</code>,
+ converted to the format and encoding required by the host operating system (<a href="#Input-conversion">Input
+ conversion</a>).</p>
+</blockquote>
+<h4> <code><font size="4">class </font></code> <a name="path-assignments"> <code>
+<font size="4">path</font></code> assignments</a></h4>
+<pre>template <class ContiguousIterator>
+ path& assign(ContiguousIterator begin, ContiguousIterator end);</pre>
+<pre>template <class PathSource>
+ path& operator=(PathSource const & source);</pre>
+<blockquote>
+ <p><i>Postconditions:</i> <code>native()</code> is a copy of [<code>begin</code>,<code>end</code>)
+ or <code>source</code>,
+ converted to the format and encoding required by the host operating system (<a href="#Input-conversion">Input
+ conversion</a>).</p>
<p><i>Returns: </i><code>*this</code></p>
</blockquote>
-<h4> <a name="basic_path-modifiers"> <code>basic_path</code> modifiers</a></h4>
-<pre>basic_path& operator/=(const basic_path& rhs);</pre>
+<h4> <code><font size="4">class <a name="path-appends">path</a></font></code><a name="path-appends">
+appends</a></h4>
+ <p>The append operations use <code>operator/=</code> to denote their semantic
+ effect of automatically supplying a separator unless an added separator would
+ be redundant or would change an incomplete path to a complete path.</p>
+ <p>The cases where a separator is automatically supplied are:</p>
+ <ul>
+ <li>On POSIX, when <code>!empty() && native().back() != '/'</code></li>
+ <li>On Windows, when <code>!empty() && native().back() != L'/' &&
+ native().back() != L'\\' && native().back() != L':'</code></li>
+</ul>
+<pre>path& operator/=(const path& p);</pre>
<blockquote>
- <p><i>Effects:</i> The path stored in <code>rhs</code> is appended to the
- stored path.</p>
- <p><i>Returns:</i> <code>*this</code></p>
+ <p><i>Postconditions:</i> <code>native()</code> contains:</p>
+ <ul>
+ <li>the original contents of <code>native()</code>, </li>
+ <li>followed by a <code>native_separator</code>, unless an added separator
+ would be redundant or would change an incomplete path to a complete path,</li>
+ <li>followed by <code>p.native()</code>.</li>
+ </ul>
</blockquote>
-<pre>basic_path& operator/=(const string_type& s);
-basic_path& operator/=(const value_type* s);
-template <class InputIterator>
-basic_path& append(InputIterator first, InputIterator last);</pre>
-<blockquote>
- <p><i>Remarks:</i> The format of string <code>s</code> and sequence [<code>first</code>,<code>last</code>)
- is described in Pathname formats.</p>
-<p><i>Effects:</i> The path elements in string <code>s</code> or sequence [<code>first</code>,<code>last</code>)
- are appended to the stored path.</p>
+<pre>template <class ContiguousIterator>
+ path& append(ContiguousIterator begin, ContiguousIterator end);</pre>
+<pre>template <class PathSource>
+ path& operator/=(PathSource const & source);</pre>
+<blockquote>
+ <p><i>Postconditions:</i> <code>native()</code> contains:</p>
+ <ul>
+ <li>the original contents of <code>native()</code>, </li>
+ <li>followed by a <code>native_separator</code>, unless an added separator
+ would be redundant or would change an incomplete path to a complete path,</li>
+ <li>followed by a copy of [<code>begin</code>,<code>end</code>) or <code>source</code>, converted to the
+ format and encoding required by the host operating system (<a href="#Input-conversion">Input
+ conversion</a>).</li>
+ </ul>
<p><i>Returns: </i><code>*this</code></p>
</blockquote>
+<h4> <code><font size="4">class </font></code> <a name="path-modifiers"> <code>
+<font size="4">path</font></code> modifiers</a></h4>
<pre>void clear();</pre>
<blockquote>
<p><i>Postcondition:</i> <code>this->empty()</code> is true.</p>
</blockquote>
-<pre><code><span style="background-color: #FFFFFF">void swap( basic_path & rhs );</span></code></pre>
+<pre><code><span style="background-color: #FFFFFF">void swap( path & rhs );</span></code></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF">
Swaps the contents of the two paths.</span></p>
<p><i><span style="background-color: #FFFFFF">Throws: </span></i>
<span style="background-color: #FFFFFF">nothing.</span></p>
- <p><i><span style="background-color: #FFFFFF">Postcondition:</span></i><span style="background-color: #FFFFFF">
- </span><code><span style="background-color: #FFFFFF">this->string()</span></code><span style="background-color: #FFFFFF">
- contains the same sequence of characters that were in </span><code><span style="background-color: #FFFFFF">
- rhs.string()</span></code><span style="background-color: #FFFFFF">, </span><code><span style="background-color: #FFFFFF">
- rhs.string()</span></code><span style="background-color: #FFFFFF">
- contains the same sequence of characters that were is </span><code>
- <span style="background-color: #FFFFFF">this->string()</span></code><span style="background-color: #FFFFFF">.</span></p>
<p><i><span style="background-color: #FFFFFF">Complexity: </span></i>
<span style="background-color: #FFFFFF">constant time.</span></p>
</blockquote>
-<pre>basic_path& remove_filename();</pre>
+<pre>path& remove_filename();</pre>
<blockquote>
- <p><i>Effects:</i> If <code>has_parent_path()</code> then remove the last <i>filename</i> from the stored path. If that leaves
- the stored path with one or more trailing <i>slash</i> elements not
- representing <i>root-directory</i>, remove them.</p>
+ <p><i>Effects:</i> If <code>has_parent_path()</code> then remove the last filename from the stored path. If that leaves
+ the stored path with one or more trailing separator elements not
+ representing a root-directory, remove them.</p>
<p><i>Returns:</i> <code>*this</code></p>
<p>[<i>Note:</i> This function is needed to efficiently implement <code>
- basic_directory_iterator</code>. It is made public to allow additional uses. <i>-- end
+ directory_iterator</code>. It is made public to allow additional uses. <i>-- end
note</i>]</p>
</blockquote>
-<pre>basic_path& replace_extension( const string_type & new_extension = "" );</pre>
+<pre>path& replace_extension(const path & new_extension = path());</pre>
<blockquote>
<p><i>Postcondition: </i> <code>extension() == <i>replacement</i></code>,
where <code><i>replacement</i></code> is <code>new_extension</code> if <code>
@@ -879,49 +891,86 @@
<code>new_extension</code>.</p>
<p><i>Returns:</i> <code>*this</code></p>
</blockquote>
-<h4> <a name="basic_path-observers"> <code>basic_path</code> observers</a></h4>
+<h4> <code><font size="4">class </font></code> <a name="path-observers"> <code>
+<font size="4">path</font></code> observers</a></h4>
+<p>Some operating systems, including <i>POSIX</i> and <i>
+Windows</i>, use the same format for paths to directories and paths to regular
+files.</p>
+<p>Other operating systems, such as OpenVMS, used different formats for paths to
+directories and paths to regular files. On such systems, implementations shall
+determine the format according to whether or not the last element is a
+separator.</p>
+<table border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+ <tr>
+ <td colspan="2">
+ <p align="center"><b>OpenVMS</b></td>
+ </tr>
+ <tr>
+ <td><code>path p</code></td>
+ <td><code>p.native()</code></td>
+ </tr>
+ <tr>
+ <td><code>p = "/cats/jane"</code></td>
+ <td> <code>"[CATS]JANE"</code></td>
+ </tr>
+ <tr>
+ <td><code>p = "/cats/jane/"</code></td>
+ <td> <code>"[CATS.JANE]"</code></td>
+ </tr>
+</table>
+<pre>const string_type& native() const;</pre>
<blockquote>
+<p><i>Returns:</i> A string formatted and encoded as defined by the
+implementation. <i>[Note:</i> This is normally the format and encoding of paths
+for the host operating system. If the implementation emulates a different
+operating system, such as Cygwin's emulation of Windows, the format and encoding
+will be that of the emulated operating system. <i>--end note]</i></p>
+</blockquote>
+<pre>const value_type* c_str() const;</pre>
+<blockquote>
+<p>Returns: <code>native().c_str()</code>.</p>
+</blockquote>
+<pre><i><b>const-string</b></i> native_string() const;</pre>
+<blockquote>
+<p><b><i><code>const-string</code></i></b> is permitted to be <code>const
+std::string</code> or <code>const std::string&</code>.</p>
+<p><i>Returns:</i> A string containing the contents of <code>native()</code>. If
+<code>value_type</code> is not <code>char</code>, the encoding is converted by
+<code>codecvt()</code>.</p>
+<p><i>[Note:</i> For POSIX implementations, no conversion is required; the
+implementation will simply return <code>native()</code>. <i>-- end note]</i></p>
+</blockquote>
+<pre><i><b>const-wstring</b></i> native_wstring() const; </pre>
+<blockquote>
+<p><b><i><code>const-wstring</code></i></b> is permitted to be <code>const
+std::wstring</code> or <code>const std::wstring&</code>.</p>
+<p><i>Returns:</i> A string containing the contents of <code>native()</code>. If
+<code>value_type</code> is not <code>wchar_t</code>, the encoding is converted
+by <code>codecvt()</code>.</p>
+<p><i>[Note:</i> For Windows implementations, no conversion is required; the
+implementation will simply return <code>native()</code>. <i>-- end note]</i></p>
+</blockquote>
+<pre><b><i>const-string</i></b> generic_string() const;</pre>
+<blockquote>
+<p><b><i><code>const-string</code></i></b> is permitted to be <code>const
+std::string</code> or <code>const std::string&</code>.</p>
+<p><i>Returns:</i> A string containing the <a href="#Pathname-grammar">portable
+representation</a> of the contents of <code>native()</code>. If <code>value_type</code>
+is not <code>char</code>, the encoding is converted by <code>codecvt()</code>.</p>
+</blockquote>
+<pre><b><i>const-wstring</i></b> generic_wstring() const;</pre>
+<blockquote>
+<p><b><i><code>const-wstring</code></i></b> is permitted to be <code>const
+std::wstring</code> or <code>const std::wstring&</code>.</p>
+<p><i>Returns:</i> A string containing the <a href="#Pathname-grammar">portable
+representation</a> of the contents of <code>native()</code>. If <code>value_type</code>
+is not <code>wchar_t</code>, the encoding is converted by <code>codecvt()</code>.</p>
+</blockquote>
+<h4> <a name="path-decomposition"> <code><font size="4">class path</font></code>
+decomposition</a></h4>
<p><span style="background-color: #E0E0E0"><i>See the
<a href="#Path-decomposition-table">Path decomposition table</a> for examples
for values returned by decomposition functions.</i></span></p>
-</blockquote>
-<pre>const string_type string() const;</pre>
-<blockquote>
-<p><i>Returns:</i> The stored path, formatted according to the
-Pathname grammar rules.</p>
-</blockquote>
-<pre>const string_type file_string() const;</pre>
-<blockquote>
-<p><i>Returns:</i> The stored path, formatted according to the
-operating system rules for regular file pathnames, with any
-Filename conversion applied.</p>
-<p>[<i>Note:</i> For some operating systems, including <i>POSIX</i> and <i>
-Windows</i>, the native format for regular file pathnames and directory
-pathnames is the same, so <code>file_string()</code> and <code>directory_string()</code>
-return the same string. On OpenMVS, however, the expression <code>path("/cats/jane").file_string()</code>
-would return the string <code>"[CATS]JANE"</code> while <code>path("/cats/jane").directory_string()</code>
-would return the string <code>"[CATS.JANE]"</code>. <i>-- end note</i>]</p>
-</blockquote>
-<pre>const string_type directory_string() const;</pre>
-<blockquote>
-<p><i>Returns:</i> The stored path, formatted according to the
-operating system rules for directory pathnames, with any
-Filename conversion applied.</p>
-</blockquote>
-<pre>const external_string_type external_file_string() const;</pre>
-<blockquote>
-<p><i>Returns:</i> The stored path, formatted according to the
-operating system rules for regular file pathnames, with any
-Filename conversion applied, and encoded by the <code>Traits::to_external</code>
-conversion function.</p>
-</blockquote>
-<pre>const external_string_type external_directory_string() const;</pre>
-<blockquote>
-<p><i>Returns:</i> The stored path, formatted according to the
-operating system rules for directory pathnames, with any
-Filename conversion applied, and encoded by the <code>Traits::to_external</code>
-conversion function.</p>
-</blockquote>
<pre>string_type root_name() const;</pre>
<blockquote>
<p><i>Returns:</i> <i>root-name,</i> if the stored path includes <i>
@@ -934,25 +983,25 @@
<p>If <i>root-directory</i> is composed <i>slash name</i>, <i>slash</i> is
excluded from the returned string.</p>
</blockquote>
-<pre>basic_path root_path() const;</pre>
+<pre>path root_path() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>root_name() / root_directory()</code></p>
</blockquote>
-<pre>basic_path relative_path() const;</pre>
+<pre>path relative_path() const;</pre>
<blockquote>
-<p><i>Returns:</i> A <code>basic_path</code> composed from the the stored path, if any, beginning
+<p><i>Returns:</i> A <code>path</code> composed from the the stored path, if any, beginning
with the first <i>filename</i> after <i>root-path</i>.
-Otherwise, an empty <code>basic_path</code>.</p>
+Otherwise, an empty <code>path</code>.</p>
</blockquote>
<pre>string_type filename() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>empty() ? string_type() : *--end()</code></p>
</blockquote>
-<pre>basic_path parent_path() const;</pre>
+<pre>path parent_path() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>(string().empty() || begin() == --end()) ? path_type("") :
<i>br</i></code>, where <code><i>br</i></code> is constructed as if by
- starting with an empty <code>basic_path</code> and successively applying <code>
+ starting with an empty <code>path</code> and successively applying <code>
operator/=</code> for each element in the range <code>begin()</code>, <code>
--end()</code>.</p>
</blockquote>
@@ -1008,12 +1057,13 @@
<blockquote>
<p><i>Returns:</i> <code>!parent_path().empty()</code></p>
</blockquote>
-<h4> <a name="basic_path-iterators"> <code>basic_path</code> iterators</a></h4>
-<p> A <code>basic_path::iterator</code> is a constant iterator satisfying all
+<h4> <code><font size="4">class </font></code> <a name="path-iterators"> <code>
+<font size="4">path</font></code> iterators</a></h4>
+<p> A <code>path::iterator</code> is a constant iterator satisfying all
the requirements of a bidirectional iterator (C++ Std, 24.1.4 Bidirectional
iterators [lib.bidirectional.iterators]). Its <code>value_type</code> is
<code>string_type</code>.</p>
- <p>Calling any non-const member function of a <code>basic_path</code> object
+ <p>Calling any non-const member function of a <code>path</code> object
invalidates all iterators referring to elements of the object.</p>
<p> The forward traversal order is as follows:</p>
<ul>
@@ -1033,17 +1083,17 @@
<blockquote>
<p><i>Returns:</i> The end iterator.</p>
</blockquote>
-<h4> <a name="basic_path-non-member-functions">
-<span style="background-color: #FFFFFF">basic_path non-member functions</span></a></h4>
+<h4> <a name="path-non-member-functions">
+<span style="background-color: #FFFFFF">path non-member functions</span></a></h4>
<pre><span style="background-color: #FFFFFF">template<class String, class Traits>
-void swap( basic_path<String, Traits> & lhs, basic_path<String, Traits> & rhs )</span></pre>
+void swap( path<String, Traits> & lhs, path<String, Traits> & rhs )</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Effects: </span></i><code>
<span style="background-color: #FFFFFF">lhs.swap(
rhs )</span></code></p>
</blockquote>
- <h4><span style="background-color: #FFFFFF">basic_path non-member operators</span></h4>
- <p><span style="background-color: #FFFFFF">There are seven basic_path non-member operators (/,
+ <h4><span style="background-color: #FFFFFF">path non-member operators</span></h4>
+ <p><span style="background-color: #FFFFFF">There are seven path non-member operators (/,
</span> <code><span style="background-color: #FFFFFF">==</span></code><span style="background-color: #FFFFFF">,
</span> <code>
<span style="background-color: #FFFFFF">!=</span></code><span style="background-color: #FFFFFF">,
@@ -1064,32 +1114,32 @@
</tr>
<tr>
<td width="100%"><span style="background-color: #FFFFFF"><code>
- basic_path<String, Traits>& a, basic_path<String, Traits>&
+ path<String, Traits>& a, path<String, Traits>&
b</code></span></td>
</tr>
<tr>
<td width="100%"><span style="background-color: #FFFFFF"><code>const
- typename basic_path<String, Traits>::string_type& a,
- basic_path<String, Traits>& b</code></span></td>
+ typename path<String, Traits>::string_type& a,
+ path<String, Traits>& b</code></span></td>
</tr>
<tr>
<td width="100%"><span style="background-color: #FFFFFF"><code>const
- typename basic_path<String, Traits>::string_type::value_type* a,
- basic_path<String, Traits>& b</code></span></td>
+ typename path<String, Traits>::string_type::value_type* a,
+ path<String, Traits>& b</code></span></td>
</tr>
<tr>
<td width="100%"><span style="background-color: #FFFFFF"><code>const
- basic_path<String, Traits>& a, typename basic_path<String, Traits>::string_type&
+ path<String, Traits>& a, typename path<String, Traits>::string_type&
b</code></span></td>
</tr>
<tr>
<td width="100%"><span style="background-color: #FFFFFF"><code>const
- basic_path<String, Traits>& a, typename
- basic_path<String, Traits>::string_type::value_type* b</code></span></td>
+ path<String, Traits>& a, typename
+ path<String, Traits>::string_type::value_type* b</code></span></td>
</tr>
</table>
<p><span style="background-color: #FFFFFF">In the </span><b><i>
- <span style="background-color: #FFFFFF">basic_path non-member operators </span>
+ <span style="background-color: #FFFFFF">path non-member operators </span>
</i></b><span style="background-color: #FFFFFF">table, </span><code>
<span style="background-color: #FFFFFF">a</span></code><span style="background-color: #FFFFFF">
and </span><code><span style="background-color: #FFFFFF">b</span></code><span style="background-color: #FFFFFF">
@@ -1098,7 +1148,7 @@
table. If </span><code><span style="background-color: #FFFFFF">a</span></code><span style="background-color: #FFFFFF">
or </span><code><span style="background-color: #FFFFFF">b</span></code><span style="background-color: #FFFFFF">
is of type </span><code><span style="background-color: #FFFFFF">const
- basic_path<String, Traits>&</span></code><span style="background-color: #FFFFFF">,
+ path<String, Traits>&</span></code><span style="background-color: #FFFFFF">,
then </span><i><b><span style="background-color: #FFFFFF">a</span></b></i><code><i><b><span style="background-color: #FFFFFF">'</span></b></i></code><span style="background-color: #FFFFFF">
or </span><i><b><span style="background-color: #FFFFFF">b'</span></b></i><span style="background-color: #FFFFFF">
respectively is </span><code><span style="background-color: #FFFFFF">a</span></code><span style="background-color: #FFFFFF">
@@ -1106,7 +1156,7 @@
respectively. Otherwise </span><i><b><span style="background-color: #FFFFFF">a</span></b></i><code><i><b><span style="background-color: #FFFFFF">'</span></b></i></code><span style="background-color: #FFFFFF">
or </span><i><b><span style="background-color: #FFFFFF">b'</span></b></i><span style="background-color: #FFFFFF">
respectively represent named or unnamed temporary </span><code>
- <span style="background-color: #FFFFFF">basic_path<String, Traits></span></code><span style="background-color: #FFFFFF">
+ <span style="background-color: #FFFFFF">path<String, Traits></span></code><span style="background-color: #FFFFFF">
objects constructed from </span><code><span style="background-color: #FFFFFF">
a</span></code><span style="background-color: #FFFFFF"> or </span><code>
<span style="background-color: #FFFFFF">b</span></code><span style="background-color: #FFFFFF">
@@ -1114,7 +1164,7 @@
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="280">
<tr>
<td width="100%" colspan="3" align="center" height="19"><b><i>
- <span style="background-color: #FFFFFF">basic_path non-member operators</span></i></b></td>
+ <span style="background-color: #FFFFFF">path non-member operators</span></i></b></td>
</tr>
<tr>
<td width="20%" align="center" height="19"><i><b>
@@ -1128,9 +1178,9 @@
<td width="20%" align="center" height="30" valign="top"><code>
<span style="background-color: #FFFFFF">a / b</span></code></td>
<td width="25%" align="center" height="30" valign="top"><code>
- <span style="background-color: #FFFFFF">basic_path<String, Traits></span></code></td>
+ <span style="background-color: #FFFFFF">path<String, Traits></span></code></td>
<td width="55%" height="30"><code><span style="background-color: #FFFFFF">
- basic_path<String, Traits> tmp(a);<br>
+ path<String, Traits> tmp(a);<br>
return tmp /= </span></code><i><b><span style="background-color: #FFFFFF">b'</span></b></i><code><span style="background-color: #FFFFFF">;</span></code></td>
</tr>
<tr>
@@ -1197,7 +1247,7 @@
</span> <a name="Path-equality"><span style="background-color: #FFFFFF">Path equality</span></a><span style="background-color: #FFFFFF"> and path
equivalence have different semantics.</span></p>
<p><span style="background-color: #FFFFFF">Equality is determined by </span> <i>
- <span style="background-color: #FFFFFF">basic_path</span></i><span style="background-color: #FFFFFF">'s
+ <span style="background-color: #FFFFFF">path</span></i><span style="background-color: #FFFFFF">'s
non-member </span> <code><a href="#operator-eq">
<span style="background-color: #FFFFFF">operator==</span></a></code><span style="background-color: #FFFFFF">, which considers the two path's lexical representations
only. Paths "abc" and "ABC" are never equal.</span></p>
@@ -1213,13 +1263,13 @@
file", and choose the appropriate function accordingly. </span> <i>
<span style="background-color: #FFFFFF">-- end note</span></i><span style="background-color: #FFFFFF">]</span></p>
</blockquote>
- <h4><a name="basic_path-inserter-extractor"> <code>
- <span style="background-color: #FFFFFF">basic_path</span></code><span style="background-color: #FFFFFF"> inserter
+ <h4><a name="path-inserter-extractor"> <code>
+ <span style="background-color: #FFFFFF">path</span></code><span style="background-color: #FFFFFF"> inserter
and extractor</span></a></h4>
<pre><span style="background-color: #FFFFFF">template<class Path>
basic_istream<typename Path::string_type::value_type, typename Path::string_type::traits_type>&
operator>>(basic_istream< typename Path::string_type::value_type, typename Path::string_type::traits_type>& is,
- Path& ph );</span></pre>
+ path ph );</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Effects: </span></i>
<code><span style="background-color: #FFFFFF">typename Path::string_type str;<br>
@@ -1233,7 +1283,7 @@
<pre><span style="background-color: #FFFFFF">template<class Path>
basic_ostream<typename Path::string_type::value_type, typename Path::string_type::traits_type>&
operator<<(basic_ostream< typename Path::string_type::value_type, typename Path::string_type::traits_type>& os,
- const Path& ph );</span></pre>
+ const path& ph );</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF">
</span> <code><span style="background-color: #FFFFFF">os << ph.string()</span></code></p>
@@ -1245,7 +1295,7 @@
{
namespace filesystem
{
- template <class Path> class basic_filesystem_error : public <span style="background-color: #FFFFFF">system</span>_error
+ class basic_filesystem_error : public <span style="background-color: #FFFFFF">system</span>_error
{
public:
typedef Path path_type;
@@ -1378,42 +1428,42 @@
<p>Implementations and users are permitted to provide other specializations of
the <code>what</code> member function.</p>
</blockquote>
-<h3><a name="Class-template-basic_directory_entry">Class template <code>basic_directory_entry</code></a></h3>
+<h3><a name="Class-template-directory_entry">Class template <code>directory_entry</code></a></h3>
<pre> namespace boost
{
namespace filesystem
{
- template <class Path> class basic_directory_entry
+ class directory_entry
{
public:
typedef Path path_type;
typedef typename Path::string_type string_type;
- // constructors
- basic_directory_entry();
- explicit basic_directory_entry(const path_type& p,
+ // constructors
+ directory_entry();
+ explicit directory_entry(const path_type& p,
<span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
- // modifiers
+ // modifiers
void assign(const path_type& p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
void replace_filename(const string_type& s, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());
- // observers
- const Path& path() const;
- operator const Path&() const;
+ // observers
+ const path& path() const;
+ operator const path() const;
<span style="background-color: #FFFFFF">
file_status status() const;
file_status status(error_code& ec) const;
file_status symlink_status() const;
file_status symlink_status(error_code& ec) const;
</span><span style="background-color: #FFFF00">
-</span> // comparisons
- bool operator<(const basic_directory_entry<Path>& rhs);
- bool operator==(const basic_directory_entry<Path>& rhs);
- bool operator!=(const basic_directory_entry<Path>& rhs);
- bool operator>(const basic_directory_entry<Path>& rhs);
- bool operator<=(const basic_directory_entry<Path>& rhs);
- bool operator>=(const basic_directory_entry<Path>& rhs);
+</span> // comparisons
+ bool operator<(const directory_entry<Path>& rhs);
+ bool operator==(const directory_entry<Path>& rhs);
+ bool operator!=(const directory_entry<Path>& rhs);
+ bool operator>(const directory_entry<Path>& rhs);
+ bool operator<=(const directory_entry<Path>& rhs);
+ bool operator>=(const directory_entry<Path>& rhs);
private:
path_type m_path; // for exposition only
@@ -1423,7 +1473,7 @@
} // namespace filesystem
} // namespace boost</pre>
-<p>A <code>basic_directory_entry</code> object stores a <code>basic_path object</code>,
+<p>A <code>directory_entry</code> object stores a <code>path object</code>,
a <code>file_status</code> object for non-symbolic link status, and a <code>
file_status</code> object for symbolic link status. The <code>file_status</code>
objects act as value caches.</p>
@@ -1438,8 +1488,8 @@
a moderately fast hard-drive. Similar speedup expected on Linux and BSD-derived
Unix variants that provide status during directory iteration.</i></span></p>
</blockquote>
-<h4> <a name="basic_directory_entry-constructors"> <code>basic_directory_entry </code>constructors</a></h4>
-<pre>basic_directory_entry();</pre>
+<h4> <a name="directory_entry-constructors"> <code>directory_entry </code>constructors</a></h4>
+<pre>directory_entry();</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="36%">
@@ -1461,7 +1511,7 @@
</tr>
</table>
</blockquote>
-<pre>explicit basic_directory_entry(const path_type& p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());</pre>
+<pre>explicit directory_entry(const path_type& p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());</pre>
<blockquote>
<p><i>Postconditions:</i></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="36%">
@@ -1483,7 +1533,7 @@
</tr>
</table>
</blockquote>
-<h4> <a name="basic_directory_entry-modifiers"> <code>basic_directory_entry </code>modifiers</a></h4>
+<h4> <a name="directory_entry-modifiers"> <code>directory_entry </code>modifiers</a></h4>
<pre>void assign(const path_type& p, <span style="background-color: #FFFFFF">file_status</span> st=file_status(), <span style="background-color: #FFFFFF">file_status</span> symlink_st=file_status());</pre>
<blockquote>
<p><i>Postconditions:</i></p>
@@ -1528,9 +1578,9 @@
</tr>
</table>
</blockquote>
-<h4> <a name="basic_directory_entry-observers"> <code>basic_directory_entry</code> observers</a></h4>
-<pre>const Path& path() const;
-operator const Path&() const;</pre>
+<h4> <a name="directory_entry-observers"> <code>directory_entry</code> observers</a></h4>
+<pre>const path& path() const;
+operator const path() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>m_path</code></p>
</blockquote>
@@ -1593,25 +1643,25 @@
</blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_symlink_status</code></span></p>
</blockquote>
-<h3><a name="Class-template-basic_directory_iterator">Class template <code>basic_directory_iterator</code></a></h3>
+<h3><a name="Class-template-directory_iterator">Class template <code>directory_iterator</code></a></h3>
<pre> namespace boost
{
namespace filesystem
{
template <class Path>
- class basic_directory_iterator :
- public iterator<input_iterator_tag, basic_directory_entry<Path> >
+ class directory_iterator :
+ public iterator<input_iterator_tag, directory_entry<Path> >
{
public:
typedef Path path_type;
- // constructors
- basic_directory_iterator();
- explicit basic_directory_iterator(const Path& dp);
- basic_directory_iterator(const Path& dp, error_code& ec);
- basic_directory_iterator(const basic_directory_iterator& bdi);
- basic_directory_iterator& operator=(const basic_directory_iterator& bdi);
- ~basic_directory_iterator();
+ // constructors
+ directory_iterator();
+ explicit directory_iterator(const path dp);
+ directory_iterator(const path dp, error_code& ec);
+ directory_iterator(const directory_iterator& bdi);
+ directory_iterator& operator=(const directory_iterator& bdi);
+ ~directory_iterator();
// other members as required by
// C++ Std, 24.1.1 Input iterators [lib.input.iterators]
@@ -1619,14 +1669,14 @@
} // namespace filesystem
} // namespace boost</pre>
-<p> <code>basic_directory_iterator</code> satisfies the requirements of an
+<p> <code>directory_iterator</code> satisfies the requirements of an
input iterator (C++ Std, 24.1.1, Input iterators [lib.input.iterators]).</p>
-<p>A <code>basic_directory_iterator</code> reads successive elements from the directory for
+<p>A <code>directory_iterator</code> reads successive elements from the directory for
which it was constructed, as if by calling <i>POSIX</i>
<code>
-readdir_r()</code>. After a <code>basic_directory_iterator</code> is constructed, and every time
+readdir_r()</code>. After a <code>directory_iterator</code> is constructed, and every time
<code>operator++</code> is called,
-it reads and stores a value of <code>basic_directory_entry<Path></code>
+it reads and stores a value of <code>directory_entry<Path></code>
and possibly stores associated status values.
<code>operator++</code> is not equality preserving; that is, <code>i == j</code> does not imply that
<code>++i == ++j</code>. </p>
@@ -1635,13 +1685,13 @@
can be used only for single-pass algorithms. <i>--end note</i>]</p>
</blockquote>
<p>If the end of the directory elements is reached, the iterator becomes equal to
-the end iterator value. The constructor <code>basic_directory_iterator()</code>
+the end iterator value. The constructor <code>directory_iterator()</code>
with no arguments always constructs an end iterator object, which is the only
legitimate iterator to be used for the end condition. The result of <code>
operator*</code> on an end iterator is not defined. For any other iterator value
-a <code>const basic_directory_entry<Path>&</code> is returned. The result of
+a <code>const directory_entry<Path>&</code> is returned. The result of
<code>operator-></code> on an end iterator is not defined. For any other
-iterator value a <code>const basic_directory_entry<Path>*</code> is
+iterator value a <code>const directory_entry<Path>*</code> is
returned. </p>
<p>Two end iterators are always equal. An end iterator is not equal to a non-end
iterator.</p>
@@ -1651,8 +1701,8 @@
moved into a note.</span></i></p>
</blockquote>
<p>The result of calling the <code>path()</code> member of the <code>
-basic_directory_entry</code> object obtained by dereferencing a <code>
-basic_directory_iterator</code> is a reference to a <code>basic_path</code>
+directory_entry</code> object obtained by dereferencing a <code>
+directory_iterator</code> is a reference to a <code>path</code>
object composed of the directory argument from which the iterator was
constructed with filename of the directory entry appended as if by <code>
operator/=</code>. </p>
@@ -1692,7 +1742,7 @@
<p>Directory iteration shall not yield directory entries for the current (<i>dot</i>)
and parent (<i>dot dot</i>) directories.</p>
<p>The order of directory entries obtained by dereferencing successive
-increments of a <code>basic_directory_iterator</code> is unspecified.</p>
+increments of a <code>directory_iterator</code> is unspecified.</p>
<blockquote>
<p>[<i>Note:</i> Programs performing directory iteration may wish to test if the
path obtained by dereferencing a directory iterator actually exists. It could be
@@ -1701,7 +1751,7 @@
walking directory trees for purposes of removing and renaming entries may wish
to avoid following symbolic links.</p>
<p>If a file is removed from or added to a directory after the
-construction of a <code>basic_directory_iterator</code> for the directory, it is
+construction of a <code>directory_iterator</code> for the directory, it is
unspecified whether or not subsequent incrementing of the iterator will ever
result in an iterator whose value is the removed or added directory entry. See
<i>POSIX</i>
@@ -1709,9 +1759,9 @@
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/readdir_r.html">readdir_r()</a></code>. <i>
--end note</i>]</p>
</blockquote>
-<h4><a name="basic_directory_iterator-constructors"><code>basic_directory_iterator</code> constructors</a></h4>
+<h4><a name="directory_iterator-constructors"><code>directory_iterator</code> constructors</a></h4>
-<p><code>basic_directory_iterator();</code></p>
+<p><code>directory_iterator();</code></p>
<blockquote>
@@ -1719,7 +1769,7 @@
</blockquote>
-<p><code>explicit basic_directory_iterator(const Path& dp);</code></p>
+<p><code>explicit directory_iterator(const path dp);</code></p>
<blockquote>
@@ -1730,7 +1780,7 @@
directory_iterator(".")</code> rather than <code>directory_iterator("")</code>.
<i>-- end note</i>]</p>
</blockquote>
-<pre><code>basic_directory_iterator(const Path& dp, error_code& ec );</code></pre>
+<pre><code>directory_iterator(const path dp, error_code& ec );</code></pre>
<blockquote>
<p><i>Effects:</i> Constructs a iterator representing the first
@@ -1740,24 +1790,24 @@
reported by the operating system, otherwise to 0.</p>
</blockquote>
-<h3><a name="Class-template-basic_recursive_directory_iterator">Class template <code>basic_recursive_directory_iterator</code></a></h3>
+<h3><a name="Class-template-recursive_directory_iterator">Class template <code>recursive_directory_iterator</code></a></h3>
<pre> namespace boost
{
namespace filesystem
{
template <class Path>
- class basic_recursive_directory_iterator :
- public iterator<input_iterator_tag, basic_directory_entry<Path> >
+ class recursive_directory_iterator :
+ public iterator<input_iterator_tag, directory_entry<Path> >
{
public:
typedef Path path_type;
// constructors
- basic_recursive_directory_iterator();
- explicit basic_recursive_directory_iterator(const Path& dp);
- basic_recursive_directory_iterator(const basic_recursive_directory_iterator& brdi);
- basic_recursive_directory_iterator& operator=(const basic_recursive_directory_iterator& brdi);
- ~basic_recursive_directory_iterator();
+ recursive_directory_iterator();
+ explicit recursive_directory_iterator(const path dp);
+ recursive_directory_iterator(const recursive_directory_iterator& brdi);
+ recursive_directory_iterator& operator=(const recursive_directory_iterator& brdi);
+ ~recursive_directory_iterator();
// observers
int level() const;
@@ -1775,8 +1825,8 @@
} // namespace filesystem
} // namespace boost</pre>
-<p>The behavior of a <code>basic_recursive_directory_iterator</code> is the same
-as a <code>basic_directory_iterator</code> unless otherwise specified.</p>
+<p>The behavior of a <code>recursive_directory_iterator</code> is the same
+as a <code>directory_iterator</code> unless otherwise specified.</p>
<ul>
<li>When an iterator is constructed, <code>m_level</code> is set to 0;</li>
<li>When an iterator <code>it</code> is incremented, if <code>it->is_directory()</code>
@@ -1834,8 +1884,8 @@
</blockquote>
<h3><a name="Non-member-functions">Non-member operational functions</a></h3>
<h4><a name="Status-functions">Status functions</a></h4>
-<pre>template <class Path> file_status status(const Path& p, error_code& ec);
-template <class Path> file_status <a name="symlink_status">symlink_status</a>(const Path& p, error_code& ec);</pre>
+<pre>file_status status(const path& p, error_code& ec);
+file_status <a name="symlink_status">symlink_status</a>(const path& p, error_code& ec);</pre>
<blockquote>
<p><i>Returns:</i></p>
<blockquote>
@@ -1899,7 +1949,7 @@
</ul>
</blockquote>
<p>[<i>Note:</i> <code>directory_file</code> implies <code>
-basic_directory_iterator</code> on the file would succeed, and <code>
+directory_iterator</code> on the file would succeed, and <code>
regular_file</code> implies appropriate <code><fstream></code> operations would succeed,
assuming no hardware, permission, access, or race
condition errors. For <code>regular_file,</code> the converse is not true; lack of
@@ -1907,7 +1957,7 @@
fail on a directory.
<i>-- end note</i>]</p>
</blockquote>
-<pre>template <class Path> file_status status(const Path& p);</pre>
+<pre>file_status status(const path& p);</pre>
<blockquote>
<p><i>Effects:</i> <code>system_error_code ec;</code><br>
@@ -1916,7 +1966,7 @@
!= 0</code></p>
<p><i>Returns:</i> <code>stat</code></p>
</blockquote>
-<pre>template <class Path> file_status symlink_status(const Path& p);</pre>
+<pre>file_status symlink_status(const path& p);</pre>
<blockquote>
<p><i>Effects:</i> <code>system_error_code ec;</code><br>
@@ -1936,7 +1986,7 @@
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
<code>status_known(s) && s.type() != file_not_found</code></span></p>
</blockquote>
-<pre>template <class Path> bool <a name="exists">exists</a>(const Path& p);</pre>
+<pre>bool <a name="exists">exists</a>(const path& p);</pre>
<blockquote>
<p><i>Returns:</i> <code>exists( status(p) )</code></p>
</blockquote>
@@ -1945,7 +1995,7 @@
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
<code>s.type() == regular_file</code></span></p>
</blockquote>
-<pre><code>template <class Path> bool is_regular_file(const Path& p);</code></pre>
+<pre><code>bool is_regular_file(const path& p);</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_regular_file( status(p) )</code></p>
</blockquote>
@@ -1954,7 +2004,7 @@
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> </span>
<code><span style="background-color: #FFFFFF">s.type() == directory_file</span></code></p>
</blockquote>
-<pre><code>template <class Path> bool is_directory(const Path& p);</code></pre>
+<pre><code>bool is_directory(const path& p);</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_directory( status(p) )</code></p>
</blockquote>
@@ -1963,7 +2013,7 @@
<p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> </span>
<code><span style="background-color: #FFFFFF">s.type() == symlink_file</span></code></p>
</blockquote>
-<pre><code>template <class Path> bool is_symlink(const Path& p);</code></pre>
+<pre><code>bool is_symlink(const path& p);</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_symlink( symlink_status(p) )</code></p>
</blockquote>
@@ -1975,11 +2025,11 @@
<code>is_other()</code> will remain unchanged even if additional <code>is_xxx()</code>
functions are added in the future. <i>-- end note</i>]</span></p>
</blockquote>
-<pre><code>template <class Path> bool is_other(const Path& p);</code></pre>
+<pre><code>bool is_other(const path& p);</code></pre>
<blockquote>
<p><i>Returns:</i> <code>is_other( status(p) )</code></p>
</blockquote>
-<pre><code>template <class Path> bool <span style="background-color: #FFFFFF; text-decoration:underline">is_</span>empty(const Path& p);</code></pre>
+<pre><code>bool <span style="background-color: #FFFFFF; text-decoration:underline">is_</span>empty(const path& p);</code></pre>
<blockquote>
<p><i>Effects:</i> Determines <code>file_status s</code>, as if by <code>
status(p)</code>.</p>
@@ -1987,17 +2037,17 @@
is_other(s)</code>.</p>
<p><i>Returns:</i> <code>is_directory(s)<br>
?
- basic_directory_iterator<Path>(p) == basic_directory_iterator<Path>()<br>
+ directory_iterator<Path>(p) == directory_iterator<Path>()<br>
: file_size(p) == 0;</code></p>
</blockquote>
-<pre><code>template <class Path1, class Path2> bool <a name="equivalent">equivalent</a>(const Path1& p1, const Path2& p2);</code></pre>
+<pre><code>template <class path, class path> bool <a name="equivalent">equivalent</a>(const path& p1, const path& p2);</code></pre>
<blockquote>
- <p><i>Requires:</i> <code>Path1::external_string_type</code> and <code>
- Path2::external_string_type</code> are the same type. </p>
+ <p><i>Requires:</i> <code>path::external_string_type</code> and <code>
+ path::external_string_type</code> are the same type. </p>
<p><i>Effects:</i> Determines <code>file_status s1</code> and <code>s2</code>,
as if by <code>status(p1)</code> and <code>status(p2)</code>,
respectively.</p>
- <p><i>Throws:</i> <code>basic_filesystem_error<Path1></code><span style="background-color: #FFFFFF"> </span>
+ <p><i>Throws:</i> <code>basic_filesystem_error<path></code><span style="background-color: #FFFFFF"> </span>
if <code>(!exists(s1) && !exists(s2)) || (is_other(s1) &&
is_other(s2))</code>.</p>
<p><i>Returns:</i> <code>true</code>, if <code>sf1 == sf2</code> and <code>p1</code> and <code>p2</code>
@@ -2023,7 +2073,7 @@
<p>[<i>Note:</i> A strictly limited number of attribute functions are provided
because few file system attributes are portable. Even the functions provided will be impossible to implement on some file
systems. <i>--end note</i>.]</p>
-<pre>template <class Path> const Path& <a name="initial_path">initial_path</a>();</pre>
+<pre>const path <a name="initial_path">initial_path</a>();</pre>
<blockquote>
<p><i>Returns:</i> <code>current_path()</code> at the time of entry to <code>
main()</code>.</p>
@@ -2038,7 +2088,7 @@
encouraged to call it immediately on entrance to <code>main()</code> so that
they will work correctly with such partial implementations. <i>--end note</i>]</p>
</blockquote>
-<pre>template <class Path> Path current_path();</pre>
+<pre>Path current_path();</pre>
<blockquote>
<p><i>Returns:</i> The current path, as if by <i>POSIX</i>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/getcwd.html">
@@ -2052,11 +2102,11 @@
current_path()</code> name was chosen to emphasize that the return is a
complete path, not just a single directory name. <i>-- </i><i>end note</i>]</p>
</blockquote>
-<pre>template <class Path> void current_path(const Path& p);</pre>
+<pre>void current_path(const path& p);</pre>
<blockquote>
<p><i>Postcondition:</i> equivalent( p, current_path() );</p>
</blockquote>
-<pre>template <class Path> <span style="background-color: #FFFFFF; ">uintmax_t</span> file_size(const Path& p);</pre>
+<pre><span style="background-color: #FFFFFF; ">uintmax_t</span> file_size(const path& p);</pre>
<blockquote>
<p><i>Returns:</i> The size
<span style="background-color: #FFFFFF; ">in bytes</span>
@@ -2066,7 +2116,7 @@
obtained as if by <i>POSIX</i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>.</p>
</blockquote>
-<pre><span style="background-color: #FFFFFF"><a name="space">template</a> <class Path> space_info space(const Path& p);</span></pre>
+<pre><span style="background-color: #FFFFFF"><a name="space">template</a> <class Path> space_info space(const path& p);</span></pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> A <code>space_info</code>
object. The value of the <code>space_info</code> object is determined as if by
@@ -2080,7 +2130,7 @@
and <code>available</code> members respectively. Any members for which the
value cannot be determined shall be set to -1.</span></p>
</blockquote>
-<pre>template <class Path> std::time_t last_write_time(const Path& p);</pre>
+<pre>std::time_t last_write_time(const path& p);</pre>
<blockquote>
<p><i>Returns:</i> The time of last data modification of <code>p</code>, determined as if by the
value of the <i>POSIX</i> <code>
@@ -2088,7 +2138,7 @@
as if by <i>POSIX</i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/stat.html">stat()</a></code>.</p>
</blockquote>
-<pre>template <class Path> void last_write_time(const Path& p, const std::time_t new_time);</pre>
+<pre>void last_write_time(const path& p, const std::time_t new_time);</pre>
<blockquote>
<p><i>Effects:</i> Sets the time of last data modification of the file
resolved to by <code>p</code>
@@ -2102,7 +2152,7 @@
due to coarse time mechanism granularity. <i>-- end note</i>]</p>
</blockquote>
<h4>Other o<a name="Operations-functions">perations functions</a></h4>
-<pre>template <class Path> bool create_directory(const Path& dp);</pre>
+<pre>bool create_directory(const path dp);</pre>
<blockquote>
<p><i>Effects:</i> Attempts to create the directory <code>dp</code> resolves to,
as if by<i> POSIX </i><code>
@@ -2112,13 +2162,13 @@
<p><i>Returns:</i> True if a new directory was created, otherwise false.</p>
<p><i>Postcondition:</i> <code>is_directory(dp)</code></p>
</blockquote>
-<pre><span style="background-color: #FFFFFF">template <class Path1, class Path2>
- error_code create_hard_link(const Path1& to_p, const Path2& from_p, error_code& ec);</span></pre>
+<pre><span style="background-color: #FFFFFF">template <class path, class path>
+ error_code create_hard_link(const path& to_p, const path& from_p, error_code& ec);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Requires:</span></i><span style="background-color: #FFFFFF">
- </span> <code><span style="background-color: #FFFFFF">Path1::external_string_type</span></code><span style="background-color: #FFFFFF"> and
+ </span> <code><span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> and
</span> <code>
- <span style="background-color: #FFFFFF">Path2::external_string_type</span></code><span style="background-color: #FFFFFF"> are the same type.</span></p>
+ <span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> are the same type.</span></p>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF"> Establishes the postcondition, as if by
</span> <i><span style="background-color: #FFFFFF">POSIX</span></i><span style="background-color: #FFFFFF">
</span> <code>
@@ -2145,26 +2195,26 @@
for example. Thus hard links should be avoided if wide portability is
a concern. </span> <i><span style="background-color: #FFFFFF">-- end note</span></i><span style="background-color: #FFFFFF">]</span></p>
</blockquote>
-<pre><span style="background-color: #FFFFFF">template <class Path1, class Path2>
- void create_hard_link(const Path1& to_p, const Path2& from_p);</span></pre>
+<pre><span style="background-color: #FFFFFF">template <class path, class path>
+ void create_hard_link(const path& to_p, const path& from_p);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Requires:</span></i><span style="background-color: #FFFFFF">
- </span> <code><span style="background-color: #FFFFFF">Path1::external_string_type</span></code><span style="background-color: #FFFFFF"> and
+ </span> <code><span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> and
</span> <code>
- <span style="background-color: #FFFFFF">Path2::external_string_type</span></code><span style="background-color: #FFFFFF"> are the same type.</span></p>
+ <span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> are the same type.</span></p>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF">
As if <code>system_error_code ec( create_hard_link( to_p, from_p ) );</code></span></p>
<p><span style="font-style: italic; background-color: #FFFFFF">Throws:</span><span style="background-color: #FFFFFF">
- </span> <code>basic_filesystem_error<Path1, Path2></code><span style="background-color: #FFFFFF">
+ </span> <code>basic_filesystem_error<path, path></code><span style="background-color: #FFFFFF">
if <code>ec</code> is not zero.</span></p>
</blockquote>
-<pre><span style="background-color: #FFFFFF">template <class Path1, class Path2>
- error_code create_symlink(const Path1& to_p, const Path2& from_p, error_code& ec);</span></pre>
+<pre><span style="background-color: #FFFFFF">template <class path, class path>
+ error_code create_symlink(const path& to_p, const path& from_p, error_code& ec);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Requires:</span></i><span style="background-color: #FFFFFF">
- </span> <code><span style="background-color: #FFFFFF">Path1::external_string_type</span></code><span style="background-color: #FFFFFF"> and
+ </span> <code><span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> and
</span> <code>
- <span style="background-color: #FFFFFF">Path2::external_string_type</span></code><span style="background-color: #FFFFFF"> are the same type.</span></p>
+ <span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> are the same type.</span></p>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF"> Establishes the postcondition, as if by
</span> <i><span style="background-color: #FFFFFF">POSIX</span></i><span style="background-color: #FFFFFF">
</span> <code>
@@ -2182,20 +2232,20 @@
them only for regular files. Thus symbolic links should be avoided if code portability is
a concern. </span> <i><span style="background-color: #FFFFFF">-- end note</span></i><span style="background-color: #FFFFFF">]</span></p>
</blockquote>
-<pre><span style="background-color: #FFFFFF">template <class Path1, class Path2>
- void create_symlink(const Path1& to_p, const Path2& from_p);</span></pre>
+<pre><span style="background-color: #FFFFFF">template <class path, class path>
+ void create_symlink(const path& to_p, const path& from_p);</span></pre>
<blockquote>
<p><i><span style="background-color: #FFFFFF">Requires:</span></i><span style="background-color: #FFFFFF">
- </span> <code><span style="background-color: #FFFFFF">Path1::external_string_type</span></code><span style="background-color: #FFFFFF"> and
+ </span> <code><span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> and
</span> <code>
- <span style="background-color: #FFFFFF">Path2::external_string_type</span></code><span style="background-color: #FFFFFF"> are the same type.</span></p>
+ <span style="background-color: #FFFFFF">path::external_string_type</span></code><span style="background-color: #FFFFFF"> are the same type.</span></p>
<p><i><span style="background-color: #FFFFFF">Effects:</span></i><span style="background-color: #FFFFFF">
As if <code>system_error_code ec( create_symlink( to_p, from_p ) );</code></span></p>
<p><span style="font-style: italic; background-color: #FFFFFF">Throws:</span><span style="background-color: #FFFFFF">
- </span> <code>basic_filesystem_error<Path1, Path2></code><span style="background-color: #FFFFFF">
+ </span> <code>basic_filesystem_error<path, path></code><span style="background-color: #FFFFFF">
if <code>ec</code> is not zero.</span></p>
</blockquote>
-<pre>template <class Path> void remove(const Path& p, system::error_code & ec = <i>singular</i> );</pre>
+<pre>void remove(const path& p, system::error_code & ec = <i>singular</i> );</pre>
<blockquote>
<p><i>Effects:</i> Removes the file <code>p</code>,
as if by<i> POSIX </i><code>
@@ -2218,7 +2268,7 @@
<p>[<i>Note:</i> A symbolic link is itself removed, rather than the file it
resolves to being removed. <i>-- end note</i>]</p>
</blockquote>
-<pre>template <class Path> unsigned long remove_all(const Path& p);</pre>
+<pre>unsigned long remove_all(const path& p);</pre>
<blockquote>
<p><i>Effects:</i> Recursively deletes the contents of p if it exists,
then deletes file <code>p</code> itself,
@@ -2229,10 +2279,10 @@
<p>[<i>Note:</i> A symbolic link is itself removed, rather than the file it
resolves to being removed. <i>-- end note</i>]</p>
</blockquote>
-<pre>template <class Path1, class Path2> void rename(const Path1& from_p, const Path2& to_p);</pre>
+<pre>template <class path, class path> void rename(const path& from_p, const path& to_p);</pre>
<blockquote>
- <p><i>Requires:</i> <code>Path1::external_string_type</code> and <code>
- Path2::external_string_type</code> are the same type. </p>
+ <p><i>Requires:</i> <code>path::external_string_type</code> and <code>
+ path::external_string_type</code> are the same type. </p>
<p><i>Effects:</i> Renames <code>from_p</code> to <code>to_p</code>, as if by
<i>POSIX</i> <code>
<a href="http://www.opengroup.org/onlinepubs/000095399/functions/rename.html">
@@ -2245,17 +2295,17 @@
existing file, it is removed. A symbolic link is itself renamed, rather than
the file it resolves to being renamed. <i>-- end note</i>]</p>
</blockquote>
-<pre>template <class Path1, class Path2> void copy_file(const Path1& from_fp, const Path2& to_fp);</pre>
+<pre>template <class path, class path> void copy_file(const path& from_fp, const path& to_fp);</pre>
<blockquote>
- <p><i>Requires:</i> <code>Path1::external_string_type</code> and <code>
- Path2::external_string_type</code> are the same type. </p>
+ <p><i>Requires:</i> <code>path::external_string_type</code> and <code>
+ path::external_string_type</code> are the same type. </p>
<p><i>Effects:</i> The contents and attributes of the file <code>from_fp</code>
resolves to are copied to the file <code>to_fp</code> resolves to.</p>
<p><i>Throws:</i> <code>basic_filesystem_error<Path></code> if <code>
from_fp.empty() || to_fp.empty() ||!exists(from_fp) || !is_regular_file(from_fp)
|| exists(to_fp)</code></p>
</blockquote>
-<pre>template <class Path> Path complete(const Path& p, const Path& base=initial_path<Path>());</pre>
+<pre>Path complete(const path& p, const path base=initial_path<Path>());</pre>
<blockquote>
<p><i>Effects:</i> Composes a complete path from <code>p</code> and <code>base</code>,
using the following rules:</p>
@@ -2294,7 +2344,7 @@
is expected by program users. <i>--
end note</i>]</p>
</blockquote>
-<pre>template <class Path> Path system_complete(const Path& p);</pre>
+<pre>Path system_complete(const path& p);</pre>
<blockquote>
<p><i>Effects:</i> Composes a complete path from <code>p</code>, using the
same rules used by the operating system to resolve a path passed as the
@@ -2319,7 +2369,7 @@
<i>complete()</i> note</a> for usage suggestions. <i>-- end note</i>]</p>
</blockquote>
<h4><a name="Convenience-functions">Convenience functions</a></h4>
-<pre>template <class Path> bool create_directories(const Path & p);</pre>
+<pre>bool create_directories(const Path & p);</pre>
<blockquote>
<p><i>Requires:</i> <code>p.empty() || <br>
forall px: px == p || is_parent(px, p): is_directory(px) || !exists( px )</code>
@@ -2334,10 +2384,10 @@
<tr>
<td>
<h4>Deprecated convenience functions</h4>
- <p>The following functions have been replaced by <code>basic_path</code>
+ <p>The following functions have been replaced by <code>path</code>
member functions <code>extension()</code>, <code>stem()</code>, and <code>
replace_extension()</code>.</p>
-<pre>template <class Path> typename Path::string_type extension(const Path & p);</pre>
+<pre>typename Path::string_type extension(const Path & p);</pre>
<blockquote>
<p><i>Returns:</i> if <code>p.filename()</code> contains a <i>dot</i>, returns
the substring of <code>p.filename()</code> starting at the rightmost <i>dot</i>
@@ -2348,7 +2398,7 @@
behavior for file systems which append additional elements to extensions, such
as alternate data stream or partitioned dataset names. <i>-- end note</i>]</p>
</blockquote>
-<pre>template <class Path> typename Path::string_type basename(const Path & p);</pre>
+<pre>typename Path::string_type basename(const Path & p);</pre>
<blockquote>
<p><i>Returns:</i> if <code>p.filename()</code> contains a <i>dot</i>, returns
the substring of <code>p.filename()</code> starting at its beginning and
@@ -2393,7 +2443,7 @@
<p><span style="background-color: #FFFFFF"><i>In 27.8.1.1 Class template
basic_filebuf [lib.filebuf] synopsis preceding paragraph 1, add the function:</i></span></p>
<blockquote>
-<pre><span style="background-color: #FFFFFF">template <class Path> </span><span style="background-color: #FFFFFF">basic_filebuf</span><span style="background-color: #FFFFFF"><charT,traits>* </span><span style="background-color: #FFFFFF">open(const</span><span style="background-color: #FFFFFF"> Path& p, </span><span style="background-color: #FFFFFF">ios_base::openmode</span><span style="background-color: #FFFFFF"> mode);</span></pre>
+<pre><span style="background-color: #FFFFFF"></span><span style="background-color: #FFFFFF">basic_filebuf</span><span style="background-color: #FFFFFF"><charT,traits>* </span><span style="background-color: #FFFFFF">open(const</span><span style="background-color: #FFFFFF"> path p, </span><span style="background-color: #FFFFFF">ios_base::openmode</span><span style="background-color: #FFFFFF"> mode);</span></pre>
</blockquote>
<p><span style="background-color: #FFFFFF"><i>In 27.8.1.3 Member functions [lib.filebuf.members],
add the above to the signature preceding paragraph 2, and replace the
@@ -2413,8 +2463,8 @@
<p><span style="background-color: #FFFFFF"><i>In 27.8.1.5 Class template
basic_ifstream [lib.ifstream] synopsis preceding paragraph 1, add the functions:</i></span></p>
<blockquote>
- <pre><span style="background-color: #FFFFFF">template <class Path> explicit basic_ifstream(const Path& p, ios_base::openmode mode = ios_base::in);
-template <class Path> void open(const Path& p, ios_base::openmode mode = ios_base::in);</span></pre>
+ <pre><span style="background-color: #FFFFFF">explicit basic_ifstream(const path& p, ios_base::openmode mode = ios_base::in);
+void open(const path& p, ios_base::openmode mode = ios_base::in);</span></pre>
</blockquote>
<p><i><span style="background-color: #FFFFFF">In 27.8.1.6 basic_ifstream
constructors [lib.ifstream.cons] </span></i>
@@ -2449,8 +2499,8 @@
functions:</i></span></p>
<blockquote>
- <pre><span style="background-color: #FFFFFF">template <class Path> explicit basic_ofstream(const Path& p, ios_base::openmode mode = ios_base::out);
-template <class Path> void open(const Path& p, ios_base::openmode mode = ios_base::out);</span></pre>
+ <pre><span style="background-color: #FFFFFF">explicit basic_ofstream(const path& p, ios_base::openmode mode = ios_base::out);
+void open(const path& p, ios_base::openmode mode = ios_base::out);</span></pre>
</blockquote>
<p><i><span style="background-color: #FFFFFF">In 27.8.1.9 basic_ofstream
constructors [lib.ofstream.cons] </span></i>
@@ -2483,8 +2533,8 @@
<p><span style="background-color: #FFFFFF"><i>In 27.8.1.11 Class template
basic_fstream [lib.fstream] synopsis preceding paragraph 1, add the functions:</i></span></p>
<blockquote>
- <pre><span style="background-color: #FFFFFF">template <class Path> explicit basic_fstream(const Path& p, ios_base::openmode mode = ios_base::in|ios_base::out);
-template <class Path> void open(const Path& p, ios_base::openmode mode = ios_base::in|ios_base::out);</span></pre>
+ <pre><span style="background-color: #FFFFFF">explicit basic_fstream(const path& p, ios_base::openmode mode = ios_base::in|ios_base::out);
+void open(const path& p, ios_base::openmode mode = ios_base::in|ios_base::out);</span></pre>
</blockquote>
<p><i><span style="background-color: #FFFFFF">In 27.8.1.12 basic_fstream
constructors [lib.fstream.cons] </span></i>
@@ -3013,7 +3063,7 @@
implementation follows encouraged behavior.</span></p>
<p><span style="background-color: #FFFFFF">For most of the Filesystem Library,
there is no existing code, so the issue preserving existing code that uses
-slashes in filenames doesn't arise. New code simply must use basic_path
+slashes in filenames doesn't arise. New code simply must use path
constructors with <code>path_format_t</code> arguments of <code>native</code>.
To preserve existing fstream code that uses slashes in filenames, an
implementation may wish to provide a mechanism such as a macro to control
@@ -3072,7 +3122,7 @@
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->06 July 2008<!--webbot bot="Timestamp" endspan i-checksum="18830" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->23 August 2009<!--webbot bot="Timestamp" endspan i-checksum="31532" --></p>
</body>
Modified: sandbox/filesystem-v3/libs/filesystem/src/operations.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/operations.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/operations.cpp 2009-08-23 09:38:21 EDT (Sun, 23 Aug 2009)
@@ -1439,14 +1439,14 @@
void dispatch( const directory_entry & de, std::wstring & to, const codecvt_type & )
{
- to = de.path().rep();
+ to = de.path().native();
}
# else
void dispatch( const directory_entry & de, std::string & to, const codecvt_type & )
{
- to = de.path().rep();
+ to = de.path().native();
}
# endif
Modified: sandbox/filesystem-v3/libs/filesystem/src/path.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/path.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/path.cpp 2009-08-23 09:38:21 EDT (Sun, 23 Aug 2009)
@@ -130,41 +130,55 @@
# ifdef BOOST_WINDOWS_PATH
- // generic ---------------------------------------------------------------//
+ const std::string path::native_string() const
+ {
+ std::string tmp;
+ if ( !m_path.empty() )
+ path_traits::convert( &*m_path.begin(), &*m_path.begin()+m_path.size(),
+ tmp, codecvt() );
+ return tmp;
+ }
- const path path::generic() const
+ void path::m_portable()
{
- path tmp;
-
- for ( string_type::const_iterator it = m_path.begin();
+ for ( string_type::iterator it = m_path.begin();
it != m_path.end(); ++it )
{
- tmp.m_path += *it != L'\\' ? *it : L'/';
+ if ( *it == L'\\' )
+ *it = L'/';
}
+ }
- return tmp;
+ const std::string path::string() const
+ {
+ path tmp( *this );
+ tmp.m_portable();
+ return tmp.native_string();
}
-
- // native ---------------------------------------------------------------//
- const path path::preferred() const
- {
- path tmp;
+ const std::wstring path::wstring() const
+ {
+ path tmp( *this );
+ tmp.m_portable();
+ return tmp.native_wstring();
+ }
- for ( string_type::const_iterator it = m_path.begin();
+ path & path::localize()
+ {
+ for ( string_type::iterator it = m_path.begin();
it != m_path.end(); ++it )
{
- tmp.m_path += *it != L'/' ? *it : L'\\';
+ if ( *it == L'/' )
+ *it = L'\\';
}
-
- return tmp;
+ return *this;
}
# endif // BOOST_WINDOWS_PATH
- // append_separator_if_needed_ -------------------------------------------//
+ // m_append_separator_if_needed -----------------------------------------//
- void path::append_separator_if_needed_()
+ void path::m_append_separator_if_needed()
{
if ( !m_path.empty() &&
# ifdef BOOST_WINDOWS_PATH
Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp 2009-08-23 09:38:21 EDT (Sun, 23 Aug 2009)
@@ -822,7 +822,7 @@
== fs::initial_path() / "foo" );
fs::path p1( fs::system_complete( "/foo" ) );
- BOOST_TEST_EQ( p1.size(), 6 ); // this failed during v3 development due to bug
+ BOOST_TEST_EQ( p1.string().size(), 6 ); // this failed during v3 development due to bug
std::string s1( p1.string() );
std::string s2( fs::initial_path().root_path().string()+"foo" );
BOOST_TEST_EQ( s1, s2 );
@@ -836,11 +836,11 @@
== fs::initial_path() );
BOOST_TEST( fs::system_complete( fs::path( fs::initial_path().root_name().string()
+ "foo" ) ).string() == fs::initial_path() / "foo" );
- BOOST_TEST( fs::system_complete( fs::path( "c:/" ) ).generic()
+ BOOST_TEST( fs::system_complete( fs::path( "c:/" ) ).string()
== "c:/" );
- BOOST_TEST( fs::system_complete( fs::path( "c:/foo" ) ).generic()
+ BOOST_TEST( fs::system_complete( fs::path( "c:/foo" ) ).string()
== "c:/foo" );
- BOOST_TEST( fs::system_complete( fs::path( "//share" ) ).generic()
+ BOOST_TEST( fs::system_complete( fs::path( "//share" ) ).string()
== "//share" );
} // Windows
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_test.cpp 2009-08-23 09:38:21 EDT (Sun, 23 Aug 2009)
@@ -33,7 +33,6 @@
#include <boost/detail/lightweight_test.hpp>
#define PATH_CHECK( a, b ) check( a, b, __FILE__, __LINE__ )
-#define DIR_CHECK( a, b ) check_dir( a, b, __FILE__, __LINE__ )
#define CHECK_EQUAL( a,b ) check_equal( a, b, __FILE__, __LINE__ )
@@ -44,29 +43,16 @@
void check( const fs::path & source,
const std::string & expected, const char* file, int line )
{
- if ( source.string()== expected ) return;
+ if ( source.native_string()== expected ) return;
std::cout << file
- << '(' << line << "): source.string(): \"" << source.string()
+ << '(' << line << "): source.native_string(): \"" << source.native_string()
<< "\" != expected: \"" << expected
<< "\"" << std::endl;
BOOST_ERROR(0); // increment error count
}
- void check_dir( const fs::path & source,
- const std::string & expected, const char* file, int line )
- {
- if ( source.string() == expected ) return;
-
- ++::boost::detail::test_errors();
-
- std::cout << file << '(' << line << "): source.directory_string(): \""
- << source.string()
- << "\" != expected: \"" << expected
- << "\"" << std::endl;
- }
-
void check_equal( const fs::path & source,
const std::string & expected, const char* file, int line )
{
@@ -414,11 +400,11 @@
PATH_CHECK( path("") / "..", ".." );
if ( platform == "Windows" )
{
- BOOST_TEST( (b / a).string() == "b\\a" );
- BOOST_TEST( (bs / a).string() == "b\\a" );
- BOOST_TEST( (bcs / a).string() == "b\\a" );
- BOOST_TEST( (b / as).string() == "b\\a" );
- BOOST_TEST( (b / acs).string() == "b\\a" );
+ BOOST_TEST( (b / a).native_string() == "b\\a" );
+ BOOST_TEST( (bs / a).native_string() == "b\\a" );
+ BOOST_TEST( (bcs / a).native_string() == "b\\a" );
+ BOOST_TEST( (b / as).native_string() == "b\\a" );
+ BOOST_TEST( (b / acs).native_string() == "b\\a" );
PATH_CHECK( path("a") / "b", "a\\b" );
PATH_CHECK( path("..") / "", "..\\" );
PATH_CHECK( path("foo") / path("bar"), "foo\\bar" ); // path arg
@@ -1039,9 +1025,9 @@
else
{ // POSIX
- DIR_CHECK( path( "/foo/bar/" ), "/foo/bar/" );
- DIR_CHECK( path( "//foo//bar//" ), "//foo//bar//" );
- DIR_CHECK( path( "///foo///bar///" ), "///foo///bar///" );
+ PATH_CHECK( path( "/foo/bar/" ), "/foo/bar/" );
+ PATH_CHECK( path( "//foo//bar//" ), "//foo//bar//" );
+ PATH_CHECK( path( "///foo///bar///" ), "///foo///bar///" );
p = path( "/usr/local/bin:/usr/bin:/bin" );
BOOST_TEST( p.string() == "/usr/local/bin:/usr/bin:/bin" );
@@ -1065,30 +1051,24 @@
PATH_CHECK( "foo/../", "foo/../" );
PATH_CHECK( "foo/bar/../..", "foo/bar/../.." );
PATH_CHECK( "foo/bar/../../", "foo/bar/../../" );
- PATH_CHECK( path("") / "foo", "foo" );
- PATH_CHECK( path("") / "foo/", "foo/" );
- PATH_CHECK( path("foo") / "", "foo\\" );
PATH_CHECK( path( "/" ), "/" );
- PATH_CHECK( path( "/" ) / "", "/" );
PATH_CHECK( path( "/f" ), "/f" );
PATH_CHECK( "/foo", "/foo" );
- PATH_CHECK( path("") / "/foo", "/foo" );
- PATH_CHECK( path("/foo") / "", "/foo\\" );
- DIR_CHECK( path( "/foo/bar/" ), "/foo/bar/" );
- DIR_CHECK( path( "//foo//bar//" ), "//foo//bar//" );
- DIR_CHECK( path( "///foo///bar///" ), "///foo///bar///" );
- DIR_CHECK( path( "\\/foo\\/bar\\/" ), "\\/foo\\/bar\\/" );
- DIR_CHECK( path( "\\//foo\\//bar\\//" ), "\\//foo\\//bar\\//" );
+ PATH_CHECK( path( "/foo/bar/" ), "/foo/bar/" );
+ PATH_CHECK( path( "//foo//bar//" ), "//foo//bar//" );
+ PATH_CHECK( path( "///foo///bar///" ), "///foo///bar///" );
+ PATH_CHECK( path( "\\/foo\\/bar\\/" ), "\\/foo\\/bar\\/" );
+ PATH_CHECK( path( "\\//foo\\//bar\\//" ), "\\//foo\\//bar\\//" );
if ( platform == "Windows" )
{
PATH_CHECK( path("c:") / "foo", "c:foo" );
PATH_CHECK( path("c:") / "/foo", "c:/foo" );
- DIR_CHECK( path( "\\foo\\bar\\" ), "\\foo\\bar\\" );
- DIR_CHECK( path( "\\\\foo\\\\bar\\\\" ), "\\\\foo\\\\bar\\\\" );
- DIR_CHECK( path( "\\\\\\foo\\\\\\bar\\\\\\" ), "\\\\\\foo\\\\\\bar\\\\\\" );
+ PATH_CHECK( path( "\\foo\\bar\\" ), "\\foo\\bar\\" );
+ PATH_CHECK( path( "\\\\foo\\\\bar\\\\" ), "\\\\foo\\\\bar\\\\" );
+ PATH_CHECK( path( "\\\\\\foo\\\\\\bar\\\\\\" ), "\\\\\\foo\\\\\\bar\\\\\\" );
PATH_CHECK( path( "\\" ), "\\" );
PATH_CHECK( path( "\\f" ), "\\f" );
@@ -1186,7 +1166,30 @@
PATH_CHECK( ".././.", ".././." );
}
- // name_function_tests ---------------------------------------------------//
+ // append_tests --------------------------------------------------------------------//
+
+ void append_tests()
+ {
+ std::cout << "append_tests..." << std::endl;
+
+ if ( platform == "Windows" )
+ {
+ }
+ else
+ {
+ }
+
+
+ PATH_CHECK( path("") / "foo", "foo" );
+ PATH_CHECK( path("") / "foo/", "foo/" );
+ PATH_CHECK( path( "/" ) / "", "/" );
+ PATH_CHECK( path("") / "/foo", "/foo" );
+ PATH_CHECK( path("foo") / "", "foo\\" );
+ PATH_CHECK( path("/foo") / "", "/foo\\" );
+
+ }
+
+ // name_function_tests -------------------------------------------------------------//
void name_function_tests()
{
@@ -1352,6 +1355,7 @@
BOOST_TEST( p4.string() == "foobar" );
construction_tests();
+ append_tests();
overload_tests();
query_and_decomposition_tests();
iterator_tests();
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp 2009-08-23 09:38:21 EDT (Sun, 23 Aug 2009)
@@ -94,43 +94,43 @@
path x0; // default constructor
PATH_IS(x0, L"");
- BOOST_TEST_EQ( x0.size(), 0 );
+ BOOST_TEST_EQ( x0.native().size(), 0 );
path x1(s.begin(), s.end()); // iterator range char
PATH_IS(x1, L"string");
- BOOST_TEST_EQ( x1.size(), 6 );
+ BOOST_TEST_EQ( x1.native().size(), 6 );
path x2(x1); // copy constructor
PATH_IS(x2, L"string");
- BOOST_TEST_EQ( x2.size(), 6 );
+ BOOST_TEST_EQ( x2.native().size(), 6 );
path x3(ws.begin(), ws.end()); // iterator range wchar_t
PATH_IS(x3, L"wstring");
- BOOST_TEST_EQ( x3.size(), 7 );
+ BOOST_TEST_EQ( x3.native().size(), 7 );
path x4(string("std::string")); // container char
PATH_IS(x4, L"std::string");
- BOOST_TEST_EQ( x4.size(), 11 );
+ BOOST_TEST_EQ( x4.native().size(), 11 );
path x5(wstring(L"std::wstring")); // container wchar_t
PATH_IS(x5, L"std::wstring");
- BOOST_TEST_EQ( x5.size(), 12 );
+ BOOST_TEST_EQ( x5.native().size(), 12 );
path x6("array char"); // array char
PATH_IS(x6, L"array char");
- BOOST_TEST_EQ( x6.size(), 10 );
+ BOOST_TEST_EQ( x6.native().size(), 10 );
path x7(L"array wchar_t"); // array wchar_t
PATH_IS(x7, L"array wchar_t");
- BOOST_TEST_EQ( x7.size(), 13 );
+ BOOST_TEST_EQ( x7.native().size(), 13 );
path x8( s.c_str() ); // const char * null terminated
PATH_IS(x8, L"string");
- BOOST_TEST_EQ( x8.size(), 6 );
+ BOOST_TEST_EQ( x8.native().size(), 6 );
path x9( ws.c_str() ); // const wchar_t * null terminated
PATH_IS(x9, L"wstring");
- BOOST_TEST_EQ( x9.size(), 7 );
+ BOOST_TEST_EQ( x9.native().size(), 7 );
}
path x;
@@ -144,11 +144,11 @@
x = path("yet another path"); // another path
PATH_IS(x, L"yet another path");
- BOOST_TEST_EQ( x.size(), 16 );
+ BOOST_TEST_EQ( x.native().size(), 16 );
x = x; // self-assignment
PATH_IS(x, L"yet another path");
- BOOST_TEST_EQ( x.size(), 16 );
+ BOOST_TEST_EQ( x.native().size(), 16 );
x.assign(s.begin(), s.end()); // iterator range char
PATH_IS(x, L"string");
@@ -187,15 +187,26 @@
# define BOOST_FS_FOO L"/foo/"
# endif
+ x = "/foo";
+ x /= path(""); // empty path
+ PATH_IS(x, BOOST_FS_FOO);
+
+ x = "/foo";
+ x /= path("/"); // slash path
+ PATH_IS(x, BOOST_FS_FOO L"/");
+
+ x = "/foo";
+ x /= path("/boo"); // slash path
+ PATH_IS(x, BOOST_FS_FOO L"/boo");
+
+ x = "/foo";
+ x /= x; // self-assignment
+ PATH_IS(x, BOOST_FS_FOO BOOST_FS_FOO );
x = "/foo";
x /= path("yet another path"); // another path
PATH_IS(x, BOOST_FS_FOO L"yet another path");
- //x = "/foo";
- //x /= x; // self-assignment
- //PATH_IS(x, BOOST_FS_FOO L"yet another path" BOOST_FS_FOO L"yet another path");
-
x = "/foo";
x.append(s.begin(), s.end()); // iterator range char
PATH_IS(x, BOOST_FS_FOO L"string");
@@ -237,26 +248,26 @@
path p0( "abc" );
- CHECK( p0.rep().size() == 3 );
- CHECK( p0.string() == "abc" );
- CHECK( p0.string().size() == 3 );
- CHECK( p0.wstring() == L"abc" );
- CHECK( p0.wstring().size() == 3 );
+ CHECK( p0.native().size() == 3 );
+ CHECK( p0.native_string() == "abc" );
+ CHECK( p0.native_string().size() == 3 );
+ CHECK( p0.native_wstring() == L"abc" );
+ CHECK( p0.native_wstring().size() == 3 );
# ifdef BOOST_WINDOWS_PATH
path p( "abc\\def/ghi" );
- CHECK( wstring( p.c_str() ) == L"abc\\def/ghi" );
+ CHECK( std::wstring( p.c_str() ) == L"abc\\def/ghi" );
- CHECK( p.string() == "abc\\def/ghi" );
- CHECK( p.wstring() == L"abc\\def/ghi" );
+ CHECK( p.native_string() == "abc\\def/ghi" );
+ CHECK( p.native_wstring() == L"abc\\def/ghi" );
- CHECK( p.generic().string() == "abc/def/ghi" );
- CHECK( p.generic().wstring() == L"abc/def/ghi" );
+ CHECK( p.string() == "abc/def/ghi" );
+ CHECK( p.wstring() == L"abc/def/ghi" );
- CHECK( p.preferred().string() == "abc\\def\\ghi" );
- CHECK( p.preferred().wstring() == L"abc\\def\\ghi" );
+ //CHECK( p.preferred().string() == "abc\\def\\ghi" );
+ //CHECK( p.preferred().wstring() == L"abc\\def\\ghi" );
# else // BOOST_POSIX_PATH
@@ -359,15 +370,15 @@
// operator /
- CHECK( p1 / p2 == path( "foo/bar" ).preferred() );
- CHECK( "foo" / p2 == path( "foo/bar" ).preferred() );
- CHECK( L"foo" / p2 == path( "foo/bar" ).preferred() );
- CHECK( string( "foo" ) / p2 == path( "foo/bar" ).preferred() );
- CHECK( wstring( L"foo" ) / p2 == path( "foo/bar" ).preferred() );
- CHECK( p1 / "bar" == path( "foo/bar" ).preferred() );
- CHECK( p1 / L"bar" == path( "foo/bar" ).preferred() );
- CHECK( p1 / string( "bar" ) == path( "foo/bar" ).preferred() );
- CHECK( p1 / wstring( L"bar" ) == path( "foo/bar" ).preferred() );
+ CHECK( p1 / p2 == path( "foo/bar" ).localize() );
+ CHECK( "foo" / p2 == path( "foo/bar" ).localize() );
+ CHECK( L"foo" / p2 == path( "foo/bar" ).localize() );
+ CHECK( string( "foo" ) / p2 == path( "foo/bar" ).localize() );
+ CHECK( wstring( L"foo" ) / p2 == path( "foo/bar" ).localize() );
+ CHECK( p1 / "bar" == path( "foo/bar" ).localize() );
+ CHECK( p1 / L"bar" == path( "foo/bar" ).localize() );
+ CHECK( p1 / string( "bar" ) == path( "foo/bar" ).localize() );
+ CHECK( p1 / wstring( L"bar" ) == path( "foo/bar" ).localize() );
swap( p1, p2 );
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk