Boost logo

Boost-Commit :

From: bdawes_at_[hidden]
Date: 2008-07-06 08:10:43


Author: bemandawes
Date: 2008-07-06 08:10:42 EDT (Sun, 06 Jul 2008)
New Revision: 47131
URL: http://svn.boost.org/trac/boost/changeset/47131

Log:
Rename is_regular() to is_regular_file
Text files modified:
   trunk/boost/filesystem/operations.hpp | 29 ++++++++++++++++++++++++++---
   trunk/libs/filesystem/doc/reference.html | 18 +++++++++---------
   trunk/libs/filesystem/example/mbcopy.cpp | 2 +-
   trunk/libs/filesystem/example/simple_ls.cpp | 2 +-
   trunk/libs/filesystem/test/operations_test.cpp | 27 ++++++++++++++-------------
   5 files changed, 51 insertions(+), 27 deletions(-)

Modified: trunk/boost/filesystem/operations.hpp
==============================================================================
--- trunk/boost/filesystem/operations.hpp (original)
+++ trunk/boost/filesystem/operations.hpp 2008-07-06 08:10:42 EDT (Sun, 06 Jul 2008)
@@ -102,10 +102,14 @@
 
     inline bool status_known( file_status f ) { return f.type() != status_unknown; }
     inline bool exists( file_status f ) { return f.type() != status_unknown && f.type() != file_not_found; }
- inline bool is_regular( file_status f ) { return f.type() == regular_file; }
+ inline bool is_regular_file(file_status f){ return f.type() == regular_file; }
     inline bool is_directory( file_status f ) { return f.type() == directory_file; }
     inline bool is_symlink( file_status f ) { return f.type() == symlink_file; }
- inline bool is_other( file_status f ) { return exists(f) && !is_regular(f) && !is_directory(f) && !is_symlink(f); }
+ inline bool is_other( file_status f ) { return exists(f) && !is_regular_file(f) && !is_directory(f) && !is_symlink(f); }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+ inline bool is_regular( file_status f ) { return f.type() == regular_file; }
+# endif
 
     struct space_info
     {
@@ -279,7 +283,7 @@
 # ifndef BOOST_FILESYSTEM_NO_DEPRECATED
     inline bool symbolic_link_exists( const path & ph )
       { return is_symlink( symlink_status(ph) ); }
-#endif
+# endif
 
     BOOST_FS_FUNC(bool) exists( const Path & ph )
     {
@@ -301,6 +305,17 @@
       return is_directory( result );
     }
 
+ BOOST_FS_FUNC(bool) is_regular_file( const Path & ph )
+ {
+ system::error_code ec;
+ file_status result( detail::status_api( ph.external_file_string(), ec ) );
+ if ( ec )
+ boost::throw_exception( basic_filesystem_error<Path>(
+ "boost::filesystem::is_regular_file", ph, ec ) );
+ return is_regular_file( result );
+ }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
     BOOST_FS_FUNC(bool) is_regular( const Path & ph )
     {
       system::error_code ec;
@@ -310,6 +325,7 @@
           "boost::filesystem::is_regular", ph, ec ) );
       return is_regular( result );
     }
