|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59844 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/doc libs/filesystem/example libs/filesystem/src libs/filesystem/test
From: bdawes_at_[hidden]
Date: 2010-02-22 06:54:33
Author: bemandawes
Date: 2010-02-22 06:54:32 EST (Mon, 22 Feb 2010)
New Revision: 59844
URL: http://svn.boost.org/trac/boost/changeset/59844
Log:
Add relationals, plus beta 1 doc WIP
Text files modified:
sandbox/filesystem-v3/boost/filesystem/operations.hpp | 19 +++-
sandbox/filesystem-v3/libs/filesystem/doc/reference.html | 150 +++++++++++++++++++++++++--------------
sandbox/filesystem-v3/libs/filesystem/doc/tutorial.html | 73 ++++++++++---------
sandbox/filesystem-v3/libs/filesystem/doc/v3.html | 20 ++--
sandbox/filesystem-v3/libs/filesystem/example/tut3.cpp | 16 +--
sandbox/filesystem-v3/libs/filesystem/example/tut4.cpp | 7 -
sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 4
sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp | 21 +++++
8 files changed, 189 insertions(+), 121 deletions(-)
Modified: sandbox/filesystem-v3/boost/filesystem/operations.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/operations.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/operations.hpp 2010-02-22 06:54:32 EST (Mon, 22 Feb 2010)
@@ -452,18 +452,18 @@
directory_entry() {}
explicit directory_entry(const boost::filesystem::path& p,
file_status st = file_status(), file_status symlink_st=file_status())
- : m_pathname(p), m_status(st), m_symlink_status(symlink_st)
+ : m_path(p), m_status(st), m_symlink_status(symlink_st)
{}
void assign(const boost::filesystem::path& p,
file_status st = file_status(), file_status symlink_st = file_status())
- { m_pathname = p; m_status = st; m_symlink_status = symlink_st; }
+ { m_path = p; m_status = st; m_symlink_status = symlink_st; }
void replace_filename(const boost::filesystem::path& p,
file_status st = file_status(), file_status symlink_st = file_status())
{
- m_pathname.remove_filename();
- m_pathname /= p;
+ m_path.remove_filename();
+ m_path /= p;
m_status = st;
m_symlink_status = symlink_st;
}
@@ -474,14 +474,21 @@
{ replace_filename(p, st, symlink_st); }
# endif
- const boost::filesystem::path& path() const {return m_pathname;}
+ const boost::filesystem::path& path() const {return m_path;}
file_status status() const {return m_get_status();}
file_status status(system::error_code& ec) const {return m_get_status(&ec);}
file_status symlink_status() const {return m_get_symlink_status();}
file_status symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);}
+ bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;}
+ bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;}
+ bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;}
+ bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;}
+ bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;}
+ bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;}
+
private:
- boost::filesystem::path m_pathname;
+ boost::filesystem::path m_path;
mutable file_status m_status; // stat()-like
mutable file_status m_symlink_status; // lstat()-like
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 2010-02-22 06:54:32 EST (Mon, 22 Feb 2010)
@@ -549,27 +549,27 @@
const u32string generic_u32string() const; // ditto
// 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;
+ 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 has_root_name() const;
- bool has_root_directory() const;
- bool has_root_path() const;
- bool has_relative_path() const;
- bool has_parent_path() const;
- bool has_filename() const;
- bool has_stem() const;
- bool has_extension() const;
- bool is_absolute() const;
- bool is_relative() const;
+ bool empty() const;
+ bool has_root_name() const;
+ bool has_root_directory() const;
+ bool has_root_path() const;
+ bool has_relative_path() const;
+ bool has_parent_path() const;
+ bool has_filename() const;
+ bool has_stem() const;
+ bool has_extension() const;
+ bool is_absolute() const;
+ bool is_relative() const;
// iterators
class iterator;
@@ -918,33 +918,29 @@
<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>
-<pre>path root_name() const;</pre>
+<pre>path <a name="path-root_name">root_name</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <i>root-name,</i> if <code>pathname</code> includes <i>
root-name</i>, otherwise <code>path()</code>. </p>
</blockquote>
-<pre>path root_directory() const;</pre>
+<pre>path <a name="path-root_directory">root_directory</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <i>root-directory</i>, if <code>pathname</code> includes <i>
root-directory</i>, otherwise <code>path()</code>.</p>
<p>If <i>root-directory</i> is composed of <i>slash name</i>, <i>slash</i> is
excluded from the returned string.</p>
</blockquote>
-<pre>path root_path() const;</pre>
+<pre>path <a name="path-root_path">root_path</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>root_name() / root_directory()</code></p>
</blockquote>
-<pre>path relative_path() const;</pre>
+<pre>path <a name="path-relative_path">relative_path</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> A <code>path</code> composed from <code>pathname</code>, if <code>
!empty()</code>, beginning
with the first <i>filename</i> after <i>root-path</i>. Otherwise, <code>path()</code>.</p>
</blockquote>
-<pre>path <a name="path-filename">filename</a>() const;</pre>
-<blockquote>
- <p><i>Returns:</i> <code>empty() ? path() : *--end()</code></p>
-</blockquote>
-<pre>path parent_path() const;</pre>
+<pre>path <a name="path-parent_path">parent_path</a>() const;</pre>
<blockquote>
<p><i>Returns:</i> <code>(empty() || begin() == --end()) ? path() : <i>pp</i></code>, where
<code><i>pp</i></code> is constructed as if by
@@ -952,7 +948,13 @@
operator/=</code> for each element in the range <code>begin()</code>, <code>
--end()</code>.</p>
</blockquote>
-<pre>path stem(const path& p) const;</pre>
+<pre>path <a name="path-filename">filename</a>() const;</pre>
+<blockquote>
+ <p><i>Returns:</i> <code>empty() ? path() : *--end()</code></p>
+ <p>[<i>Example:</i> <code>std::cout << path("/foo/bar.txt").filename();</code>
+ outputs "<code>bar.txt</code>" (without the quotes). <i>--end example</i>]</p>
+</blockquote>
+<pre>path <a name="path-stem">stem</a>(const path& p) const;</pre>
<blockquote>
<p><i>Returns:</i> if <code>p.filename()</code>contains a dot but does not
consist solely of one or to two dots, returns
@@ -960,14 +962,18 @@
ending at the last dot (the dot is not included). Otherwise,
returns <code>
p.filename()</code>.</p>
+ <p>[<i>Example:</i> <code>std::cout << path("/foo/bar.txt").stem();</code>
+ outputs "<code>bar</code>" (without the quotes). <i>--end example</i>]</p>
</blockquote>
-<pre>path extension(const path& p) const;</pre>
+<pre>path <a name="path-extension">extension</a>(const path& p) const;</pre>
<blockquote>
<p><i>Returns:</i> if <code>p.filename()</code> contains a dot but does not
consist solely of one or to two dots, returns
the substring of <code>p.filename()</code> starting at the rightmost dot
and ending at the path's end. Otherwise, returns an empty <code>path</code>
object. </p>
+ <p>[<i>Example:</i> <code>std::cout << path("/foo/bar.txt").extension();</code>
+ outputs "<code>.txt</code>" (without the quotes). <i>--end example</i>]</p>
<p>[<i>Note:<b> </b></i>The dot is included in the return value so that
it is possible to distinguish between no extension and an empty extension. See
<a href="http://permalink.gmane.org/gmane.comp.lib.boost.devel/199744">
@@ -978,43 +984,43 @@
as alternate data streams or partitioned dataset names.</p>
</blockquote>
<h3> <a name="path-query"> <code><font size="4">path</font></code> query</a></h3>
-<pre>bool empty() const;</pre>
+<pre>bool <a name="path-empty">empty</a>() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>native().empty()</code>.</p>
+ <p><i>Returns:</i> <code>m_pathname.empty()</code>.</p>
</blockquote>
-<pre>bool has_root_path() const;</pre>
+<pre>bool <a name="path-has_root_path">has_root_path</a>() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>!root_path().empty()</code></p>
+ <p><i>Returns:</i> <code>!root_path().empty()</code></p>
</blockquote>
-<pre>bool has_root_name() const;</pre>
+<pre>bool <a name="path-has_root_name">has_root_name</a>() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>!root_name().empty()</code></p>
+ <p><i>Returns:</i> <code>!root_name().empty()</code></p>
</blockquote>
-<pre>bool has_root_directory() const;</pre>
+<pre>bool <a name="path-has_root_directory">has_root_directory</a>() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>!root_directory().empty()</code></p>
+ <p><i>Returns:</i> <code>!root_directory().empty()</code></p>
</blockquote>
-<pre>bool has_relative_path() const;</pre>
+<pre>bool <a name="path-has_relative_path">has_relative_path</a>() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>!relative_path().empty()</code></p>
+ <p><i>Returns:</i> <code>!relative_path().empty()</code></p>
</blockquote>
-<pre>bool has_parent_path() const;</pre>
+<pre>bool <a name="path-has_parent_path">has_parent_path</a>() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>!parent_path().empty()</code></p>
+ <p><i>Returns:</i> <code>!parent_path().empty()</code></p>
</blockquote>
-<pre>bool has_filename() const;</pre>
+<pre>bool <a name="path-has_filename">has_filename</a>() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>!filename().empty()</code></p>
+ <p><i>Returns:</i> <code>!filename().empty()</code></p>
</blockquote>
-<pre>bool has_stem() const;</pre>
+<pre>bool <a name="path-has_stem">has_stem</a>() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>!</code><code>stem().empty()</code></p>
+ <p><i>Returns:</i> <code>!stem().empty()</code></p>
</blockquote>
-<pre>bool has_extension() const;</pre>
+<pre>bool <a name="path-has_extension">has_extension</a>() const;</pre>
<blockquote>
- <p><i>Returns:</i> <code>!extension().empty()</code></p>
+ <p><i>Returns:</i> <code>!extension().empty()</code></p>
</blockquote>
-<pre>bool is_absolute() const;</pre>
+<pre>bool <a name="path-is_absolute">is_absolute</a>() const;</pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>true</code>
if the elements of <code>root_path()</code> uniquely identify a directory, else <code>false</code>.</span></p>
@@ -1022,7 +1028,7 @@
path("/foo").is_absolute()</code> returns <code>true</code>. On Windows, <code>
path("/foo").is_absolute()</code> returns <code>false</code>. <i>--end note</i>]</span></p>
</blockquote>
-<pre>bool is_relative() const;</pre>
+<pre>bool <a name="path-is_relative">is_relative</a>() const;</pre>
<blockquote>
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>!is_absolute()</code>.</span></p>
</blockquote>
@@ -1345,12 +1351,20 @@
// modifiers
directory_entry& operator=(const directory_entry&);
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());
+ void replace_filename(const path& p, <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;
<span style="background-color: #FFFFFF"> file_status status(system::error_code& ec) const;
file_status symlink_status(system::error_code& ec) const;
+
+ bool operator< (const directory_entry& rhs);
+ bool operator==(const directory_entry& rhs);
+ bool operator!=(const directory_entry& rhs);
+ bool operator< (const directory_entry& rhs);
+ bool operator<=(const directory_entry& rhs);
+ bool operator> (const directory_entry& rhs);
+ bool operator>=(const directory_entry& rhs);
</span><span style="background-color: #FFFF00">
</span> private:
path_type m_path; // for exposition only
@@ -1443,7 +1457,7 @@
</tr>
</table>
</blockquote>
-<pre>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());</pre>
+<pre>void replace_filename(const path& 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="43%">
@@ -1499,6 +1513,36 @@
<p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>
m_symlink_status</code></span></p>
</blockquote>
+<pre><span style="background-color: #FFFFFF">bool operator==(const directory_entry& rhs);</span></pre>
+<blockquote>
+ <p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path ==
+ rhs.m_path</code>.</span></p>
+</blockquote>
+<pre><span style="background-color: #FFFFFF">bool operator!=(const directory_entry& rhs);</span></pre>
+<blockquote>
+ <p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path !=
+ rhs.m_path</code>.</span></p>
+</blockquote>
+<pre><span style="background-color: #FFFFFF">bool operator< (const directory_entry& rhs);</span></pre>
+<blockquote>
+ <p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path <
+ rhs.m_path</code>.</span></p>
+</blockquote>
+<pre><span style="background-color: #FFFFFF">bool operator<=(const directory_entry& rhs);</span></pre>
+<blockquote>
+ <p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path <=
+ rhs.m_path</code>.</span></p>
+</blockquote>
+<pre><span style="background-color: #FFFFFF">bool operator> (const directory_entry& rhs);</span></pre>
+<blockquote>
+ <p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path >
+ rhs.m_path</code>.</span></p>
+</blockquote>
+<pre><span style="background-color: #FFFFFF">bool operator>=(const directory_entry& rhs);</span></pre>
+<blockquote>
+ <p><span style="background-color: #FFFFFF"><i>Returns:</i> <code>m_path >=
+ rhs.m_path</code>.</span></p>
+</blockquote>
<h3><a name="Class-directory_iterator">Class <code>directory_iterator</code></a></h3>
<p>Objects of type <code>directory_iterator</code> provide standard library
compliant iteration over the contents of a directory. Also see class <code>
@@ -3099,7 +3143,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 -->20 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40539" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->22 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40543" --></p>
</body>
Modified: sandbox/filesystem-v3/libs/filesystem/doc/tutorial.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/tutorial.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/tutorial.html 2010-02-22 06:54:32 EST (Mon, 22 Feb 2010)
@@ -150,7 +150,8 @@
</tr>
</table>
-<p>The Boost.Filesystem <code>file_size</code> function returns an <code>uintmax_t</code>
+<p>The Boost.Filesystem <code>file_size</code>
+function returns a <code>uintmax_t</code>
containing the size of the file named by the argument. The declaration looks
like this:</p>
@@ -271,12 +272,12 @@
cout << p << ": "; // utilize the path narrow stream inserter
- if ( exists(p) ) // does p actually exist?
+ if (exists(p)) // does p actually exist?
{
- if ( is_regular_file(p) ) // is p a regular file?
+ if (is_regular_file(p)) // is p a regular file?
cout << file_size(p) << '\n';
- else if ( is_directory(p) ) // is p a directory?
+ else if (is_directory(p)) // is p a directory?
cout << "is a directory\n";
else
@@ -335,10 +336,10 @@
<p>The value type of <code>directory_iterator</code> is <code>
<a href="reference.html#directory_entry">directory_entry</a></code>. A <code>
-directory_entry</code> contains a <code>path</code> and symlink/non-symlink
-resolving <code>file_status</code>
-caches, and
-can be passed to <code>path</code> arguments in function calls.</p>
+directory_entry</code> object contains a <code>path</code> and <code>file_status</code>
+information. A <code>
+directory_entry</code> object
+can be used directly, but can also be passed to <code>path</code> arguments in function calls.</p>
<table align="center" border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" width="90%">
<tr>
@@ -351,25 +352,19 @@
cout << p << ": "; // utilize the path narrow stream inserter
- if ( exists(p) ) // does p actually exist?
+ if (exists(p)) // does p actually exist?
{
- if ( is_regular_file(p) ) // is p a regular file?
+ if (is_regular_file(p)) // is p a regular file?
cout << file_size(p) << '\n';
- else if ( is_directory(p) ) // is p a directory?
+ else if (is_directory(p)) // is p a directory?
{
cout << "is a directory containing:\n";
- for ( directory_iterator it (p); // initialize it to the first element
- it != directory_iterator(); // test for the past-the-end element
- ++it ) // increment
- {
- cout << " " << *it << '\n'; // *it returns a directory_entry,
- // which is converted to a path by the
- // stream inserter.
- // it->path() would be wordier, but would
- // eliminate an unnecessary path temporary
- }
+ copy(directory_iterator(p), directory_iterator(), // directory_iterator::value_type
+ ostream_iterator<directory_entry>(cout, "\n")); // is directory_entry, which is
+ // converted to a path by the
+ // path stream inserter
}
else
@@ -476,21 +471,21 @@
cout << p << ": "; // utilize the path narrow stream inserter
- if ( exists(p) ) // does p actually exist?
+ if (exists(p)) // does p actually exist?
{
- if ( is_regular_file(p) ) // is p a regular file?
+ if (is_regular_file(p)) // is p a regular file?
cout << file_size(p) << '\n';
- else if ( is_directory(p) ) // is p a directory?
+ else if (is_directory(p)) // is p a directory?
{
cout << "is a directory containing:\n";
typedef vector<path> vec; // store paths,
vec v; // so we can sort them later
- for ( directory_iterator it (p); // initialize it to the first element
+ for (directory_iterator it (p); // initialize it to the first element
it != directory_iterator(); // test for the past-the-end element
- ++it ) // increment
+ ++it) // increment
{
path fn = it->path().filename(); // extract the filename from the path
v.push_back(fn); // push into vector for later sorting
@@ -679,8 +674,14 @@
{ fs::ofstream f(L"smile\u263A"); }
{ fs::ofstream f(narrow_string); }
{ fs::ofstream f(wide_string); }
- // { fs::ofstream f(narrow_list); } and { fs::ofstream f(wide_list); }
- // would work, but we want to show off construction from an iterator range:
+ { fs::ofstream f(narrow_list); }
+ { fs::ofstream f(wide_list); }
+ narrow_list.pop_back();
+ narrow_list.push_back('4');
+ wide_list.pop_back();
+ wide_list.pop_back();
+ wide_list.push_back(L'4');
+ wide_list.push_back(L'\u263A');
{ fs::ofstream f(fs::path(narrow_list.begin(), narrow_list.end())); }
{ fs::ofstream f(fs::path(wide_list.begin(), wide_list.end())); }
@@ -702,7 +703,7 @@
<td width="50%" style="font-size: 10pt" valign="top">
<pre>$ ./tut5
$ ls smile*
-smile smile☺ smile2 smile2☺ smile3 smile3☺</pre>
+smile smile☺ smile2 smile2☺ smile3 smile3☺ smile4 smile4☺</pre>
</td>
<td style="font-size: 10pt" valign="top">
<pre>>tut5
@@ -712,6 +713,8 @@
smile2☺
smile3
smile3☺
+smile4
+smile4☺
smile☺</pre>
</td>
</tr>
@@ -741,8 +744,8 @@
<h2><a name="Class-path-formats">Class path: Generic format vs. Native format</a></h2>
-<p dir="ltr"><b>Class <code>path</code> deals with two different pathname
-formats - generic format and native format.</b> In the case of POSIX-like
+<p dir="ltr">Class <code>path</code> deals with two different pathname
+formats - generic format and native format. For POSIX-like
file systems, these formats are the same. But for users of Windows and
other non-POSIX file systems, the distinction is important. Even
programmers writing for POSIX-like systems need to understand the distinction if
@@ -756,7 +759,7 @@
<p dir="ltr">The <b>native format</b> is the format as defined by the particular
operating system. For Windows, either the slash or the backslash can be used as
-the directory separator character. If a drive specified or a backslash appears
+the directory separator character. If a drive specifier or a backslash appears
in a pathname on a Windows system, it is always treated as the native format.</p>
<p dir="ltr">We can use <code>tut4</code> to explore the two formats:</p>
@@ -818,7 +821,7 @@
go along.</p>
<p> <code>path_info</code> produces several dozen output lines every time it's
-invoked. We will only show the output lines we are interested in at the moment.</p>
+invoked. We will only show the output lines we are interested in at each step.</p>
<p>First we'll look at iteration over the elements of a path, and then use
iteration to illustrate the difference between generic and native format paths.</p>
@@ -1082,11 +1085,11 @@
do not throw exceptions when I/O errors occur.</p>
<hr>
-<p>© Copyright Beman Dawes 2010</p>
+<p>© Copyright Beman Dawes 2010</p>
<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 -->18 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40554" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->21 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40541" --></p>
</body>
Modified: sandbox/filesystem-v3/libs/filesystem/doc/v3.html
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/doc/v3.html (original)
+++ sandbox/filesystem-v3/libs/filesystem/doc/v3.html 2010-02-22 06:54:32 EST (Mon, 22 Feb 2010)
@@ -51,11 +51,11 @@
</li>
<li>New class path members include:<br>
<ul>
- <li><code>has_stem()</code></li>
- <li><code>has_extension()</code></li>
- <li><code>is_absolute()</code>. This renames <code>is_complete()</code>, which
+ <li><code>has_stem()</code></li>
+ <li><code>has_extension()</code></li>
+ <li><code>is_absolute()</code>. This renames <code>is_complete()</code>, which
is now deprecated.</li>
- <li><code>is_relative()</code></li>
+ <li><code>is_relative()</code></li>
<li><code>absolute()</code>. This replaces the operations function <code>
complete()</code>, which is now deprecated.</li>
<li><code>preferred()<br>
@@ -65,10 +65,10 @@
</li>
<li>New or improved operations functions include:<br>
<ul>
- <li><code>create_symlink()</code> now supported on both POSIX and Windows.</li>
- <li><code>read_symlink()</code> function added. Supported on both POSIX and
+ <li><code>create_symlink()</code> now supported on both POSIX and Windows.</li>
+ <li><code>read_symlink()</code> function added. Supported on both POSIX and
Windows. Used to read the contents of a symlink itself.</li>
- <li><code>resize_file()</code> function added. Supported on both POSIX and
+ <li><code>resize_file()</code> function added. Supported on both POSIX and
Windows. Used to shrink or grow a regular file.</li>
<li><code>unique_path()</code> function added. Supported on both POSIX and
Windows. Used to generate a secure temporary pathname.<br>
@@ -88,7 +88,7 @@
<h2>Breaking changes</h2>
-<p>To ease the transition, Versions 2 and 3 will both included in the next
+<p>To ease the transition, Versions 2 and 3 will both be included in the next
several Boost releases. Version 2 will be the default version for one release
cycle, and then Version 3 will become the default version.</p>
<h3>Class <code>path</code></h3>
@@ -115,7 +115,7 @@
This impacts primarily Cygwin users; versions prior to 1.7 are no longer
supported.<br>
</li>
- <li>Microsoft VC++ 7.1 and earlier are not currently supported.</li>
+ <li>Microsoft VC++ 7.1 and earlier are no longer supported.</li>
</ul>
<hr>
@@ -123,7 +123,7 @@
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->17 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40552" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->18 February 2010<!--webbot bot="Timestamp" endspan i-checksum="40554" --></p>
</body>
Modified: sandbox/filesystem-v3/libs/filesystem/example/tut3.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/example/tut3.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/example/tut3.cpp 2010-02-22 06:54:32 EST (Mon, 22 Feb 2010)
@@ -8,6 +8,8 @@
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
+#include <iterator>
+#include <algorithm>
#include <boost/filesystem.hpp>
using namespace std;
using namespace boost::filesystem;
@@ -33,16 +35,10 @@
{
cout << "is a directory containing:\n";
- for (directory_iterator it (p); // initialize it to the first element
- it != directory_iterator(); // test for the past-the-end element
- ++it) // increment
- {
- cout << " " << *it << '\n'; // *it returns a directory_entry,
- // which is converted to a path
- // by the stream inserter.
- // it->path() would be wordier, but would
- // eliminate an unnecessary path temporary
- }
+ copy(directory_iterator(p), directory_iterator(), // directory_iterator::value_type
+ ostream_iterator<directory_entry>(cout, "\n")); // is directory_entry, which is
+ // converted to a path by the
+ // path stream inserter
}
else
cout << "exists, but is neither a regular file nor a directory\n";
Modified: sandbox/filesystem-v3/libs/filesystem/example/tut4.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/example/tut4.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/example/tut4.cpp 2010-02-22 06:54:32 EST (Mon, 22 Feb 2010)
@@ -8,6 +8,7 @@
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
+#include <iterator>
#include <vector>
#include <algorithm>
#include <boost/filesystem.hpp>
@@ -38,9 +39,7 @@
typedef vector<path> vec; // store paths,
vec v; // so we can sort them later
- for (directory_iterator it (p); // initialize it to the first element
- it != directory_iterator(); // test for the past-the-end element
- ++it) // increment
+ for (directory_iterator it(p), it_end; it != it_end; ++it) // iterate over directory
{
path fn = it->path().filename(); // extract the filename from the path
v.push_back(fn); // push into vector for later sorting
@@ -49,7 +48,7 @@
sort(v.begin(), v.end()); // sort, since directory iteration
// is not ordered on some file systems
- for (vec::const_iterator it (v.begin()); it != v.end(); ++it)
+ for (vec::const_iterator it(v.begin()), it_end(v.end()); it != it_end; ++it)
{
cout << " " << *it << '\n';
}
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 2010-02-22 06:54:32 EST (Mon, 22 Feb 2010)
@@ -1439,7 +1439,7 @@
m_status = m_symlink_status;
if (ec != 0) ec->clear();
}
- else m_status = detail::status(m_pathname, ec);
+ else m_status = detail::status(m_path, ec);
}
else if (ec != 0) ec->clear();
return m_status;
@@ -1449,7 +1449,7 @@
directory_entry::m_get_symlink_status(system::error_code* ec) const
{
if (!status_known(m_symlink_status))
- m_symlink_status = detail::symlink_status(m_pathname, ec);
+ m_symlink_status = detail::symlink_status(m_path, ec);
else if (ec != 0) ec->clear();
return m_symlink_status;
}
Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp 2010-02-22 06:54:32 EST (Mon, 22 Feb 2010)
@@ -1,6 +1,6 @@
// operations_unit_test.cpp ----------------------------------------------------------//
-// Copyright Beman Dawes 2008
+// Copyright Beman Dawes 2008, 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
@@ -133,6 +133,24 @@
last_write_time(".", ft, ec);
}
+ // directory_entry_test ------------------------------------------------------------//
+
+ void directory_entry_test()
+ {
+ std::cout << "directory_entry test..." << std::endl;
+
+ directory_entry de("foo.bar", file_status(regular_file), file_status(directory_file));
+
+ CHECK(de.path() == "foo.bar");
+ CHECK(de.status() == file_status(regular_file));
+ CHECK(de.symlink_status() == file_status(directory_file));
+ CHECK(de < directory_entry("goo.bar"));
+ CHECK(de == directory_entry("foo.bar"));
+ CHECK(de != directory_entry("goo.bar"));
+ de.replace_filename("bar.foo");
+ CHECK(de.path() == "bar.foo");
+ }
+
// directory_entry_overload_test ---------------------------------------------------//
void directory_entry_overload_test()
@@ -197,6 +215,7 @@
query_test();
directory_iterator_test();
operations_test();
+ directory_entry_test();
directory_entry_overload_test();
std::cout << unique_path() << std::endl;
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