+# endif
 
     BOOST_FS_FUNC(bool) is_other( const Path & ph )
     {
@@ -614,10 +630,17 @@
     inline bool is_directory( const wpath & ph )
       { return is_directory<wpath>( ph ); }
  
+ inline bool is_regular_file( const path & ph )
+ { return is_regular_file<path>( ph ); }
+ inline bool is_regular_file( const wpath & ph )
+ { return is_regular_file<wpath>( ph ); }
+
+# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
     inline bool is_regular( const path & ph )
       { return is_regular<path>( ph ); }
     inline bool is_regular( const wpath & ph )
       { return is_regular<wpath>( ph ); }
+# endif
 
     inline bool is_other( const path & ph )
       { return is_other<path>( ph ); }

Modified: trunk/libs/filesystem/doc/reference.html
==============================================================================
--- trunk/libs/filesystem/doc/reference.html (original)
+++ trunk/libs/filesystem/doc/reference.html 2008-07-06 08:10:42 EDT (Sun, 06 Jul 2008)
@@ -369,14 +369,14 @@
       // predicate functions
       bool status_known( file_status s );
       bool exists( file_status s );
- bool is_regular( file_status s );
+ bool is_regular_file( file_status s );
       bool is_directory( file_status s );
       bool is_symlink( file_status s );
       bool is_other( file_status s );
 
       template &lt;class Path&gt; bool exists(const Path&amp; p);
       template &lt;class Path&gt; bool is_directory(const Path&amp; p);
- template &lt;class Path&gt; bool is_regular(const Path&amp; p);
+ template &lt;class Path&gt; bool is_regular_file(const Path&amp; p);
       template &lt;class Path&gt; bool is_other(const Path&amp; p);
       template &lt;class Path&gt; bool is_symlink(const Path&amp; p);
       template &lt;class Path&gt; bool is_empty(const Path&amp; p);
@@ -1646,7 +1646,7 @@
     for (directory_iterator itr(p); itr!=directory_iterator(); ++itr)
     {
       cout &lt;&lt; itr-&gt;path().leaf() &lt;&lt; ' '; // display filename only
- if (is_regular(itr-&gt;status())) cout &lt;&lt; &quot; [&quot; &lt;&lt; file_size(itr-&gt;path()) &lt;&lt; ']';
+ if (is_regular_file(itr-&gt;status())) cout &lt;&lt; &quot; [&quot; &lt;&lt; file_size(itr-&gt;path()) &lt;&lt; ']';
       cout &lt;&lt; '\n';
     }
   }
@@ -1908,14 +1908,14 @@
 <blockquote>
   <p><i>Returns:</i> <code>exists( status(p) )</code></p>
 </blockquote>
-<pre><span style="background-color: #FFFFFF">bool </span><code><span style="background-color: #FFFFFF">is_regular</span></code><span style="background-color: #FFFFFF">(file_status</span><span style="background-color: #FFFFFF"> s);</span></pre>
+<pre><span style="background-color: #FFFFFF">bool </span><code><span style="background-color: #FFFFFF">is_regular_file</span></code><span style="background-color: #FFFFFF">(file_status</span><span style="background-color: #FFFFFF"> s);</span></pre>
 <blockquote>
   <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 &lt;class Path&gt; bool is_regular(const Path&amp; p);</code></pre>
+<pre><code>template &lt;class Path&gt; bool is_regular_file(const Path&amp; p);</code></pre>
 <blockquote>
- <p><i>Returns:</i> <code>is_regular( status(p) )</code></p>
+ <p><i>Returns:</i> <code>is_regular_file( status(p) )</code></p>
 </blockquote>
 <pre><span style="background-color: #FFFFFF">bool </span><code><span style="background-color: #FFFFFF">is_directory</span></code><span style="background-color: #FFFFFF">(file_status</span><span style="background-color: #FFFFFF"> s);</span></pre>
 <blockquote>
@@ -1938,7 +1938,7 @@
 <pre><span style="background-color: #FFFFFF">bool <a name="exists">is_other</a>(file_status s);</span></pre>
 <blockquote>
   <p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF">
- <code>return exists(s) &amp;&amp; !is_regular(s) &amp;&amp; !is_directory(s) &amp;&amp; !is_symlink(s)</code></span></p>
+ <code>return exists(s) &amp;&amp; !is_regular_file(s) &amp;&amp; !is_directory(s) &amp;&amp; !is_symlink(s)</code></span></p>
   <p><span style="background-color: #FFFFFF">[<i>Note: </i>The specification of
   <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>
@@ -2220,7 +2220,7 @@
   <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&lt;Path&gt;</code> if <code>
- from_fp.empty() || to_fp.empty() ||!exists(from_fp) || !is_regular(from_fp)
+ from_fp.empty() || to_fp.empty() ||!exists(from_fp) || !is_regular_file(from_fp)
   || exists(to_fp)</code></p>
 </blockquote>
 <pre>template &lt;class Path&gt; Path complete(const Path&amp; p, const Path&amp; base=initial_path&lt;Path&gt;());</pre>
@@ -3080,7 +3080,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 -->02 July 2008<!--webbot bot="Timestamp" endspan i-checksum="18822" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->04 July 2008<!--webbot bot="Timestamp" endspan i-checksum="18826" --></p>
 
 </body>
 

Modified: trunk/libs/filesystem/example/mbcopy.cpp
==============================================================================
--- trunk/libs/filesystem/example/mbcopy.cpp (original)
+++ trunk/libs/filesystem/example/mbcopy.cpp 2008-07-06 08:10:42 EDT (Sun, 06 Jul 2008)
@@ -72,7 +72,7 @@
   for ( fs::wdirectory_iterator it( L"." );
     it != fs::wdirectory_iterator(); ++it )
   {
- if ( fs::is_regular(it->status()) )
+ if ( fs::is_regular_file(it->status()) )
     {
       copy_file( *it, target_dir / it->leaf() );
     }

Modified: trunk/libs/filesystem/example/simple_ls.cpp
==============================================================================
--- trunk/libs/filesystem/example/simple_ls.cpp (original)
+++ trunk/libs/filesystem/example/simple_ls.cpp 2008-07-06 08:10:42 EDT (Sun, 06 Jul 2008)
@@ -53,7 +53,7 @@
           ++dir_count;
           std::cout << dir_itr->leaf() << " [directory]\n";
         }
- else if ( fs::is_regular( dir_itr->status() ) )
+ else if ( fs::is_regular_file( dir_itr->status() ) )
         {
           ++file_count;
           std::cout << dir_itr->leaf() << "\n";

Modified: trunk/libs/filesystem/test/operations_test.cpp
==============================================================================
--- trunk/libs/filesystem/test/operations_test.cpp (original)
+++ trunk/libs/filesystem/test/operations_test.cpp 2008-07-06 08:10:42 EDT (Sun, 06 Jul 2008)
@@ -300,20 +300,21 @@
   fs::path ng( " no-way, Jose" );
   BOOST_CHECK( !fs::exists( ng ) );
   BOOST_CHECK( !fs::is_directory( ng ) );
- BOOST_CHECK( !fs::is_regular( ng ) );
+ BOOST_CHECK( !fs::is_regular_file( ng ) );
+ BOOST_CHECK( !fs::is_regular( ng ) ); // verify deprecated name still works
   BOOST_CHECK( !fs::is_symlink( ng ) );
   fs::file_status stat( fs::status( ng ) );
   BOOST_CHECK( fs::status_known( stat ) );
   BOOST_CHECK( !fs::exists( stat ) );
   BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular( stat ) );
+ BOOST_CHECK( !fs::is_regular_file( stat ) );
   BOOST_CHECK( !fs::is_other( stat ) );
   BOOST_CHECK( !fs::is_symlink( stat ) );
   stat = fs::status( "" );
   BOOST_CHECK( fs::status_known( stat ) );
   BOOST_CHECK( !fs::exists( stat ) );
   BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular( stat ) );
+ BOOST_CHECK( !fs::is_regular_file( stat ) );
   BOOST_CHECK( !fs::is_other( stat ) );
   BOOST_CHECK( !fs::is_symlink( stat ) );
 
@@ -387,13 +388,13 @@
   BOOST_CHECK( fs::exists( dir ) );
   BOOST_CHECK( BOOST_FS_IS_EMPTY( dir ) );
   BOOST_CHECK( fs::is_directory( dir ) );
- BOOST_CHECK( !fs::is_regular( dir ) );
+ BOOST_CHECK( !fs::is_regular_file( dir ) );
   BOOST_CHECK( !fs::is_other( dir ) );
   BOOST_CHECK( !fs::is_symlink( dir ) );
   stat = fs::status( dir );
   BOOST_CHECK( fs::exists( stat ) );
   BOOST_CHECK( fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular( stat ) );
+ BOOST_CHECK( !fs::is_regular_file( stat ) );
   BOOST_CHECK( !fs::is_other( stat ) );
   BOOST_CHECK( !fs::is_symlink( stat ) );
 
@@ -491,7 +492,7 @@
     fs::directory_iterator dir_itr( dir );
     BOOST_CHECK( fs::exists(dir_itr->status()) );
     BOOST_CHECK( fs::is_directory(dir_itr->status()) );
- BOOST_CHECK( !fs::is_regular(dir_itr->status()) );
+ BOOST_CHECK( !fs::is_regular_file(dir_itr->status()) );
     BOOST_CHECK( !fs::is_other(dir_itr->status()) );
     BOOST_CHECK( !fs::is_symlink(dir_itr->status()) );
 
@@ -568,7 +569,7 @@
   create_file( file_ph, "" );
   BOOST_CHECK( fs::exists( file_ph ) );
   BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular( file_ph ) );
+ BOOST_CHECK( fs::is_regular_file( file_ph ) );
   BOOST_CHECK( BOOST_FS_IS_EMPTY( file_ph ) );
   BOOST_CHECK( fs::file_size( file_ph ) == 0 );
   bad_create_directory_path = file_ph;
@@ -577,7 +578,7 @@
   BOOST_CHECK( fs::status_known( stat ) );
   BOOST_CHECK( fs::exists( stat ) );
   BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( fs::is_regular( stat ) );
+ BOOST_CHECK( fs::is_regular_file( stat ) );
   BOOST_CHECK( !fs::is_other( stat ) );
   BOOST_CHECK( !fs::is_symlink( stat ) );
 
@@ -587,7 +588,7 @@
 
   BOOST_CHECK( fs::exists( file_ph ) );
   BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular( file_ph ) );
+ BOOST_CHECK( fs::is_regular_file( file_ph ) );
   BOOST_CHECK( fs::file_size( file_ph ) == 7 );
   verify_file( file_ph, "foobar1" );
 
@@ -656,7 +657,7 @@
     stat = fs::symlink_status( from_ph );
     BOOST_CHECK( fs::exists( stat ) );
     BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular( stat ) );
+ BOOST_CHECK( !fs::is_regular_file( stat ) );
     BOOST_CHECK( !fs::is_other( stat ) );
     BOOST_CHECK( fs::is_symlink( stat ) );
   }
@@ -837,12 +838,12 @@
     create_file( file_ph, "" );
     BOOST_CHECK( fs::exists( file_ph ) );
     BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular( file_ph ) );
+ BOOST_CHECK( fs::is_regular_file( file_ph ) );
     link = "non_dangling_link";
     fs::create_symlink( file_ph, link );
     BOOST_CHECK( fs::exists( link ) );
     BOOST_CHECK( !fs::is_directory( link ) );
- BOOST_CHECK( fs::is_regular( link ) );
+ BOOST_CHECK( fs::is_regular_file( link ) );
     BOOST_CHECK( fs::is_symlink( link ) );
     fs::remove( link );
     BOOST_CHECK( fs::exists( file_ph ) );
@@ -858,7 +859,7 @@
   create_file( file_ph, "foobar2" );
   BOOST_CHECK( fs::exists( file_ph ) );
   BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular( file_ph ) );
+ BOOST_CHECK( fs::is_regular_file( file_ph ) );
   BOOST_CHECK( fs::file_size( file_ph ) == 7 );
   verify_file( file_ph, "foobar2" );
 


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